From 6faa736d68b0dbe0042cf1fc7b967995ca883b3f Mon Sep 17 00:00:00 2001 From: Yalan Zhang Date: Sat, 31 Jan 2026 21:11:32 +0800 Subject: [PATCH] Simplify pre-pull script and make failures non-fatal Refactor scripts/pre-pull-images.sh to handle failures gracefully: - Skip empty image references (unset env vars) - Suppress verbose docker pull output for cleaner logs - Continue on pull failures instead of stopping - Remove kind load calls (K8s uses Docker cache directly) - Use APPROVED_IMAGE env var instead of hardcoded image This allows the script to continue even if some images fail to pull, since Kubernetes will pull them on-demand during pod creation. Signed-off-by: Yalan Zhang --- scripts/pre-pull-images.sh | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/scripts/pre-pull-images.sh b/scripts/pre-pull-images.sh index 2f24850..c50e22e 100755 --- a/scripts/pre-pull-images.sh +++ b/scripts/pre-pull-images.sh @@ -4,6 +4,8 @@ # # SPDX-License-Identifier: CC0-1.0 +set -o pipefail + KV_VERSION=v1.7.0 IMAGES=( "quay.io/kubevirt/virt-launcher:${KV_VERSION}" @@ -12,17 +14,31 @@ IMAGES=( "quay.io/kubevirt/virt-controller:${KV_VERSION}" "quay.io/kubevirt/virt-operator:${KV_VERSION}" "$TRUSTEE_IMAGE" - "quay.io/trusted-execution-clusters/fedora-coreos-kubevirt:2026-14-01" + "$APPROVED_IMAGE" ) +echo "==========================================" +echo "Pre-pulling images to Docker daemon" +echo "==========================================" +echo "Note: Failures are non-fatal - K8s will pull on-demand" +echo "" + for IMAGE in "${IMAGES[@]}"; do - echo "Pulling: $IMAGE" - docker pull "$IMAGE" - if [ $? -eq 0 ]; then - echo "Successfully pulled $IMAGE" - else - echo "Error: Failed to pull $IMAGE" - fi - kind load docker-image $IMAGE - echo "-------------------------------" + # Skip empty image names + if [ -z "$IMAGE" ]; then + echo "[WARN] Skipping empty image reference" + continue + fi + + echo "Pulling: $IMAGE" + + if docker pull "$IMAGE" >/dev/null 2>&1; then + echo "[SUCCESS] Pulled: $IMAGE" + else + echo "[WARN] Failed to pull: $IMAGE (will retry during pod creation)" + fi + + echo "-------------------------------" done + +exit 0