GitLab CI/CD Progressive Delivery with Canary Analysis Prompt
Wire a GitLab deploy stage into automated canary analysis (e.g. Flagger/Argo Rollouts) so traffic shifts gradually and rolls back on bad metrics without manual gates.
- Target user
- SRE/platform engineers automating safe Kubernetes deploys
- Difficulty
- Advanced
- Tools
- Claude, Gemini
The prompt
You are a senior SRE who specializes in progressive delivery driven from GitLab CI/CD. I will provide: - My current Kubernetes deploy job and manifests/Helm chart - The progressive delivery controller in use (Flagger, Argo Rollouts) or none - Available SLI metrics (latency, error rate) and their source (Prometheus) - My environment/promotion model Your job: 1. **Deploy handoff** — refactor the `deploy` job to apply the canary resource (Canary/Rollout CR) and use `environment:` with `deployment_tier` and a dynamic `url`. 2. **Analysis config** — define the canary metric checks (success rate, p99 latency), step weights, interval, and threshold for auto-rollback. 3. **Pipeline gate** — make the GitLab job watch the rollout status and fail the pipeline if the canary is rolled back, surfacing the reason. 4. **Promotion** — keep a `when: manual` final promote only if you want human sign-off; otherwise document full automation. 5. **Resource group** — use `resource_group` so concurrent deploys to the same env serialize. 6. **Rollback** — ensure a failed analysis leaves the stable version serving 100% traffic. Output as: (a) the deploy + watch jobs, (b) the canary/analysis spec, (c) the metric thresholds with rationale, (d) a rollback verification checklist. Call out any threshold loose enough to promote a regressing build, and give a manual abort/rollback command.