watchtower icon indicating copy to clipboard operation
watchtower copied to clipboard

Can you please add this to the post-update

Open THillebrand opened this issue 3 years ago • 5 comments

The (still undocumented) feature is great for our purpose, but can you add the same functionality to the post-update hook (in the same manner, of course)?

I have added a script to the post-update to check the database-version. If they not match, the script returns exit 1. It would be great if the post-update hook could log a error- or warning-message, so the slack-notification gets a message (level warn) and we are alarmed that something went wrong.

https://github.com/containrrr/watchtower/blob/9e7dfe7be442d1259b6ed5223558f2201f1fd43b/internal/actions/update.go#L76-L80

THillebrand avatar May 13 '22 08:05 THillebrand

The original issue: https://github.com/containrrr/watchtower/issues/499

THillebrand avatar May 13 '22 08:05 THillebrand

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 May 13 '22 08:05 github-actions[bot]

So basically changing this to log an error if the error code is not 0?: https://github.com/containrrr/watchtower/blob/9e7dfe7be442d1259b6ed5223558f2201f1fd43b/internal/actions/update.go#L124

piksel avatar May 16 '22 12:05 piksel

Yes, this is correct. Seems not to be a big deal.

THillebrand avatar May 17 '22 06:05 THillebrand

I agree that this change makes sense.

simskij avatar May 17 '22 09:05 simskij

Hello! Sure, @11-aryan. I'd be happy to review it!

piksel avatar Oct 02 '23 08:10 piksel

Hi @piksel I have created on PR to solve this issue please let me know if you have any suggestions for this change #1791

gaurangkudale avatar Oct 06 '23 15:10 gaurangkudale

Actually, I think this is already implemented? Looking at the code:

https://github.com/containrrr/watchtower/blob/284066a39d083fe4865ae43119a41b42d450b178/pkg/lifecycle/lifecycle.go#L101-L105

It already adds an error log message (which will be sent in notifications) if the post update hook returns something other than a 0.

piksel avatar Oct 07 '23 09:10 piksel

Hi @piksel Thanks for the update Can you please give me more context on this? or Do we need to add a testcase for this?

gaurangkudale avatar Oct 07 '23 10:10 gaurangkudale

As this has already been fixed, I'm closing this issue.

simskij avatar Nov 13 '23 16:11 simskij