fix: --update allow updating existing pinned digests#22
Merged
Conversation
Remove the `inst.Digest != ""` guard in applyDockerfile and applyCompose so that images already pinned with a digest can have their digest replaced when --update is used. Add test and document the --update flag. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Without --update, images that already have a digest are now preserved instead of being re-resolved. This prevents unintended digest changes during normal pinning runs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merged
azu
pushed a commit
that referenced
this pull request
Apr 1, 2026
<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### Bug Fixes * fix: `--update` allow updating existing pinned digests by @azu in #22 **Full Changelog**: v1.0.4...v1.0.5 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow
--updateto re-resolve and replace digests on images that are already pinned. Previously, images with an existing@sha256:digest were skipped during apply, making--updateineffective for already-pinned images.Changes
inst.Digest != ""early-return guard inapplyDockerfileandapplyCompose(cmd/pin.go) so that existing digests are overwritten with the newly resolved valueTestApplyDockerfile_UpdateExistingDigesttest to verify digest replacement--updateflag usageBreaking Changes
None
Test Plan
go test ./...passesTestApplyDockerfile_UpdateExistingDigestconfirms thatFROM node:20.11.1@sha256:olddigestis rewritten to the new digest