From e2be0e2ff08a7b77a7ec1806171a8583d3522f5c Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Tue, 14 Mar 2023 20:01:39 +0200 Subject: [PATCH 1/2] Add workflow rule to only trigger on MRs Signed-off-by: Evan Lezar --- .common-ci.yml | 8 ++++++++ scripts/get-component-versions.sh | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.common-ci.yml b/.common-ci.yml index 4e9a24f4..7a8b5135 100644 --- a/.common-ci.yml +++ b/.common-ci.yml @@ -34,6 +34,14 @@ stages: - scan - release +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + - if: $CI_PIPELINE_SOURCE == "web" + - if: $CI_COMMIT_BRANCH == "main" + - if: $CI_COMMIT_BRANCH =~ /^release-.*$/ + - if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != "" + .main-or-manual: rules: - if: $CI_COMMIT_BRANCH == "main" diff --git a/scripts/get-component-versions.sh b/scripts/get-component-versions.sh index 4e4f3c31..01db3957 100755 --- a/scripts/get-component-versions.sh +++ b/scripts/get-component-versions.sh @@ -62,8 +62,10 @@ echo "LIBNVIDIA_CONTAINER_PACKAGE_VERSION=${libnvidia_container_version_tag//\~/ echo "NVIDIA_CONTAINER_TOOLKIT_VERSION=${nvidia_container_toolkit_version}" echo "NVIDIA_CONTAINER_TOOLKIT_TAG=${nvidia_container_toolkit_tag}" echo "NVIDIA_CONTAINER_TOOLKIT_PACKAGE_VERSION=${nvidia_container_toolkit_version_tag//\~/-}" -if [[ "${libnvidia_container_version_tag}" != "${nvidia_container_toolkit_version_tag}" ]]; then +if [[ "${LIBNVIDIA_CONTAINER_PACKAGE_VERSION}" != "${NVIDIA_CONTAINER_TOOLKIT_PACKAGE_VERSION}" ]]; then >&2 echo "WARNING: The libnvidia-container and nvidia-container-toolkit versions do not match" + >&2 echo "WARNING: lib: ${LIBNVIDIA_CONTAINER_PACKAGE_VERSION}" + >&2 echo "WARNING: toolkit: ${NVIDIA_CONTAINER_TOOLKIT_PACKAGE_VERSION}" fi echo "NVIDIA_CONTAINER_RUNTIME_VERSION=${nvidia_container_runtime_version}" echo "NVIDIA_CONTAINER_RUNTIME_TAG=${nvidia_container_runtime_tag}" From 280f40508ef0f8c2d7c65eeb7194b729ff9f60a1 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 15 Mar 2023 08:49:44 +0200 Subject: [PATCH 2/2] Make pipeline manual on MRs Signed-off-by: Evan Lezar --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a338002..f3f2e14d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,11 @@ build-dev-image: - make .build-image - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}" - make .push-build-image + rules: + - !reference [.main-or-manual, rules] + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + when: manual + - when: always .requires-build-image: image: "${BUILDIMAGE}"