Skip to content

Commit

Permalink
Modify index munge for verification
Browse files Browse the repository at this point in the history
Preserves the image.ref.name annotatoon and set it to the first arch tag
  • Loading branch information
LaurentGoderre committed Sep 13, 2024
1 parent c394a5a commit 5d2128d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions .test/meta-commands/out.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ tar -xvf temp.tar -C temp
rm temp.tar
jq '
.manifests |= (
del(.[].annotations)
| unique
"docker.io/amd64/docker:24.0.7-cli" as $refName
| unique_by([ .digest, .size, .mediaType ])
| if length != 1 then
error("unexpected number of manifests: " + length)
else . end
| .[0].annotations += {
"org.opencontainers.image.ref.name": $refName
}
)
' temp/index.json > temp/index.json.new
mv temp/index.json.new temp/index.json
Expand Down
9 changes: 6 additions & 3 deletions meta.jq
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,14 @@ def build_command:
# munge the index to what crane wants ("Error: layout contains 5 entries, consider --index")
@sh "jq \("
.manifests |= (
del(.[].annotations)
| unique
@sh "\"docker.io/\(first(.source.arches[.build.arch].archTags[]))\" as $refName"
| unique_by([ .digest, .size, .mediaType ])
| if length != 1 then
error(\"unexpected number of manifests: \" + length)
error("unexpected number of manifests: " + length)
else . end
| .[0].annotations += {
"org.opencontainers.image.ref.name": $refName
}
)
" | unindent_and_decomment_jq(3)) temp/index.json > temp/index.json.new",
"mv temp/index.json.new temp/index.json",
Expand Down

0 comments on commit 5d2128d

Please sign in to comment.