diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be1818391ca083c723a0271b066388e4529bc821..be8b36128b282d4c895ff62907f9ce49d4b37e0c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,8 @@ stages: default: tags: - gitlab-org + # All jobs are interruptible by default + interruptible: true workflow: rules: diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 6420e951a7881fdef3dd145ab82069251976e14e..3dc09b9988ef71c1848ade3fbde54961121bda54 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -16,6 +16,9 @@ .if-master-refs: &if-master-refs if: '$CI_COMMIT_REF_NAME == "master"' +.if-auto-deploy-branches: &if-auto-deploy-branches + if: '$CI_COMMIT_BRANCH =~ /^\d+-\d+-auto-deploy-\d+$/' + .if-master-or-tag: &if-master-or-tag if: '$CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_TAG' @@ -509,6 +512,14 @@ changes: *code-backstage-qa-patterns when: on_success +.setup:rules:dont-interrupt-me: + rules: + - <<: *if-master-or-tag + when: on_success + - <<: *if-auto-deploy-branches + when: on_success + - when: manual + .setup:rules:gitlab_git_test: rules: - <<: *if-default-refs diff --git a/.gitlab/ci/setup.gitlab-ci.yml b/.gitlab/ci/setup.gitlab-ci.yml index b1918961f3e8c673641b2bdab61faceea33b0dcd..60e52ffdf5eccfb33ce9ee21b4ad42d1623a1c4f 100644 --- a/.gitlab/ci/setup.gitlab-ci.yml +++ b/.gitlab/ci/setup.gitlab-ci.yml @@ -23,6 +23,18 @@ cache gems: - .default-retry needs: [] +dont-interrupt-me: + extends: .setup:rules:dont-interrupt-me + stage: prepare + image: alpine:edge + interruptible: false + allow_failure: true + variables: + GIT_STRATEGY: none + dependencies: [] + script: + - echo "This jobs makes sure this pipeline won't be interrupted! See https://docs.gitlab.com/ee/ci/yaml/#interruptible." + gitlab_git_test: extends: - .minimal-job diff --git a/doc/development/pipelines.md b/doc/development/pipelines.md index 5e2b5b3c230fbe76f622f807a0dab73b3ebfa291..bfd184d7d5a2af7127589353910f3224b51a905a 100644 --- a/doc/development/pipelines.md +++ b/doc/development/pipelines.md @@ -142,6 +142,15 @@ and included in `rules` definitions via [YAML anchors](../ci/yaml/README.md#anch | `code-qa-patterns` | Combination of `code-patterns` and `qa-patterns`. | | `code-backstage-qa-patterns` | Combination of `code-patterns`, `backstage-patterns`, and `qa-patterns`. | +## Interruptible jobs pipelines + +By default, all jobs are [interruptible](../ci/yaml/README.md#interruptible), except the +`dont-interrupt-me` job which runs automatically on `master`, and is `manual` +otherwise. + +If you want a running pipeline to finish even if you push new commits to a merge +request, be sure to start the `dont-interrupt-me` job before pushing. + ## Directed acyclic graph We're using the [`needs:`](../ci/yaml/README.md#needs) keyword to