Repository navigation
Failed deployment stays recorded as deployed, so it is not retried and not reported again #1702
Closed
denisolnce
started this conversation in
Ideas
Replies: 1 comment 1 reply
|
I would also go with Option 1 with endless retries until it succeeds and a new label. I always try to use the container labels to store any data that needs to survive a doco-cd restart. Maybe we can think about a opt-in rollback functionality for deployments sometime later for cases where a succesful deployment of the new state is not possible. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What happens
A stack of mine has a
post_starthook that runs database migrations. The hookexited 1, so the deployment failed, correctly:
The next poll, 30 seconds later, said:
So the failed commit counts as deployed. The containers run the new images, the
migrations never ran, and the failure was reported exactly once. Nothing retried
it, nothing reminded me. If I had not watched the log, only one message in the
chat would tell that the environment is half deployed.
Why
The deployment state lives on the containers, and it is written when compose
creates them:
addComposeLabels(internal/docker/compose.go) putsDocoCDLabels.Deployment.CommitSHA= latest commit into every service's customlabels, before
upruns.deployedState.GetDeploymentCommitSHA()(
internal/stages/stage_2_pre-deploy.go) and skips when it equals the latestcommit.
A
post_starthook runs after the container started, so the label with the newcommit already exists when the hook fails. Same for anything else that fails after
containers are created.
The behaviour is asymmetric, which makes it easy to miss:
and reports. That is loud, sometimes too loud.
That is silent, and it is the dangerous one.
Proposal
Record the outcome, not only the commit. Two shapes:
example a
doco-cd.deployment.statuslabel written after the stages finish.Pre-deploy then treats "same commit, last outcome failed" as a change and
deploys again. Retry keeps working like the pull-failure case, and with the
de-duplication from fix(notification): stop repeating and duplicating failure notifications #1700 it costs one message plus reminders, not a flood.
labels are part of the project model that compose applies during
up, so thisneeds a second pass over the containers and I like it less.
I would go with option 1.
Two questions before I open a PR:
volume instead? A label survives a daemon restart, which is why I picked it.
All reactions