GitLab CI/CD Interruptible & Auto-Cancel Redundant Pipelines Prompt
Stop burning runner minutes on superseded pipelines — design interruptible jobs, auto-cancel-on-new-commit settings, and safe non-interruptible boundaries around deploys and migrations.
- Target user
- Platform engineers cutting CI cost and queue times on busy MR-driven repos
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior CI/CD platform engineer who has cut runner spend by 30-50% on high-traffic repos by aggressively cancelling redundant pipelines without ever killing an in-flight deploy. I will provide: - My `.gitlab-ci.yml` (stages, jobs, `interruptible` usage if any) - Project CI/CD settings (auto-cancel redundant pipelines on/off, auto-cancel pending) - Runner type (instance/group/project, autoscaling or static) and current cost/queue pain - Which jobs touch external state (deploys, DB migrations, Terraform apply, release publishing) Your job: 1. **Explain the mental model** — `interruptible: true` only lets GitLab cancel a job/pipeline when a NEWER pipeline starts on the same ref; once a non-interruptible job has STARTED, the whole pipeline becomes non-cancelable. Spell out this "point of no return" precisely. 2. **Classify every job** as interruptible-safe vs must-finish. Safe: build, lint, unit/integration tests, container scans (idempotent, no external side effects). Unsafe: anything that mutates prod/staging, publishes artifacts to a registry, applies infra, or runs migrations. 3. **Recommend settings**: enable "Auto-cancel redundant pipelines" + set `workflow:auto_cancel:on_new_commit: interruptible` and consider `on_job_failure: all`. Show the exact `workflow:` block. 4. **Guard the danger zone** — mark deploy/migration/release jobs `interruptible: false` explicitly even if defaulted, and ensure they sit AFTER the interruptible test stages so cancellation can still happen pre-deploy. 5. **Default strategy** — set a top-level `default: interruptible: true` and opt OUT per-job, vs opt-in. Recommend one and justify. 6. **Edge cases** — protected branches, merge trains, scheduled pipelines, and `resource_group`-serialized deploys; explain why auto-cancel behaves differently for each. 7. **Validation** — how to confirm via the pipeline UI and `CI_PIPELINE_SOURCE` that cancellation fired correctly, plus a one-week metric: cancelled-pipeline minutes saved vs accidental deploy interruptions (should be zero). Output: (a) annotated `.gitlab-ci.yml` diff with `interruptible` + `workflow:auto_cancel`, (b) the exact project settings to toggle, (c) a job-classification table, (d) a rollback note if cancellation hits a job it shouldn't. Bias toward: never cancelling external side effects, opinionated defaults, and measurable minute savings.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
GitLab CI/CD Windows Runner & PowerShell Pipeline Prompt
Design .gitlab-ci.yml pipelines that run on Windows runners (shell or docker-windows executor) with correct PowerShell shell handling, tag targeting, path/quoting fixes, and mixed Linux/Windows stages.
-
GitLab CI/CD Self-Hosted Runner Spot Instance Cost Prompt
Run GitLab CI jobs on AWS/GCP spot instances with autoscaling runners to cut compute cost, while handling preemption, caching, and job interruption so reliability stays intact.
-
GitLab CI/CD Compute Minutes Cost Control Prompt
Audit and reduce GitLab compute-minute spend — right-size runner tags, kill redundant pipelines, cache aggressively, and put guardrails on the jobs quietly burning your quota.
-
GitLab CI/CD k6 Load Test Performance Gate Prompt
Design a .gitlab-ci.yml stage that runs k6 load/performance tests against a review or staging environment, enforces threshold-based pass/fail gates, and surfaces results as artifacts and metrics reports in merge requests.
More GitLab CI/CD prompts & error guides
Browse every GitLab CI/CD prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.