Created
December 11, 2023 10:08
-
-
Save fl64/b2be03ef3e01a9ce1e442331d59ffa38 to your computer and use it in GitHub Desktop.
broken images check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| rst='\033[0m' # Text Reset | |
| red='\033[0;31m' # Red | |
| module_image_path="dev-registry.deckhouse.io/sys/deckhouse-oss/modules/virtualization" | |
| virtualization_image_digest=$(kubectl get mpo virtualization -o json | jq .status.imageDigest -r) | |
| module_images=$(crane export ${module_image_path}@${virtualization_image_digest} | tar -Oxf - images_digests.json | jq '. | to_entries | .[]' -c) | |
| #echo $images | |
| while read -r module_image; do | |
| image=$(echo $module_image | jq .key -r) | |
| sha=$(echo $module_image | jq .value -r) | |
| printf "${red}Image: ${image} ${sha}${rst}\n" | |
| image_manifest=$(crane manifest "${module_image_path}@${sha}") | |
| image_config_digest=$(echo $image_manifest | jq .config.digest -r) | |
| #echo "image config" | |
| crane blob "${module_image_path}@${image_config_digest}" > /dev/null | |
| image_layer_digests=$(echo $image_manifest | jq .layers[].digest -r) | |
| #echo "image layers" | |
| while read -r image_layer_digest; do | |
| crane blob "${module_image_path}@${image_layer_digest}" > /dev/null | |
| done <<< ${image_layer_digests} | |
| done <<< ${module_images} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment