-
Notifications
You must be signed in to change notification settings - Fork 102
Add script to check container images' agent versions #1404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
dee2e12
80adc32
cc5a362
41e6b21
081181d
18406e9
600f582
07b0760
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
| #set -x | ||
|
|
||
| REGISTRY_URL="docker-registry.nginx.com/nginx" | ||
| IMAGE_NAME=${1:-""} | ||
|
|
||
| search=${2:-""} | ||
|
|
||
| usage() { | ||
| echo "Usage: $0 <image-name> [search-pattern]" | ||
| echo "Example: $0 agentv3 alpine" | ||
| exit 1 | ||
| } | ||
|
|
||
| if [[ -z "${IMAGE_NAME}" ]]; then | ||
| usage | ||
| fi | ||
|
|
||
| echo "Checking images in ${REGISTRY_URL}/${IMAGE_NAME}" | ||
|
|
||
| # Fetch all tags from the remote registry | ||
| skopeo list-tags docker://${REGISTRY_URL}/${IMAGE_NAME} | jq -r '.Tags[]' > all_tags.txt | ||
| echo $(wc -l < all_tags.txt) "tags fetched." | ||
|
|
||
| # Filter out tags that end with three or more digits (nightly/build tags) | ||
| grep -Ev '\d{3,}$' all_tags.txt | sort -u > filtered_tags.txt | ||
| echo $(wc -l < filtered_tags.txt) "tags after filtering." | ||
|
|
||
| FOUND=($(grep -E "${search}" filtered_tags.txt | sort)) || { echo "No tags found matching '${search}'"; exit 1; } | ||
| echo "tags matching '${search}':" ${#FOUND[@]} | ||
|
|
||
| for tag in "${FOUND[@]}"; do | ||
| echo ":: ${REGISTRY_URL}/${IMAGE_NAME}:$tag" | ||
| podman pull ${REGISTRY_URL}/${IMAGE_NAME}:$tag > /dev/null 2>&1 | ||
|
||
| podman run ${REGISTRY_URL}/${IMAGE_NAME}:$tag nginx -v | ||
| podman run ${REGISTRY_URL}/${IMAGE_NAME}:$tag nginx-agent --version | ||
| podman rm -f $(podman ps -a -q) > /dev/null 2>&1 || true | ||
| done | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to use the skopeo docker image instead? https://github.com/containers/skopeo/blob/main/install.md#container-images
Would save people having to install skopeo on their machines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True yeah I'll add that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this implemented as a Github workflow in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont think we need a github workflow. The script by itself is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the skopeo image