diff --git a/templates/gitlab-ci-sonar.yml b/templates/gitlab-ci-sonar.yml index d7f36e48110c9048534b5e70afd5fdc1d3d25ec3..cf5dad865f2888e6e920ef5ccec466a8d9ebdca4 100644 --- a/templates/gitlab-ci-sonar.yml +++ b/templates/gitlab-ci-sonar.yml @@ -44,8 +44,11 @@ spec: --- workflow: rules: - # prevent branch pipeline when an MR is open (prefer MR pipeline) - - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS' + # prevent MR pipeline originating from production or integration branch(es) + - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ $PROD_REF || $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ $INTEG_REF' + when: never + # on non-prod, non-integration branches: prefer MR pipeline over branch pipeline + - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_COMMIT_REF_NAME !~ $PROD_REF && $CI_COMMIT_REF_NAME !~ $INTEG_REF' when: never - if: '$CI_COMMIT_MESSAGE =~ "/\[(ci skip|skip ci) on ([^],]*,)*tag(,[^],]*)*\]/" && $CI_COMMIT_TAG' when: never