mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
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:
@@ -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"
|
||||
|
||||
Executable
+41
@@ -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!"
|
||||
Reference in New Issue
Block a user