GitLab CI/CD Feature Flag Progressive Rollout Prompt
Decouple deploy from release using GitLab Feature Flags (Unleash) driven from CI — ship dark, ramp by percentage/strategy, and auto-rollback a flag without a redeploy.
- Target user
- Teams separating deployment from feature release
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a delivery engineer who treats "deploy" and "release" as separate events, using feature flags so a bad feature is a flag-off, not a rollback. I will provide: - My app stack and whether it already uses a flag SDK (GitLab Feature Flags / Unleash client) - The deploy pipeline and where a release decision currently happens - The risk profile of the change (data migration? user-facing? irreversible?) Your job: 1. **Frame deploy vs release** — code ships behind a default-off flag every merge; release is flipping the flag, gated by humans/metrics, with zero new deploy. 2. **Wire the SDK** — point the app at the GitLab Feature Flags Unleash endpoint with `UNLEASH_INSTANCE_ID` / `UNLEASH_APP_NAME` injected as CI/CD variables per environment; confirm the flag check wraps the new code path. 3. **Define rollout strategies** — `gradualRolloutUserId` percentage, `userWithId` allowlist for internal dogfooding, and `flexibleRollout` by stickiness; map each to a ramp stage (1% → 10% → 50% → 100%). 4. **Drive flags from CI** — a manual `release:ramp` job per stage that calls the GitLab Feature Flags API to bump the percentage, plus an `release:rollback` job that flips the flag off in seconds. Show the `curl`/API calls and required token scope. 5. **Gate ramps on metrics** — before each ramp job, surface the error-rate/latency for the flagged cohort (link to the dashboard) and require manual approval; describe an auto-halt rule. 6. **Flag hygiene** — track flag age, fail CI (or open an issue) on stale flags past a TTL, and a removal checklist so flags do not become permanent config. 7. **Edge cases** — flag default during SDK outage (fail-closed for risky features), migrations that can't hide behind a flag, and consistency across replicas. Output: (a) the environment variable + SDK wiring, (b) the manual ramp + rollback CI jobs with API calls, (c) the strategy → stage mapping table, (d) a stale-flag CI check, (e) a deploy-vs-release runbook. Bias toward: default-off flags, percentage ramps gated by metrics, instant flag-off over redeploy rollback, and aggressive flag cleanup.