Repository navigation
ci(aie image): tag hash that ignores comments; never rebuild a published tag - #1089
Merged
Merged
Conversation
aie_image_hash.py prints the aie-build image tag: the first 16 hex digits of sha256(toolchain.lock + Dockerfile) after dropping blank and comment lines, stripping trailing whitespace and normalising line endings. The Dockerfile's parser directives at the top (# syntax=, # escape=, # check=) are kept, as they change the build. Co-Authored-By: Claude <noreply@anthropic.com>
devkit-aie-image.yml (build and publish) and devkit-xclbins.yml (image lookup) compute the toolchain hash with the script instead of hashing the raw files, so a comment-only edit of toolchain.lock or the Dockerfile keeps the tag. devkit-aie-image.yml also runs when the script changes. The formula changes, so the current files get a new tag (4d79b217e7000169, was 22fa5e0b8888953d): merging this rebuilds and publishes the image once. Co-Authored-By: Claude <noreply@anthropic.com>
A Dockerfile with a heredoc (RUN <<EOF, COPY <<EOF /path) is hashed with only its line endings normalised: in a heredoc body a "#" line, a blank line or trailing whitespace is content, so dropping it could keep the tag for a different image. toolchain.lock must hold only column-0 comments, blank lines and KEY=VALUE lines with no whitespace in the value (exit 1 otherwise), so every byte the hash ignores there is one no build arg reads; devkit-xclbins.yml, which does not run the image workflow's lock check, gets it too. Each file is now hashed on its own and the tag is the hash of the two digests, so a line moved between the files is a new tag. The current files hash to 578bf8ecdf2b1be0 (was 4d79b217e7000169 on this branch, 22fa5e0b8888953d with the inline formula on main). Co-Authored-By: Claude <noreply@anthropic.com>
…n hash A comment-only edit kept the tag but still rebuilt the image, reran the kernel check and republished, and the publish moved the existing :<toolchain hash> tag to the new digest. Now: - build looks :<toolchain hash> up anonymously (not on workflow_dispatch); if it is published, it skips the image build and runs docker/aie-build-check.sh in the published image, so a change to the check or the PDI list, which the hash does not cover, is still tested. - publish, on a push, looks the tag up after logging in; if it exists it pushes, checks and tags nothing, so a published tag is never moved. workflow_dispatch still republishes. Header comments and the script's docstring now say so. Co-Authored-By: Claude <noreply@anthropic.com>
Each "Read toolchain.lock" step (two in devkit-aie-image.yml, one in devkit-xclbins.yml) must call aie_image_hash.py "$LOCK" "$DOCKERFILE" and must not hash with sha256sum, and LOCK and DOCKERFILE must be the script's defaults: an inline hash in one of them would make the published tag and the looked-up tag differ without an error. Co-Authored-By: Claude <noreply@anthropic.com>
Security scan found no critical or high findings on lines changed by this pull requestView the security scan run for complete reports. “New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta. |
zaneni6
marked this pull request as ready for review
November 21, 2026 01:30
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
The aie-build image tag was
cat toolchain.lock Dockerfile | sha256sum | cut -c1-16, computed inline in three places. A comment-only edit (like the one in #1086) produced a new tag, so a functionally identical image was rebuilt (~25 min) and republished..github/script/ci/aie_image_hash.py(standard library only) hashes normalised inputs:#comment lines dropped# syntax=,# escape=,# check=) are kept, since they change the buildRUN <<EOF,COPY <<EOF ...) is hashed as written, with only line endings normalised, because a#line inside a heredoc is content, not a commenttoolchain.lockonly accepts strictKEY=VALUElines besides commentsdevkit-aie-image.ymlanddevkit-xclbins.ymluse the script in all three places. The script is in the image workflow's path filters, so a formula change republishes.devkit-aie-image.ymlno longer rebuilds or moves a published tag (except onworkflow_dispatch, which always rebuilds and republishes):aie-build:<hash>up; if it is published, it skips the image build and runsdocker/aie-build-check.shin the published image, so a change to the check or the PDI list (not covered by the hash) is still tested;toolchain.lock's header comment now names the script.Effect after merge
The tag formula changes, so the tag for the current files becomes
578bf8ecdf2b1be0. The first push to main after merge builds and publishes that tag once (the PDI check runs as usual). Until it finishes,devkit-xclbinsbuilds the image in-run from the layer cache, as it does today for an unpublished tag.Testing
test_aie_image_hash.py: comment, blank-line, whitespace, line-ending and BOM edits keep the hash; value, instruction, indentation, directive and heredoc edits change it; CLI and real-file tests. All pass on Windows..github/script/cisuite: only the known Windows-environment failures (read-only.gitrmtree, symlink privilege, path separators).devkit_check.pyandcheck_internal_refs.pypass.🤖 Generated with Claude Code