Skip to content

fix selecting wrong master branch

Giovanni Ferri requested to merge fix/master_branch_pickup into master

This PR is about fixing the builder_get_git_lib function, when it picks up branch that start with a string, instead of the actual $VERSION_STRING specified in the pipeline conf. for example, if a master branch is selected as the second arg of the func, and there are multiple branches present in the repo that start with master, ie. master-test. Also on request from @divish the logic has been changed to pick up the EXACT branch in case of branches, or latest tag if it starts with tags/.

Screenshot_2024-07-10_at_11.48.36 https://gitlab.builder.ai/devops/client_projects/staging/1672929-dev-infra/-/jobs/70938745#L130

Testing the function locally, this behaviour can be observed:

  • if only a master branch is present: Screenshot_2024-07-10_at_12.01.47

  • if multiple master* branches: Screenshot_2024-07-10_at_12.02.51

  • using the patched code in this pr, scenario as previous point: Screenshot_2024-07-10_at_12.19.36

the tags/N. behaviour of selecting the latest (as per the semver notation) is preserved.

create_cluster picking up platform-automation-tools: image https://gitlab-internal.builder.ai/devsecops/team/giovannif/giovannif-platform/-/jobs/578818

tag is 1.,1.73, which is currently the latest tag: image

Edited by Giovanni Ferri

Merge request reports