From ba66c70080f0390d233a0586c29e29e4ec2beb9e Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Fri, 13 Sep 2024 14:54:23 -0400 Subject: [PATCH] Modify index munge for verification Preserves the image.ref.name annotatoon and set it to the first arch tag --- .test/meta-commands/out.sh | 5 ++--- meta.jq | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.test/meta-commands/out.sh b/.test/meta-commands/out.sh index 340cffa..eeb1980 100644 --- a/.test/meta-commands/out.sh +++ b/.test/meta-commands/out.sh @@ -45,10 +45,9 @@ tar -xvf temp.tar -C temp rm temp.tar jq ' .manifests |= ( - del(.[].annotations) - | unique + unique_by([ .digest, .size, .mediaType ]) | if length != 1 then - error("unexpected number of manifests: " + length) + error("unexpected number of manifests: \(length)") else . end ) ' temp/index.json > temp/index.json.new diff --git a/meta.jq b/meta.jq index 12b7a6e..6a3207b 100644 --- a/meta.jq +++ b/meta.jq @@ -209,10 +209,9 @@ def build_command: # munge the index to what crane wants ("Error: layout contains 5 entries, consider --index") @sh "jq \(" .manifests |= ( - del(.[].annotations) - | unique + unique_by([ .digest, .size, .mediaType ]) | if length != 1 then - error(\"unexpected number of manifests: \" + length) + error(\"unexpected number of manifests: \\(length)\") else . end ) " | unindent_and_decomment_jq(3)) temp/index.json > temp/index.json.new",