Skip to content

Commit 0f26792

Browse files
authored
[docker] Read the digest from imagetools output instead of --format (project-chip#73587)
The buildx in CI ignores --format and prints the whole human readable record, so remote_digest returned that record rather than a digest. It still compares as non-empty, so skipping the version tag kept working, but comparing two of them never matches because each names its own tag, and latest was therefore pushed on every run. Parse the Digest line, which the unformatted output has carried across versions, so the comparison works whatever buildx is present.
1 parent 994cbf1 commit 0f26792

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

integrations/docker/build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ die() {
7979
# Always succeeds: an unknown tag is an answer, not an error, and the callers
8080
# run under set -e where a non-zero status would abort the script.
8181
remote_digest() {
82-
docker buildx imagetools inspect --format '{{.Manifest.Digest}}' "$1" 2>/dev/null || true
82+
# Parse the Digest line rather than asking for it with --format: older
83+
# buildx ignores the flag and prints the whole human readable record, which
84+
# still compares as non-empty and so silently defeats any comparison
85+
# between two of these. The unformatted output has carried a "Digest:" line
86+
# across versions.
87+
docker buildx imagetools inspect "$1" 2>/dev/null | awk '$1 == "Digest:" { print $2; exit }'
8388
}
8489

8590
set -ex

0 commit comments

Comments
 (0)