How do you make a pipeline idempotent and safe to re-run?
IntermediateProductionPipeline Design and Architecture
Answer
Every step should produce the same end state if run twice: use helm upgrade --install, kubectl apply, terraform apply with state locking, and aws s3 sync rather than append operations; make tag pushes tolerant of existing tags with the same digest; use unique deployment IDs; and avoid steps that send emails or create tickets without deduplication. Re-running a failed deployment job must not require manual cleanup, otherwise people stop trusting the "retry" button.
More on Pipeline Design and Architecture
What does a good production CI/CD pipeline look like end to end?BeginnerWhat is your target feedback time for CI and how do you hit it?IntermediateHow do you structure repositories: app repo, config repo, pipeline library?IntermediateHow do you design a pipeline for a monorepo with 50 services?AdvancedShould every merge to main deploy to production automatically?IntermediateHow do you keep pipeline definitions DRY across hundreds of repos?Intermediate