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
-
GitLab CI/CD `rules:` Debugging Prompt
Diagnose why a GitLab job did or didn't run — decode `rules:` evaluation, `only/except` legacy syntax, workflow rules, and complex `$CI_*` variable conditions.
-
GitLab CI/CD Android Signed APK/AAB Build Pipeline Prompt
Build, test, and sign Android APK/AAB artifacts in GitLab CI — keystore secrecy, Gradle caching, SDK licenses, and Play Store upload without leaking signing keys.
-
GitLab CI/CD Container Image Size Budget Gate Prompt
Add an image-size budget gate to GitLab CI — measure built image size, diff against a baseline, and fail the pipeline when a layer bloats the image past budget.
-
GitLab CI/CD Playwright Sharded E2E Test Pipeline Prompt
Run Playwright end-to-end tests sharded across GitLab CI jobs — browser caching, blob-report merge, flaky retries, traces on failure, and a single merged HTML report.
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.