rewrite response building.

This commit is contained in:
redxef 2022-08-29 21:29:52 +02:00
parent ab5e2f6420
commit 5da68d0f59
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921
3 changed files with 14 additions and 3 deletions

View file

@ -4,4 +4,8 @@ set -eu
[ -e /opt/resource/common ] && cd /opt/resource [ -e /opt/resource/common ] && cd /opt/resource
. ./common . ./common
jq -r --null-input --arg version "$(crane digest "$REPOSITORY:$TAG")" '[{"digest": $version}] | tostring'
filter='[
{"digest": $version}
] | tostring'
jq -r --null-input --arg version "$(crane digest "$REPOSITORY:$TAG")" "$filter"

5
src/in
View file

@ -11,4 +11,7 @@ cd "$oci_dir"
tar cf "$1/image.tar" ./* tar cf "$1/image.tar" ./*
cd - 1>&2 2>/dev/null cd - 1>&2 2>/dev/null
jq -r '.version | tostring' < "$INPUT_FILE" filter='{
"version": .version
} | tostring'
jq -r "$filter" < "$INPUT_FILE"

View file

@ -11,4 +11,8 @@ cd "$oci_dir"
tar xf "$1/$(jq -r .params.image < "$INPUT_FILE")" tar xf "$1/$(jq -r .params.image < "$INPUT_FILE")"
cd - 1>&2 2>/dev/null cd - 1>&2 2>/dev/null
crane push "$oci_dir" "$REPOSITORY:$TAG" --image-refs="$IMAGE_REFS_FILE" crane push "$oci_dir" "$REPOSITORY:$TAG" --image-refs="$IMAGE_REFS_FILE"
jq -r --null-input --arg version "$(sed 's/^[^@]*@//' < "$IMAGE_REFS_FILE")" '{"digest": $version} | tostring'
filter='{
"version": {"digest": $version}
} | tostring'
jq -r --null-input --arg version "$(sed 's/^[^@]*@//' < "$IMAGE_REFS_FILE")" "$filter"