Problem Statement
Your deploy job fails after artifacts are published. How do you design for safe retries?
Explanation
Make deploy idempotent and atomic. Use versioned, immutable artifacts. If a step fails, you can retry without double-deploying.
Add clear prechecks and postchecks, and keep a quick rollback path to the last good version.
Code Solution
SolutionRead Only
deploy.sh --version=$ARTIFACT_VERSION healthcheck /ready if fail -> rollback to PREV_VERSION
