Skip to content

Commit be36a84

Browse files
erikayasudachojomok
authored andcommitted
ci: main and release branch pipelines cannot be interrupted (#12837)
Currently, all pipelines will be interrupted if a new commit is pushed to the target branch. However, we do not want this behavior for release branches or the `main` branch. This change will conditionally allow the `main` and release branches to NOT be interrupted, while all other branches will be interrupted when new commits are pushed. Trying this out from the [GitLab docs](https://docs.gitlab.com/ci/yaml/#workflowrulesauto_cancel). ## Testing This is when I had this `erikayasuda/condtional-interrupt` branch as one of the conditions (see [this commit](f62b7a6)): <img width="963" alt="Screenshot 2025-04-01 at 5 02 15 PM" src="https://github.com/user-attachments/assets/9c59d7de-cab1-40a6-83ac-1eeec3fa5fb7" /> This is what happened when I removed it as a condition (only for `main` and release branches): <img width="965" alt="Screenshot 2025-04-01 at 5 16 48 PM" src="https://github.com/user-attachments/assets/0f3fec8f-a4f6-4ded-af1b-b3bb40023192" /> ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent 33da846 commit be36a84

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.gitlab-ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ variables:
1313
default:
1414
interruptible: true
1515

16+
workflow:
17+
auto_cancel:
18+
on_new_commit: interruptible
19+
on_job_failure: all
20+
rules:
21+
- if: $CI_COMMIT_BRANCH == 'main'
22+
auto_cancel:
23+
on_new_commit: none
24+
on_job_failure: none
25+
- if: $CI_COMMIT_BRANCH =~ /^[0-9]+\.[0-9]+$/
26+
auto_cancel:
27+
on_new_commit: none
28+
on_job_failure: none
29+
- when: always
30+
1631
include:
1732
- remote: https://gitlab-templates.ddbuild.io/libdatadog/include/one-pipeline.yml
1833
- local: ".gitlab/services.yml" # Include early so others can use the definitions

0 commit comments

Comments
 (0)