Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

feat: add open container version to log messages - #2001

Open
aauren wants to merge 2217 commits into
containrrr:mainfrom
aauren:add_opencontainer_version_to_log
Open

aauren wants to merge 2217 commits into
containrrr:mainfrom
aauren:add_opencontainer_version_to_log

Conversation

@aauren

@aauren aauren commented Jul 14, 2024

Copy link
Copy Markdown

What This PR Does

It adds the opencontainers image version to the update log if it exists on the container to give a better description of what the upgrade actually is.

As the issue that I linked below points out, org.opencontainers.image.version is a piloted standard to bring more consistency to container labels. All containers built via GitHub actions add them. Additionally, all containers from linuxserver contain them as well.

Related Issues

This is partially related to #1848

Although in that issue, they were asking that this information be added to watchtower's templating function. I don't actually use the templating function, so I didn't put it there, but I would imagine that making container labels available via the template functions would be a much larger PR.

Testing

I have been running with this setup for several days and it has worked great for me.

Example Output

Found new [lscr.io/linuxserver/nzbhydra2:latest](http://lscr.io/linuxserver/nzbhydra2:latest) image (fbeb6b7869e3 - v7.3.0-ls16)
Stopping /nzbhydra2 (387cd3eb4f70 - v7.2.3-ls15) with SIGTERM
Creating /nzbhydra2
Removing image ba50bb7dfb51

@aauren
aauren requested a review from simonaronsson as a code owner July 14, 2024 17:28

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations on opening your first pull request! We'll get back to you as soon as possible. In the meantime, please make sure you've updated the documentation to reflect your changes and have added test automation as needed. Thanks! 🙏🏼

@aauren
aauren force-pushed the add_opencontainer_version_to_log branch from 4a1e6b2 to d60d5bb Compare September 8, 2025 23:24
@aauren
aauren requested a review from piksel as a code owner September 8, 2025 23:24
@aauren
aauren force-pushed the add_opencontainer_version_to_log branch 3 times, most recently from bdc9864 to 1c2b7b1 Compare April 6, 2026 16:33
@aauren
aauren force-pushed the add_opencontainer_version_to_log branch from 1c2b7b1 to 8e7f199 Compare August 9, 2026 00:18
renovate Bot and others added 22 commits August 11, 2026 20:46
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…#2141)

- Capture running state before stopping to determine AutoRemove applicability
- Skip explicit removal only when container was running and AutoRemove is enabled
- Add test coverage for non-running AutoRemove container explicit removal
- Update documentation to clarify Docker AutoRemove behavior for never-started containers
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ainers (#2140)

- Demote "Failed to retrieve image info" from warn to debug in GetSourceContainer
- Re-emit the warning at warn level in ListSourceContainers only after the container passes filtering
- Emit the warning in GetContainer for containers already being acted upon
- Include container name and image name in the warning message
- Add tests confirming excluded containers produce no warning while monitored ones do
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* perf: reduce scan-cycle memory allocations

- Bound pull, digest, and exec streams so large responses are not buffered
- Cache registry auth, Docker Info mirrors, compiled filters, and image names
- Send notifications on the existing worker and stop calling Report.All() for debug counts
- Deduplicate ImageInspect within a list and reuse the scan set for lifecycle hooks
- Add unit coverage and allocation benches for the changed hot paths

* fix: correct filtered container propagation and image reference parsing

- Pass filtered containers to lifecycle hooks instead of the unfiltered scan list
- Append :latest to image references containing registry host ports, not just any colon
- Clone cached image inspect responses to prevent mutations across shared containers
- Deduplicate concurrent Docker Info fetches with in-flight synchronization
- Surface credential store retrieval errors instead of silently ignoring them
- Short-circuit literal filter patterns to avoid unnecessary regex compilation
- Cap pooled notification JSON scratch buffers at 8 KiB to bound memory retention

* fix(container): isolate inspect clones and serialize image-name updates

- Deep-copy cached image inspect Config and GraphDriver fields
- Lock ImageName reads and writes without deadlocking GetCreateConfig
- Retry Docker Info cache waiters after a failed or panicked leader
- Add a unique-restarted allFromSlices allocation benchmark
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* refactor(tplprev): extract a standalone preview module

- Move preview-only code into tools/tplprev as github.com/nicholas-fedor/tplprev
- Copy the notification template contract so the module does not import Watchtower
- Fold production template Funcs into pkg/notifications
- Align preview rendering with production Data and handle report-off templates
- Add tplprev CI, Codecov, and docs path updates

* fix(tplprev): distinguish JavaScript collections from plain objects

- Update classifyJSType to accept isArray and isTypedArray shape flags
- Reject plain objects as invalid instead of treating them as collections
- Add jsCollectionFlags helper for WASM type detection
- Update statesFromJS and levelsFromJS callers to pass collection flags
- Add govulncheck scanner job for the tplprev module in CI
- Add main_wasm_test.go with expanded test coverage for all type branches
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
github-actions Bot and others added 29 commits September 15, 2026 10:36
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…1.0 (#2384)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
… (#2385)

* refactor(container): replace SetNoRestartPolicy with SetRestartPolicy

- Accept a restart policy so callers can disable or restore it
- Treat an empty policy name as Docker no automatic restart
- Log policy update failures at debug instead of warning

* fix(container): clear retry count when disabling restart policy

- Reset MaximumRetryCount when normalizing an empty policy name to no
- Assert Watchtower self-update passes RestartPolicyDisabled
- Cover empty-name policies that still carry a retry count
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Snapshot copy-file paths before stop/remove and inject them after create
- Sanitize copy archives, reject symlinks, and cap in-flight snapshot memory
- Keep snapshots on the recreate path only and discard leftovers on failed stop
- Document the copy-file label and Compose content vs file config behavior
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ble (#2391)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…400)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…406)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…(#2413)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Include org.opencontainers.image.version labels in email notifications
when a new image is found. Both the old (current) and new image versions
are displayed on a single line, making version transitions easy to see
at a glance. Example output:

  Found new image: ghcr.io/homarr-labs/homarr:latest (b7734c440450) v0.15.0 -> v0.16.0

The version is extracted from the new image during the staleness check
and from the running container's labels for the old version. Images
without the OCI version label are displayed without version info.

Both notification modes carry the versions. Log mode picks them up from
the zerolog fields on the "Found new image" event, which the shoutrrr
hook captures into the legacy template. Report mode renders them through
a VersionInfo template helper, which type-asserts to session.ContainerStatus
rather than widening types.ContainerReport, because tools/tplprev
implements that interface from a separate module. The porcelain JSON
report gains old_version and new_version, both omitempty so existing
consumers see no change for unlabelled images.
@aauren
aauren force-pushed the add_opencontainer_version_to_log branch from 8e7f199 to 7e63141 Compare September 19, 2026 23:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants