Skip to content

Add auto_cancel:on_new_commit to canceling redundant pipelines

Furkan Ayhan requested to merge 412473-4-use-auto_cancel_on_new_commit into master

What does this MR do and why?


This is the fourth step of #412473 (closed).

  1. Add auto_cancel_on_new_commit to ci_pipeline_me... (!137520 - merged)
  2. Add new syntax of workflow:auto_cancel:on_new_c... (!137892 - merged)
  3. Add `interruptible` to trigger jobs (!138508 - merged)
  4. <--HERE-->
  5. workflow:rules:auto_cancel (#436467 - closed)

In this change, we are using auto_cancel_on_new_commit in CancelRedundantPipelinesService and adding safe_cancellation to CancelPipelineService.

These changes are behind the FF ci_workflow_auto_cancel_on_new_commit (#434676 (closed)).

Screenshots or screen recordings

Enable the FF:

Feature.enable(:ci_workflow_auto_cancel_on_new_commit)

Example config;

workflow:
  auto_cancel:
    on_new_commit: interruptible

test1:
  script: sleep 1

test2:
  script: sleep 60
  interruptible: false

test3:
  script: sleep 60
  interruptible: true

Create a pipeline;

Screenshot_2023-12-11_at_13.16.49

Send another commit and see the previous pipeline;

Screenshot_2023-12-11_at_13.18.21

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Furkan Ayhan

Merge request reports