Read more

Gitlab: How to cancel redundant pipelines

Emanuel
December 19, 2023Software engineer at makandra GmbH

In the Gitlab settings Show archive.org snapshot the flag Auto-cancel redundant pipelines is enabled by default. This auto-cancels jobs that have the interruptible setting set to true (defaults to false e.g. to not cancel deploys by accident).

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Consider to set the interruptible flag for test jobs to reduce the load on your runners like in the following example .gitlab-ci.yml:

rubocop:
  interruptible: true
  script:
    - 'bundle exec rubocop'

rspec:
  interruptible: true
  script:
    - 'bundle exec rspec'

Afterwards new pushes to your MR will cancel all running interruptible jobs the previous pipelines and start a new pipeline with the current commit.

Tip

Instead of configuring jobs to be interruptible by default, you can also setup your .gitlab-ci.yml so commit messages with a string like no-ci don't start a new CI pipeline.

Posted by Emanuel to makandra dev (2023-12-19 11:36)