Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit f04f67e

Browse files
committed
Ignore buildkit-isms during build/history check
1 parent 90e34ca commit f04f67e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/history.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,18 @@ docker image history --no-trunc --format '{{ .CreatedBy }}' "$@" \
1010
# munge the checksum of the first ADD of the base image (base image changes unnecessarily break our diffs)
1111
NR == 1 && $1 == "ADD" && $4 == "/" { $2 = "-" }
1212
13-
# ignore the contents of certain copies (notoriously unreliable hashes because they often contain timestamps)
14-
$1 == "COPY" && ($4 == "/usr/share/elasticsearch" || $4 ~ /^\/opt\/jdk-/) { gsub(/:[0-9a-f]{64}$/, ":filtered-content-hash", $2) }
13+
# remove "org.label-schema.build-date" and "org.opencontainers.image.created" (https://github.com/elastic/dockerfiles/pull/101#pullrequestreview-879623350)
14+
$1 == "LABEL" { gsub(/ (org[.]label-schema[.]build-date|org[.]opencontainers[.]image[.]created)=[^ ]+( [0-9:+-]+)?/, "") }
15+
16+
# remove several buildkit-isms
17+
/# buildkit$/ {
18+
sub(/^RUN[[:space:]]+/, "")
19+
sub(/^\/bin\/sh[[:space:]]+-c[[:space:]]+/, "")
20+
sub(/[[:space:]]*# buildkit$/, "")
21+
}
22+
$1 == "EXPOSE" { gsub(/map\[|\/tcp:\{\}|\]/, "") }
23+
# buildkit makes COPY expressions hyper-simplified ("COPY --chown=1000:0 --from=foo /foo /bar" becomes just "COPY /foo /bar" vs "COPY --chown=1000:0 dir:xxxx in /bar")
24+
$1 == "COPY" { $0 = gensub(/^[[:space:]]*(COPY)[[:space:]]+([^[:space:]]+[[:space:]]+)+([^[:space:]]+)[[:space:]]*$/, "\\1 ... \\3", 1) }
1525
1626
# sane and sanitized, print it!
1727
{ print }

0 commit comments

Comments
 (0)