From ccd3b59bc19eafd49c353fa5c6ac4792befe837e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 24 Nov 2022 20:10:03 +0100 Subject: [PATCH] gitlab-ci: rules:/workflow: to make RUN_KVM_JOBS work reliably I have RUN_KVM_JOBS set on my fork, but it often fails to trigger. https://medium.com/devops-with-valentine/fix-gitlab-ci-duplicate-pipelines-in-merge-requests-when-using-rules-9a1486994f3a --- .gitlab-ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e6e20ebc..f8e69dda9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,13 @@ stages: - test - deploy +# only create a pipeline if it is a merge request, not for plain +# branches, unless that branch is master. +workflow: + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + .base: before_script: - test -e /etc/apt/sources.list.d/bullseye-backports.list @@ -132,9 +139,8 @@ errorprone: tags: - fdroid - kvm - only: - variables: - - $RUN_KVM_JOBS + rules: + - if: $RUN_KVM_JOBS <<: *test-template <<: *kvm-connected-template