CICD-304 · Automated rollout abortion
Encyclopedia · Advanced GitOps and progressive delivery · All snippets
Previous · CICD-303 · Next · CICD-305
1. Where it fits
- Placement CI run step or authorized lab terminal.
- Prerequisites trusted configuration repository, test cluster and named GitOps controller or rollout controller.
- Platforms kubernetes, local-lab.
- Parameters
ROLLOUT.
2. Copy the snippet
bash
kubectl argo rollouts status "${ROLLOUT:?}" -n staging --timeout=180s || { kubectl argo rollouts abort "$ROLLOUT" -n staging; exit 1; }3. How it works
The status command waits within the rollout budget. When it fails, the script asks the controller to abort the candidate and preserves a failing exit status.
An unsuccessful status check follows an explicit abort path.
flowchart TD
N1["Observe candidate"]
N2{"Rollout status succeeds"}
N1 --> N2
N3["Continue"]
N2 -->|Yes| N3
N4["Abort candidate"]
N2 -->|No| N4
N5["Fail workflow step"]
N4 --> N5
classDef trigger fill:#EFF6FF,stroke:#0540F2,color:#0A0A0A
classDef build fill:#CCFBF1,stroke:#0D9488,color:#0A0A0A
classDef test fill:#EEF2FF,stroke:#4F46E5,color:#0A0A0A
classDef gate fill:#FEF3C7,stroke:#D97706,color:#0A0A0A
classDef security fill:#EDE9FE,stroke:#7C3AED,color:#0A0A0A
classDef deploy fill:#D1FAE5,stroke:#059669,color:#0A0A0A
classDef fail fill:#FEE2E2,stroke:#DC2626,color:#0A0A0A
class N1 test
class N2 gate
class N3 deploy
class N4,N5 fail
4. Verify the result
Abort only the candidate rollout operated by this release. Distinguish a deliberately paused rollout before using an automatic timeout.
Watch for. Use an independently reviewed target, owner and scoped write identity. Confirm the resulting state separately.
Validation syntax-validated (Bash parse). Status definitions.