Skip to content

Commit dee2e12

Browse files
committed
add check-images.sh to check installed nginx and agent version from remote registry
1 parent 6bf4d3d commit dee2e12

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

scripts/check-images.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
#set -x
5+
6+
REGISTRY_URL="docker-registry.nginx.com/nginx"
7+
IMAGE_NAME=${1:-""}
8+
9+
search=${2:-""}
10+
11+
usage() {
12+
echo "Usage: $0 <image-name> [search-pattern]"
13+
echo "Example: $0 agentv3 alpine"
14+
exit 1
15+
}
16+
17+
if [[ -z "${IMAGE_NAME}" ]]; then
18+
usage
19+
fi
20+
21+
echo "Checking images in ${REGISTRY_URL}/${IMAGE_NAME}"
22+
23+
# Fetch all tags from the remote registry
24+
skopeo list-tags docker://${REGISTRY_URL}/${IMAGE_NAME} | jq -r '.Tags[]' > all_tags.txt
25+
echo $(wc -l < all_tags.txt) "tags fetched."
26+
27+
# Filter out tags that end with three or more digits (nightly/build tags)
28+
grep -Ev '\d{3,}$' all_tags.txt | sort -u > filtered_tags.txt
29+
echo $(wc -l < filtered_tags.txt) "tags after filtering."
30+
31+
FOUND=($(grep -E "${search}" filtered_tags.txt | sort)) || { echo "No tags found matching '${search}'"; exit 1; }
32+
echo "tags matching '${search}':" ${#FOUND[@]}
33+
34+
for tag in "${FOUND[@]}"; do
35+
echo ":: ${REGISTRY_URL}/${IMAGE_NAME}:$tag"
36+
podman pull ${REGISTRY_URL}/${IMAGE_NAME}:$tag > /dev/null 2>&1
37+
podman run ${REGISTRY_URL}/${IMAGE_NAME}:$tag nginx -v
38+
podman run ${REGISTRY_URL}/${IMAGE_NAME}:$tag nginx-agent --version
39+
podman rm -f $(podman ps -a -q) > /dev/null 2>&1 || true
40+
done
41+

0 commit comments

Comments
 (0)