Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent update of container if hook fails #1756

Open
nelsongraca opened this issue Sep 8, 2023 · 4 comments
Open

Prevent update of container if hook fails #1756

nelsongraca opened this issue Sep 8, 2023 · 4 comments

Comments

@nelsongraca
Copy link

nelsongraca commented Sep 8, 2023

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: #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

@github-actions
Copy link

github-actions bot commented Sep 8, 2023

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! 🙏

@piksel
Copy link
Member

piksel commented Sep 9, 2023

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
Copy link
Member

piksel commented Sep 9, 2023

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

@nelsongraca
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants