ci: pre download docker images used in bats tests (#3452)

Should help with issues such as https://github.com/project-zot/zot/actions/runs/18457240003/job/52580780359

Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
This commit is contained in:
Andrei Aaron
2025-10-13 10:41:30 +03:00
committed by GitHub
parent 411a3d00b5
commit b0f917a444
2 changed files with 45 additions and 0 deletions
+4
View File
@@ -7,6 +7,10 @@ SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
BATS=${SCRIPTPATH}/../../hack/tools/bin/bats
PATH=$PATH:${SCRIPTPATH}/../../hack/tools/bin
# Pre-download Docker images before running tests
echo "Setting up Docker images..."
${SCRIPTPATH}/setup_images.sh
tests=("pushpull" "pushpull_authn" "delete_images" "referrers" "metadata" "anonymous_policy"
"annotations" "detect_manifest_collision" "cve" "sync" "sync_docker" "sync_replica_cluster"
"scrub" "garbage_collect" "metrics" "metrics_minimal" "multiarch_index" "docker_compat" "redis_local" "redis_session_store"
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
# Pre-download Docker images used in blackbox tests
# This script ensures all required images are available before tests start
set -e
echo "Pre-downloading Docker images for blackbox tests..."
# List of images used in the tests
IMAGES=(
"nats:2.11.1"
"natsio/nats-box:latest"
"python:3"
"redis:latest"
)
# Function to download an image if not already present
download_image() {
local image="$1"
echo "Checking for image: $image"
if docker image inspect "$image" >/dev/null 2>&1; then
echo "✓ Image $image already exists"
else
echo "Downloading image: $image"
if docker pull "$image"; then
echo "✓ Successfully downloaded $image"
else
echo "✗ Failed to download $image"
return 1
fi
fi
}
# Download all images
for image in "${IMAGES[@]}"; do
download_image "$image"
done
echo "All Docker images are ready for testing!"