Skip to content

Detect and clean stale kind image stamps before building#12504

Open
caseydavenport wants to merge 3 commits intoprojectcalico:masterfrom
caseydavenport:casey-stale-stamps
Open

Detect and clean stale kind image stamps before building#12504
caseydavenport wants to merge 3 commits intoprojectcalico:masterfrom
caseydavenport:casey-stale-stamps

Conversation

@caseydavenport
Copy link
Copy Markdown
Member

If a Docker image gets pruned (or manually removed) while its Make stamp file remains, kind-build-images thinks the image is up-to-date and skips the rebuild. This is a common footgun when iterating on kind clusters - you docker system prune, then make kind-reload silently does nothing because the stamps still exist.

This adds a validate_stamps.sh script that runs before the build. It checks each stamp's corresponding Docker image and removes the stamp if the image is gone, so the subsequent Make invocation correctly rebuilds the missing images.

None

If a Docker image gets pruned while its stamp file remains, Make thinks
the image is up-to-date and skips the rebuild. This adds a validation
step that removes stamps whose images no longer exist in Docker, then
re-invokes Make so prerequisites are re-evaluated with accurate state.
Copilot AI review requested due to automatic review settings April 16, 2026 14:00
@caseydavenport caseydavenport requested a review from a team as a code owner April 16, 2026 14:00
@caseydavenport caseydavenport added docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact labels Apr 16, 2026
@marvin-tigera marvin-tigera added this to the Calico v3.33.0 milestone Apr 16, 2026
Stamp rules now record the Docker image they track, so
validate_stamps.sh can just read the file instead of deriving
the image name from the stamp path via a brittle case statement.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the reliability of the local kind development workflow by preventing stale “image built” stamp/marker files from causing make kind-build-images / make kind-reload to incorrectly skip rebuilding images after Docker images have been pruned.

Changes:

  • Adds a pre-build validation step (validate_stamps.sh) to remove stamp/marker files whose corresponding Docker images no longer exist.
  • Refactors kind-build-images into a wrapper target that runs validation first, then invokes a sub-make (kind-build-images-run) so prerequisites are re-evaluated after any stamp removals.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
lib.Makefile Wraps kind image build in a validation + sub-make flow to ensure stale stamps don’t bypass rebuilds.
hack/test/kind/validate_stamps.sh New script that maps stamp/marker files to Docker image refs and deletes stamps when images are missing.

Comment thread hack/test/kind/validate_stamps.sh Outdated
Comment thread hack/test/kind/validate_stamps.sh Outdated
Comment thread lib.Makefile Outdated
All callers (kind-up, kind-reload) already invoke kind-build-images with
-j$(nproc), so the inner sub-make inherits the jobserver through
MAKEFLAGS. Forcing -j again disconnects from the parent jobserver and
emits a warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants