From 49262843e7e02736cc482a2434bcd20676a42909 Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Wed, 29 Mar 2023 18:51:22 +0200 Subject: 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 --- lcitool/gitlab.py | 8 ++++---- tests/data/manifest/out/ci/gitlab/build-templates.yml | 8 ++++---- 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 -- cgit v1.1