Created
October 29, 2021 19:27
-
-
Save snivas/fb33a881a04e4dd4ca07ea58d23971ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Main script to prune docker repos in JFrog Repository | |
export PATH=$PATH:/C/jfrog | |
FILTER_REPO="*" # Include all repos | |
#FILTER_REPO="REPO1" # Enable to run this script on particular repo in Jfrog | |
EXCLUDE_BASE_PATH=("Repo2" "Repo3") # Add list of Repos to omit during process | |
PATH_ARR=$(jfrog.exe rt s "<ROOT_LOCATION>/$FILTER_REPO/*/manifest.json" --recursive=false | jq '.[].path' | xargs dirname | xargs dirname | sort | uniq) | |
for p in $PATH_ARR | |
do | |
RNAME=$(echo $p | cut -d'/' -f2-) | |
if [[ " ${EXCLUDE_BASE_PATH[*]} " == *" $RNAME "* ]]; then | |
echo "Skip this repo: $p" | |
continue | |
fi | |
#echo "DELETING $p" | |
bash prune-docker-images.sh $p # call prune-docker-images.sh with repo name | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment