changeset 6082:221a2563b02f

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.
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 16 Nov 2021 16:07:41 +0300
parents 8cc7732a29bf
children 9198f447ecae
files .gitlab-ci.yml
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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"