mirror of
https://github.com/home-assistant/operating-system.git
synced 2026-04-02 00:27:14 +01:00
Fix skopeo for ARM images in hassio after builder changes (#4594)
Afer builder changes, ARM images are now correctly published with their platform, and when skopeo is used to inspect/pull the image on x86 without any other flags, it fails with: Error parsing manifest for image: Error choosing image instance: no image found in image index for architecture amd64, variant "", OS linux Pass the correct arch in skopeo operations to fix that.
This commit is contained in:
@@ -42,7 +42,13 @@ image_tag=$(jq -e -r --arg image_json_name "${image_json_name}" \
|
|||||||
'.[$image_json_name]' < "${version_json}")
|
'.[$image_json_name]' < "${version_json}")
|
||||||
full_image_name="${image_name}:${image_tag}"
|
full_image_name="${image_name}:${image_tag}"
|
||||||
|
|
||||||
image_digest=$(retry 3 "skopeo inspect 'docker://${full_image_name}' | jq -r '.Digest'")
|
# Map HAOS arch to OCI platform arch for skopeo
|
||||||
|
case "${arch}" in
|
||||||
|
aarch64) oci_arch="arm64" ;;
|
||||||
|
*) oci_arch="${arch}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
image_digest=$(retry 3 "skopeo inspect --override-arch '${oci_arch}' 'docker://${full_image_name}' | jq -r '.Digest'")
|
||||||
|
|
||||||
# Cleanup image name file name use
|
# Cleanup image name file name use
|
||||||
image_file_name="${full_image_name//[:\/]/_}@${image_digest//[:\/]/_}"
|
image_file_name="${full_image_name//[:\/]/_}@${image_digest//[:\/]/_}"
|
||||||
@@ -55,7 +61,7 @@ dst_image_file_path="${dst_dir}/${image_file_name}.tar"
|
|||||||
if [ ! -f "${image_file_path}" ]
|
if [ ! -f "${image_file_path}" ]
|
||||||
then
|
then
|
||||||
echo "Fetching image: ${full_image_name} (digest ${image_digest})"
|
echo "Fetching image: ${full_image_name} (digest ${image_digest})"
|
||||||
retry 3 "skopeo copy 'docker://${image_name}@${image_digest}' 'oci-archive:${image_file_path}:${full_image_name}'"
|
retry 3 "skopeo copy --override-arch '${oci_arch}' 'docker://${image_name}@${image_digest}' 'oci-archive:${image_file_path}:${full_image_name}'"
|
||||||
else
|
else
|
||||||
echo "Skipping download of existing image: ${full_image_name} (digest ${image_digest})"
|
echo "Skipping download of existing image: ${full_image_name} (digest ${image_digest})"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user