looping through tags to be removed
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -47,7 +47,7 @@ jobs:
|
||||
steps:
|
||||
- name: Get tag list
|
||||
run: |
|
||||
TAGS="$(curl -s -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" https://${{ secrets.REGISTRY_PATH }}/v2/umbrella/tags/list | jq -r ".tags[]")"
|
||||
TAGS="$(curl -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" -s ${{ secrets.REGISTRY_PATH }}/v2/umbrella/tags/list | jq -r ".tags[]")"
|
||||
COUNT=$(echo "$TAGS" | wc -l)
|
||||
REMAIN=$((COUNT - 10))
|
||||
echo "$TAGS" | head -n $REMAIN > /tmp/old_tags
|
||||
@@ -56,4 +56,7 @@ jobs:
|
||||
run: |
|
||||
cat /tmp/old_tags | while read TAG; do
|
||||
echo about to delete $TAG
|
||||
DIGEST=$(curl -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" -sS -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -o /dev/null -w '%header{Docker-Content-Digest}' ${{ secrets.REGISTRY_PATH }}/v2/umbrella/manifests/$TAG)
|
||||
echo digest: $DIGEST
|
||||
curl -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" -sS -X DELETE ${{ secrets.REGISTRY_PATH }}/v2/umbrella/manifests/$DIGEST
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user