# HG changeset patch # User Anton Shestakov # Date 1637068061 -10800 # Node ID 221a2563b02f09294ea31b6fea3e8ab08979779e # Parent 8cc7732a29bf1a2cf3b1bf8c8581d3ba90443d4d ci: allow defining $hg_branch to update to using an environment variable GitLab CI/CD variables page says that "Variables set in the GitLab UI are not passed down to service containers", but I think it only applies to variables set in project settings, because HG_BRANCH works correctly when set at the point of creating a new pipeline manually. diff -r 8cc7732a29bf -r 221a2563b02f .gitlab-ci.yml --- a/.gitlab-ci.yml Wed Nov 10 20:28:02 2021 +0300 +++ b/.gitlab-ci.yml Tue Nov 16 16:07:41 2021 +0300 @@ -1,6 +1,6 @@ .prepare_hg: &prepare_hg - hg pull -R /ci/repos/mercurial/ - - hg_branch=$(tests/testlib/map-hg-rev.sh "$(hg identify --branch)") + - hg_branch=${HG_BRANCH:-$(tests/testlib/map-hg-rev.sh "$(hg identify --branch)")} - hg -R /ci/repos/mercurial/ update "$hg_branch" - hg_rev=$(hg log -R /ci/repos/mercurial/ -r . -T '{node}') - echo testing with mercurial branch="$hg_branch", revision="$hg_rev"