fix: keep only 2 SHA tags (current + 1 previous) to save disk space

This commit is contained in:
Ashwin Kumar Sivakumar 2026-06-12 04:12:15 +05:30
parent 758f0699ff
commit 8adc84699e

View file

@ -267,7 +267,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Cleanup old image tags (after all builds complete)
- name: Cleanup old image tags (keep running + 1 previous)
continue-on-error: true
env:
REGISTRY_HOST: ${{ secrets.REGISTRY_HOSTPORT }}
@ -277,6 +277,7 @@ jobs:
run: |
set -euo pipefail
echo "Starting post-build cleanup for services: $SERVICES_CSV"
echo "Policy: Keep only 2 SHA tags (running + 1 previous)"
IFS=',' read -ra SERVICES <<< "$SERVICES_CSV"
for service in "${SERVICES[@]}"; do
@ -286,7 +287,7 @@ jobs:
--repo "nxtgauge-rust-$service" \
--username "$REGISTRY_USERNAME" \
--password "$REGISTRY_PASSWORD" \
--keep 3 || echo "Warning: Failed to prune $service (continuing)"
--keep 2 || echo "Warning: Failed to prune $service (continuing)"
done
echo "Post-build cleanup completed"
echo "Post-build cleanup completed - only 2 most recent SHA tags kept"