Field Note

Make Jobs Interruptible to Reduce Wasteful Use of GitLab Runners

gitlab-ci-cd performance interruptible job
Posted on Thursday, August the 22nd 2024
1 min read

Canceling redundant CI/CD pipelines early is a good practice that prevents wasteful use of runners.

GitLab CI/CD has a feature to auto-cancel redundant pipelines that can be activated on a per project basis.

The setting can be found at in the project settings under CI/CD > General Pipelines > Auto-cancel redundant pipelines.

Once this setting is activated, you may set the interruptible property on individual jobs—or, in the default section to apply it to all jobs—to mark jobs that should be canceled if a newer commit was pushed to the same ref (e.g. to the same branch).

The executed interruption logic may be configured using the top-level property workflow:auto_cancel:on_new_commit. There are three options:

  1. conservative (default): cancels the pipeline only if no jobs with interruptible: false are already running;
  2. interruptible: only cancels jobs marked with interruptible: true; and
  3. none: does not auto-cancel any jobs.

Enabling auto-cancel of pipelines on new commits to the same ref is generally sensible and should, in my opinion, be considered a standard setting. It is probably best, though, to start with workflow:auto_cancel_on_new_commit: interruptible and then iteratively defining jobs as interruptible to keep a watchful eye on the effects.

friedrichkurz.me

© 2025 Friedrich Kurz

Privacy Policy