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

Commit 42215cb

Browse files
authored
Merge pull request #98 from infosiftr/buildkit-history
Update history munging to account for buildkit-isms in published 7 & 8 images
2 parents ea515d3 + 7d2a884 commit 42215cb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/history.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ docker image history --no-trunc --format '{{ .CreatedBy }}' "$@" \
1313
# just ignore the default CentOS CMD value (not relevant to our needs)
1414
$0 == "CMD [\"/bin/bash\"]" { next }
1515
16-
# ignore the contents of certain copies (notoriously unreliable hashes because they often contain timestamps)
17-
$1 == "COPY" && $4 == "/usr/share/kibana/config/kibana.yml" { gsub(/:[0-9a-f]{64}$/, ":filtered-content-hash", $2) }
18-
1916
# remove "org.label-schema.build-date" and "org.opencontainers.image.created" (https://github.com/elastic/dockerfiles/pull/101#pullrequestreview-879623350)
2017
$1 == "LABEL" { gsub(/ (org[.]label-schema[.]build-date|org[.]opencontainers[.]image[.]created)=[^ ]+( [0-9:+-]+)?/, "") }
2118
19+
# remove several buildkit-isms
20+
/# buildkit$/ {
21+
sub(/^RUN[[:space:]]+/, "")
22+
sub(/^\/bin\/sh[[:space:]]+-c[[:space:]]+/, "")
23+
sub(/[[:space:]]*# buildkit$/, "")
24+
}
25+
$1 == "EXPOSE" { gsub(/map\[|\/tcp:\{\}\]/, "") }
26+
# 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")
27+
$1 == "COPY" { $0 = gensub(/^[[:space:]]*(COPY)[[:space:]]+([^[:space:]]+[[:space:]]+)+([^[:space:]]+)[[:space:]]*$/, "\\1 ... \\3", 1) }
28+
2229
# sane and sanitized, print it!
2330
{ print }
2431
'

0 commit comments

Comments
 (0)