aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Bolognani <abologna@redhat.com>2023-03-29 18:51:22 +0200
committerAndrea Bolognani <abologna@redhat.com>2023-03-29 21:56:27 +0200
commit49262843e7e02736cc482a2434bcd20676a42909 (patch)
tree731684180ed892bea72ec6f523a9385f2ac0141c
parent5d505f92304f88e5b88d89c30e65b9121fbdc6c7 (diff)
downloadlibvirt-ci-49262843e7e02736cc482a2434bcd20676a42909.zip
libvirt-ci-49262843e7e02736cc482a2434bcd20676a42909.tar.gz
libvirt-ci-49262843e7e02736cc482a2434bcd20676a42909.tar.bz2
gitlab: Use envid to look up resources
Using $NAME is fine when performing a native build, but when cross-building we need to use $NAME-cross-$CROSS instead, or we will pick up the wrong file and things will not work. This currently affects all $CROSS-$NAME-local-env jobs, which end up performing a native build instead of the expected cross-build. Signed-off-by: Andrea Bolognani <abologna@redhat.com>
-rw-r--r--lcitool/gitlab.py8
-rw-r--r--tests/data/manifest/out/ci/gitlab/build-templates.yml8
2 files changed, 8 insertions, 8 deletions
diff --git a/lcitool/gitlab.py b/lcitool/gitlab.py
index 153fcca..7808146 100644
--- a/lcitool/gitlab.py
+++ b/lcitool/gitlab.py
@@ -229,7 +229,7 @@ def _build_template(template, envid, project, cidir):
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
changes:
- {cidir}/gitlab/container-templates.yml
- - {cidir}/containers/$NAME.Dockerfile
+ - {cidir}/containers/{envid}.Dockerfile
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
when: manual
@@ -245,7 +245,7 @@ def _build_template(template, envid, project, cidir):
stage: builds
interruptible: true
before_script:
- - source {cidir}/buildenv/$NAME.sh
+ - source {cidir}/buildenv/{envid}.sh
- install_buildenv
- cat /packages.txt
rules:
@@ -285,13 +285,13 @@ def _build_template(template, envid, project, cidir):
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
changes:
- {cidir}/gitlab/container-templates.yml
- - {cidir}/containers/$NAME.Dockerfile
+ - {cidir}/containers/{envid}.Dockerfile
when: manual
allow_failure: true
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
changes:
- {cidir}/gitlab/container-templates.yml
- - {cidir}/containers/$NAME.Dockerfile
+ - {cidir}/containers/{envid}.Dockerfile
when: on_success
# upstream+forks: merge requests targeting non-default branches
diff --git a/tests/data/manifest/out/ci/gitlab/build-templates.yml b/tests/data/manifest/out/ci/gitlab/build-templates.yml
index a2d0a84..2062062 100644
--- a/tests/data/manifest/out/ci/gitlab/build-templates.yml
+++ b/tests/data/manifest/out/ci/gitlab/build-templates.yml
@@ -174,7 +174,7 @@
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
changes:
- ci/gitlab/container-templates.yml
- - ci/containers/$NAME.Dockerfile
+ - ci/containers/$NAME-cross-$CROSS.Dockerfile
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
when: manual
@@ -190,7 +190,7 @@
stage: builds
interruptible: true
before_script:
- - source ci/buildenv/$NAME.sh
+ - source ci/buildenv/$NAME-cross-$CROSS.sh
- install_buildenv
- cat /packages.txt
rules:
@@ -230,13 +230,13 @@
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
changes:
- ci/gitlab/container-templates.yml
- - ci/containers/$NAME.Dockerfile
+ - ci/containers/$NAME-cross-$CROSS.Dockerfile
when: manual
allow_failure: true
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
changes:
- ci/gitlab/container-templates.yml
- - ci/containers/$NAME.Dockerfile
+ - ci/containers/$NAME-cross-$CROSS.Dockerfile
when: on_success
# upstream+forks: merge requests targeting non-default branches