Skip to content

Instantly share code, notes, and snippets.

@rcastill
Last active December 27, 2024 00:19
Show Gist options
  • Select an option

  • Save rcastill/96308fe9f78a298d99c593cb6770f00b to your computer and use it in GitHub Desktop.

Select an option

Save rcastill/96308fe9f78a298d99c593cb6770f00b to your computer and use it in GitHub Desktop.
Get a list of all repositories repo:tag in an azure container registry ACR using azure-cli az azcli and save them to tags_ACR.txt
# Example usage:
# $ ACR=someregistry bash acrlookup.sh
# repo1:latest
# repo1:0.1.0
# repo2:latest
# $ cat tags_someregistry.txt
# repo1:latest
# repo1:0.1.0
# repo2:latest
set -x
# example: someregistry
ACR="${ACR:-}"
# execute up to CONCURRENT_PROCS concurrently
CONCURRENT_PROCS="${PROCS:-16}"
# list all repositories in $ACR
# execute $CONCURRENT_PROCS concurrent show-tags processes over retrieved repositories
az acr repository list -n "$ACR" -o tsv \
| xargs --max-procs "$CONCURRENT_PROCS" -IREPO bash -c 'az acr repository show-tags -n '$ACR' -o tsv --repository REPO | while read tag; do echo REPO:$tag; done' \
| tee "tags_$ACR.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment