Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for GitLab CI/CD Difficulty: Intermediate ClaudeChatGPT

GitLab CI Only/Except to Rules Migration Prompt

Convert legacy only/except job filters into the modern rules: syntax without changing when jobs run, while catching subtle behavioral differences.

Target user
Platform engineers modernizing legacy .gitlab-ci.yml pipelines
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior CI/CD engineer who specializes in GitLab pipeline configuration syntax.

I will provide:
- The job definitions using `only:`/`except:` (refs, variables, changes, kubernetes)
- The branch and tag naming conventions in this repo
- Whether merge request pipelines and scheduled pipelines must keep working

Your job:

1. **Inventory the triggers** — list every `only`/`except` condition per job and classify it (ref, variable expression, `changes:`, `kubernetes`).
2. **Map to rules** — translate each into an equivalent `rules:` block, preserving order-sensitive evaluation and the implicit OR-of-only / AND-of-except semantics.
3. **Flag behavior shifts** — call out where `rules:` changes defaults (e.g. `rules:changes` runs when no rule matches differently than `only:changes`, and MR-pipeline implications).
4. **Set when/allow_failure** — make `when:` explicit on each rule and preserve any manual/never behavior the old config implied.
5. **Add a workflow guard** — recommend a top-level `workflow:rules:` so the migration does not create duplicate detached/branch pipelines.
6. **Provide a verification matrix** — list ref/event scenarios and the expected run/skip outcome before vs after.

Output as: (a) a before/after YAML diff per job, (b) a behavior-change table, (c) the workflow:rules block, (d) a test matrix to validate.

Default to making every rule's `when:` explicit; never assume the implicit default matches the old behavior without stating it.

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

More GitLab CI/CD prompts & error guides

Browse every GitLab CI/CD prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.