From 25dc760162e1f6715fd97d23a3b24a32a31e424e Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 8 Sep 2022 16:13:41 +0200 Subject: Dockerfile: variant support in frozen-images stage using TARGETVARIANT in frozen-images stage implies changes in `download-frozen-image-v2.sh` script to add support for variants so we are able to build against more platforms. Signed-off-by: CrazyMax --- contrib/download-frozen-image-v2.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'contrib') diff --git a/contrib/download-frozen-image-v2.sh b/contrib/download-frozen-image-v2.sh index b5e05b181a..e50f5ebdcc 100755 --- a/contrib/download-frozen-image-v2.sh +++ b/contrib/download-frozen-image-v2.sh @@ -261,6 +261,10 @@ get_target_arch() { echo amd64 } +get_target_variant() { + echo "${TARGETVARIANT:-}" +} + while [ $# -gt 0 ]; do imageTag="$1" shift @@ -311,11 +315,13 @@ while [ $# -gt 0 ]; do found="" targetArch="$(get_target_arch)" + targetVariant="$(get_target_variant)" # parse first level multi-arch manifest for i in "${!layers[@]}"; do layerMeta="${layers[$i]}" maniArch="$(echo "$layerMeta" | jq --raw-output '.platform.architecture')" - if [ "$maniArch" = "${targetArch}" ]; then + maniVariant="$(echo "$layerMeta" | jq --raw-output '.platform.variant')" + if [[ "$maniArch" = "${targetArch}" ]] && [[ -z "${targetVariant}" || "$maniVariant" = "${targetVariant}" ]]; then digest="$(echo "$layerMeta" | jq --raw-output '.digest')" # get second level single manifest submanifestJson="$( @@ -332,7 +338,7 @@ while [ $# -gt 0 ]; do fi done if [ -z "$found" ]; then - echo >&2 "error: manifest for $maniArch is not found" + echo >&2 "error: manifest for ${targetArch}${targetVariant:+/${targetVariant}} is not found" exit 1 fi ;; -- cgit v1.2.1