Skip to content

Backend: `interruptible` field in CI YAML should support condition

Description

The idea of interruptible is brilliant. New pipelines can automatically cancel the old one. But the problem is that for some jobs, we want the interruptible to behave differently on master and other branches.

For example, the build job can be set interruptible on the dev branch, as the developers tend to push something immature and then immediately push a fix. Canceling the old build job is the right choice.

But that's not the case on master(suppose master and branch share the same job). On master(or release), even if a new pipeline is created, the old should be kept untouched, as it might publish to somewhere, e.g., create docker image or publish to somewhere.

Proposal

Add a condition to interruptible field in CI Yaml.

build:
  interruptible: true
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      interruptible: false

Links to related issues and merge requests / references

Edited by Furkan Ayhan