trying to prevent deletion of all tags if less than 10 are present
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -53,18 +53,20 @@ jobs:
|
||||
REMAIN=$((COUNT - 10))
|
||||
echo "$TAGS" | head -n $REMAIN > /tmp/old_tags
|
||||
else
|
||||
echo "less than 10 tags, skipping cleanup"
|
||||
echo less than 10 tags, skipping cleanup
|
||||
echo "" > /tmp/old_tags
|
||||
fi
|
||||
|
||||
- name: Remove tags
|
||||
run: |
|
||||
cat /tmp/old_tags | while read TAG; do
|
||||
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}' https://${{ secrets.REGISTRY_PATH }}/v2/umbrella/manifests/$TAG)
|
||||
if [ -n "$DIGEST" ]; then
|
||||
echo about to delete $TAG
|
||||
curl -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" -sS -X DELETE https://${{ secrets.REGISTRY_PATH }}/v2/umbrella/manifests/$DIGEST
|
||||
else
|
||||
echo failed to get digest for $TAG
|
||||
if [ -n "$TAG" ]; then
|
||||
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}' https://${{ secrets.REGISTRY_PATH }}/v2/umbrella/manifests/$TAG)
|
||||
if [ -n "$DIGEST" ]; then
|
||||
echo about to delete $TAG
|
||||
curl -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" -sS -X DELETE https://${{ secrets.REGISTRY_PATH }}/v2/umbrella/manifests/$DIGEST
|
||||
else
|
||||
echo failed to get digest for $TAG
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user