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

feat: add porcelain output #1337

Merged
merged 11 commits into from
Aug 14, 2022
Merged

feat: add porcelain output #1337

merged 11 commits into from
Aug 14, 2022

Conversation

piksel
Copy link
Member

@piksel piksel commented Aug 1, 2022

This PR adds the --porcelain flag to help with using watchtower in scripts. When set, it uses a built-in template (porcelain.v1.summary-no-log) and writes notifications to stdout.
The output is meant to be stable and easily processed by common scripting tools like awk etc.

Versioning of the templates is done by passing the version to --porcelain as an argument, with only v1 being supported for now. That way we can add newer versions of templates without breaking scripts.

The output of the v1 template looks like this:

container_name1 (container_image1:tag): Updated
container_name2 (container_image2:tag): Fresh Error: no credentials

(fresh here just means that it's the latest version we know of, but checking failed so it might not be)

or:

no containers matched filter

Fixes #1336

@codecov
Copy link

codecov bot commented Aug 1, 2022

Codecov Report

Merging #1337 (5fa306a) into main (08831f7) will increase coverage by 0.51%.
The diff coverage is 80.64%.

@@            Coverage Diff             @@
##             main    #1337      +/-   ##
==========================================
+ Coverage   63.82%   64.33%   +0.51%     
==========================================
  Files          23       23              
  Lines        1534     1598      +64     
==========================================
+ Hits          979     1028      +49     
- Misses        465      473       +8     
- Partials       90       97       +7     
Impacted Files Coverage Δ
pkg/notifications/email.go 90.69% <ø> (ø)
pkg/notifications/notifier.go 85.13% <75.00%> (+0.20%) ⬆️
pkg/notifications/shoutrrr.go 73.33% <80.00%> (-1.37%) ⬇️
internal/flags/flags.go 87.56% <80.95%> (-1.56%) ⬇️
pkg/notifications/slack.go 95.12% <100.00%> (+0.25%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@piksel piksel marked this pull request as ready for review August 1, 2022 23:12
@piksel piksel requested a review from simskij as a code owner August 1, 2022 23:12
internal/flags/flags.go Outdated Show resolved Hide resolved
@simskij simskij changed the title feat: add porcaline output feat: add porcelaine output Aug 4, 2022
@simskij simskij changed the title feat: add porcelaine output feat: add porcelain output Aug 4, 2022
@piksel piksel merged commit 7900471 into main Aug 14, 2022
@piksel piksel deleted the feat/porcelain branch August 14, 2022 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow using stdout for session results to be used in scripts
1 participant