Skip to content

Commit b0f917a

Browse files
authored
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>
1 parent 411a3d0 commit b0f917a

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

test/blackbox/ci.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
77
BATS=${SCRIPTPATH}/../../hack/tools/bin/bats
88
PATH=$PATH:${SCRIPTPATH}/../../hack/tools/bin
99

10+
# Pre-download Docker images before running tests
11+
echo "Setting up Docker images..."
12+
${SCRIPTPATH}/setup_images.sh
13+
1014
tests=("pushpull" "pushpull_authn" "delete_images" "referrers" "metadata" "anonymous_policy"
1115
"annotations" "detect_manifest_collision" "cve" "sync" "sync_docker" "sync_replica_cluster"
1216
"scrub" "garbage_collect" "metrics" "metrics_minimal" "multiarch_index" "docker_compat" "redis_local" "redis_session_store"

test/blackbox/setup_images.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# Pre-download Docker images used in blackbox tests
4+
# This script ensures all required images are available before tests start
5+
6+
set -e
7+
8+
echo "Pre-downloading Docker images for blackbox tests..."
9+
10+
# List of images used in the tests
11+
IMAGES=(
12+
"nats:2.11.1"
13+
"natsio/nats-box:latest"
14+
"python:3"
15+
"redis:latest"
16+
)
17+
18+
# Function to download an image if not already present
19+
download_image() {
20+
local image="$1"
21+
echo "Checking for image: $image"
22+
23+
if docker image inspect "$image" >/dev/null 2>&1; then
24+
echo "✓ Image $image already exists"
25+
else
26+
echo "Downloading image: $image"
27+
if docker pull "$image"; then
28+
echo "✓ Successfully downloaded $image"
29+
else
30+
echo "✗ Failed to download $image"
31+
return 1
32+
fi
33+
fi
34+
}
35+
36+
# Download all images
37+
for image in "${IMAGES[@]}"; do
38+
download_image "$image"
39+
done
40+
41+
echo "All Docker images are ready for testing!"

0 commit comments

Comments
 (0)