fix(docker): rebuild the pipeline image when its build inputs change - #103
Merged
Conversation
The wrapper only built when the image was absent, so pulling a Dockerfile fix silently reused the stale image and reintroduced the bug it fixed. The build inputs are now fingerprinted into an image label and compared before each run.
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.
Problem
Found while testing the container on a real machine.
scripts/netflow-db-docker.shonly built the image when it was absent:So after pulling the tzdata fix from #102, the run still failed with the exact error that fix removes — the wrapper found the stale
atlantis-netflow-db:localfrom a previous build and reused it. Nothing was wrong with the fix; the image simply never got rebuilt. Anyone who has built once and then pulls any pipeline or Dockerfile change hits this, and the failure looks like the fix did not work.Solution
Fingerprint the inputs that actually change the image, store it as an image label, and compare before each run:
vendor/nfdumpcommitDockerfile,.dockerignorerust-toolchain.toml,Cargo.toml,Cargo.lock,tools/netflow-db/Cargo.tomltools/netflow-db/srcvendor/scripts/compile-nfdump.shHashing uses
git hash-object, which the wrapper already depends on for reading the submodule pin —sha256sumis not present on macOS by default, so this avoids adding a coreutils requirement.The wrapper now prints why it is building (
missing,out of date, orrequested) instead of building silently.--buildstill forces a rebuild.Images built before this change carry no label, so they read as stale and rebuild once on the next run — which is the desired migration.
Flows to exercise
Verification
The fingerprint function was exercised directly: stable across repeated calls, changes when
Dockerfilechanges, changes when a file undertools/netflow-db/srcchanges, and returns to the baseline value when the edits are reverted.bash -npasses;bun run formatandbun run typecheckpass.Not yet verified end to end against a live Docker daemon — a full
--buildrun is in progress on the machine where this was found, and I will confirm the rebuild-detection path there.Authored with Claude Code (Fable 5).