diff --git a/templates/ref-bot-ci-trigger-template.yml b/templates/ref-bot-ci-trigger-template.yml index 26767232490e6ee5bd20921eced46bafaab12248..3980c15dde78677e226a2b4396c9fe0e42d3cbde 100644 --- a/templates/ref-bot-ci-trigger-template.yml +++ b/templates/ref-bot-ci-trigger-template.yml @@ -1,9 +1,25 @@ +# Avoid duplicate pipelines (from https://docs.gitlab.com/ee/ci/yaml/workflow.html) +# - Branch pipelines when a merge request is not open for the branch. +# - Merge request pipelines when a merge request is open for the branch. +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS + when: never + - if: $CI_COMMIT_BRANCH +# WARNING: this workflow will override a workflow defined in +# the main CI, if this yml is included after it. + update refs (maintainers only): allow_failure: true rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: manual + # run this only on MRs + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + when: manual + # Note that .post + "rules: ... merge_request_event" does not create a job for some reason. + # This is why we need the workflow:rules configuration. stage: .post + needs: [] # do not require that other pipeline stages have passed variables: GIT_STRATEGY: none FORCE: 0