fix: clean up untagged helm OCI manifests after chart push
All checks were successful
Build & Release / build (push) Successful in 30s
All checks were successful
Build & Release / build (push) Successful in 30s
This commit is contained in:
@@ -60,6 +60,23 @@ jobs:
|
|||||||
helm registry login registry.digitalocean.com -u token --password "${{ secrets.DOCR_TOKEN }}"
|
helm registry login registry.digitalocean.com -u token --password "${{ secrets.DOCR_TOKEN }}"
|
||||||
helm package chart/
|
helm package chart/
|
||||||
helm push lunarfront-$VERSION.tgz oci://registry.digitalocean.com/lunarfront
|
helm push lunarfront-$VERSION.tgz oci://registry.digitalocean.com/lunarfront
|
||||||
|
# Remove untagged manifests left by helm push (OCI index artifacts)
|
||||||
|
curl -s "https://api.digitalocean.com/v2/registry/lunarfront/repositories/lunarfront/tags?per_page=100" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.DOCR_TOKEN }}" | \
|
||||||
|
python3 -c "
|
||||||
|
import sys, json, urllib.request
|
||||||
|
data = json.load(sys.stdin)
|
||||||
|
token = '${{ secrets.DOCR_TOKEN }}'
|
||||||
|
for tag in data.get('tags', []):
|
||||||
|
if not tag['tag']:
|
||||||
|
digest = tag['manifest_digest']
|
||||||
|
req = urllib.request.Request(
|
||||||
|
f'https://api.digitalocean.com/v2/registry/lunarfront/repositories/lunarfront/digests/{digest}',
|
||||||
|
method='DELETE', headers={'Authorization': f'Bearer {token}'}
|
||||||
|
)
|
||||||
|
try: urllib.request.urlopen(req)
|
||||||
|
except: pass
|
||||||
|
"
|
||||||
|
|
||||||
- name: Logout
|
- name: Logout
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
Reference in New Issue
Block a user