watchtower icon indicating copy to clipboard operation
watchtower copied to clipboard

Prevent update of container if hook fails

Open nelsongraca opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe.

The docs say the following:

The failure of a command to execute, identified by an exit code different than 0 or 75 (EX_TEMPFAIL), will not prevent watchtower from updating the container. Only an error log statement containing the exit code will be reported.

From this I understand that there is no way to prevent an update if a hook fails.

Reading this issue: https://github.com/containrrr/watchtower/issues/499 and the code in: https://github.com/containrrr/watchtower/blob/36391b0ae791ef9a451fd63b34b117689f6248eb/internal/actions/update.go#L158-167

Seems to say otherwise, if the pre-update hook has an exit code different than 0 it will stop and not update the container, the opposite of the docs.

Which is correct?

Describe the solution you'd like

Make code and docs consistent or more clear

Describe alternatives you've considered

none here

Additional context

No response

nelsongraca avatar Sep 08 '23 21:09 nelsongraca

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏

github-actions[bot] avatar Sep 08 '23 21:09 github-actions[bot]

Yeah, this is really confusing. The docs are either just not updated, or are just referring to another lifecycle hook... Either way, it doesn't make sense right now and does not reflect the actual behavior.

piksel avatar Sep 09 '23 08:09 piksel

Yeah, it applies to all the lifecycle hooks except PreUpdate. This should be clarified.

piksel avatar Sep 09 '23 08:09 piksel

@piksel Thanks for clearing it up, if there's something worse than no documentation it's wrong documentation

nelsongraca avatar Sep 09 '23 12:09 nelsongraca