feat: report why an artifact is being rebuilt on a cache miss - #10175
Open
peter-sanford wants to merge 1 commit into
Open
feat: report why an artifact is being rebuilt on a cache miss#10175peter-sanford wants to merge 1 commit into
peter-sanford wants to merge 1 commit into
Conversation
"Not found. Building" gives no indication of whether an artifact's inputs changed or whether its previously built image simply disappeared, which makes an unexpected rebuild hard to diagnose. The cache lookup already distinguishes those two cases: it knows whether the artifact's current hash had an entry in the artifact cache. Carry that distinction into needsBuilding as a typed reason and append it to the existing line: - app: Not found. Building (no cached build for the current inputs) - app: Not found. Building (cached image is no longer available) The reason is derived entirely from state the lookup already has, so this adds no new files, flags, lookups or I/O.
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.
PR 1 — branch
cache-miss-reasonTitle: feat: report why an artifact is being rebuilt on a cache miss
Fixes #10174
What
Not found. Buildingsays an artifact is being rebuilt but not why, so arebuild caused by a pruned image looks exactly like one caused by a source
change.
The cache lookup already distinguishes the two: it knows whether the artifact's
current hash had an entry in the artifact cache. This carries that into
needsBuildingas a typed reason and appends it to the existing line:Notes for review
entry the lookup already had in hand, so there is no behavioural change
beyond the message.
assert on the enum rather than on prose.
Not found. Building(includingintegration/build_test.goandintegration/build_dependencies_test.go) keeps working.docs-v2/.../tutorials/artifact-dependencies.mdisupdated to match what the command now prints.
Testing
go test ./pkg/skaffold/build/cache/...— new coverage for the reasonderivation and for the printed output end to end.
./pkg/skaffold/... ./cmd/... ./hack/... ./pkg/webhook/...,-race -short) passes.hack/boilerplate.sh,hack/check-schema-changes.sh,hack/check-samples.sh,hack/check-licenses.sh,hack/test-generated-proto.shand the docs sitebuild all pass.