Skip to content

Avoid mistakenly uploading to target projects from open MRs

Emanuele Aina requested to merge wip/em/fix-spurious-uploads into master

The current code falls back to $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME when figuring out if a branched OBS project should be the target of the upload:

if [[ ${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} != $OSNAME/* ]];
then
  # upload to branched OBS project
fi

The big bug is that a MR for a backport going straight from apertis/v2023dev1 to apertis/v2022 will skip the body of that if and will actually upload to the production apertis:v2022:* OBS project as soon the MR is created rather than when it is merged.

On a MR we should always upload to a branched project: to do that, we can rely on the fact that $CI_COMMIT_BRANCH is not set in merge request context and simply drop the fallback.

Merge request reports