Only use one jq process for version output.
This commit is contained in:
parent
7a75a88da2
commit
ab5e2f6420
4 changed files with 6 additions and 6 deletions
|
@ -4,4 +4,4 @@ set -eu
|
||||||
|
|
||||||
[ -e /opt/resource/common ] && cd /opt/resource
|
[ -e /opt/resource/common ] && cd /opt/resource
|
||||||
. ./common
|
. ./common
|
||||||
jq --null-input --arg version "$(crane digest "$REPOSITORY:$TAG")" '[{"digest": $version}]' | jq -r tostring
|
jq -r --null-input --arg version "$(crane digest "$REPOSITORY:$TAG")" '[{"digest": $version}] | tostring'
|
||||||
|
|
|
@ -32,7 +32,7 @@ split_repo_domain() {
|
||||||
|
|
||||||
if [ -z "$domain_part" ]; then
|
if [ -z "$domain_part" ]; then
|
||||||
domain_part="$DEFAULT_DOMAIN"
|
domain_part="$DEFAULT_DOMAIN"
|
||||||
other_part="$other_part"
|
# other_part="$other_part"
|
||||||
elif echo "$domain_part" | grep -Evq '\.|:' && [ "$domain_part" != 'localhost' ]; then
|
elif echo "$domain_part" | grep -Evq '\.|:' && [ "$domain_part" != 'localhost' ]; then
|
||||||
# ^ docker sourcecode checks if $domain_part == $domain_part.lower() in effect checking if all is lower case
|
# ^ docker sourcecode checks if $domain_part == $domain_part.lower() in effect checking if all is lower case
|
||||||
domain_part="$DEFAULT_DOMAIN"
|
domain_part="$DEFAULT_DOMAIN"
|
||||||
|
|
4
src/in
4
src/in
|
@ -9,6 +9,6 @@ oci_dir="$(mktemp -d)"
|
||||||
crane pull --format=oci "$REPOSITORY:@$(jq -r .version "$INPUT_FILE")" "$oci_dir"
|
crane pull --format=oci "$REPOSITORY:@$(jq -r .version "$INPUT_FILE")" "$oci_dir"
|
||||||
cd "$oci_dir"
|
cd "$oci_dir"
|
||||||
tar cf "$1/image.tar" ./*
|
tar cf "$1/image.tar" ./*
|
||||||
cd - 1>&2
|
cd - 1>&2 2>/dev/null
|
||||||
|
|
||||||
jq .version < "$INPUT_FILE" | jq -r tostring
|
jq -r '.version | tostring' < "$INPUT_FILE"
|
||||||
|
|
4
src/out
4
src/out
|
@ -9,6 +9,6 @@ IMAGE_REFS_FILE="$(mktemp -t)"
|
||||||
oci_dir="$(mktemp -d)"
|
oci_dir="$(mktemp -d)"
|
||||||
cd "$oci_dir"
|
cd "$oci_dir"
|
||||||
tar xf "$1/$(jq -r .params.image < "$INPUT_FILE")"
|
tar xf "$1/$(jq -r .params.image < "$INPUT_FILE")"
|
||||||
cd - 1>&2
|
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 --null-input --arg version "$(sed 's/^[^@]*@//' < "$IMAGE_REFS_FILE")" '{"digest": $version}' | jq -r tostring
|
jq -r --null-input --arg version "$(sed 's/^[^@]*@//' < "$IMAGE_REFS_FILE")" '{"digest": $version} | tostring'
|
||||||
|
|
Reference in a new issue