Skip to content

Commit

Permalink
Clean-up stale packages one by one
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielius1922 committed Sep 4, 2024
1 parent f5966ea commit 8b587d6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/actions/cleanup-stale/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Delete stale images
description: Delete stale images

inputs:
package_name:
description: Package name to delete
required: true
delay:
description: Delay before running the action (in seconds)
required: false
Expand All @@ -23,7 +26,7 @@ runs:
- name: Delete older than a month vnext and vnext-pr images
uses: snok/container-retention-policy@v2
with:
image-names: hub/*
image-names: ${{ inputs.package_name }}
cut-off: One month ago UTC
account-type: org
org-name: plgd-dev
Expand Down Expand Up @@ -52,3 +55,4 @@ runs:
owner_type: org
untagged_only: true
except_untagged_multiplatform: true
package_name: ${{ inputs.package_name }}
27 changes: 27 additions & 0 deletions .github/workflows/ghcr-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,30 @@ jobs:
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
name: Delete stale or untagged images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- package_name: http-gateway
- package_name: bundle
- package_name: resource-aggregate
- package_name: resource-directory
- package_name: coap-gateway
- package_name: cloud2cloud-connector
- package_name: cloud2cloud-gateway
- package_name: certificate-authority
- package_name: grpc-gateway
- package_name: identity-store
- package_name: mock-oauth-server
- package_name: test-cloud-server
- package_name: cert-tool
- package_name: grpc-reflection
- package_name: snippet-service
- package_name: mongodb-standby-tool
- package_name: mongodb-admin-tool
- package_name: m2m-oauth-server
- package_name: device-provisioning-service
- package_name: test-device-provisioning-service
steps:
- name: Checkout local actions
uses: actions/checkout@v4
Expand All @@ -60,11 +84,13 @@ jobs:
continue-on-error: true
uses: ./.github/actions/cleanup-stale
with:
package_name: hub/${{ matrix.package_name }}
token: ${{ secrets.GHCR_CLEANUP_PAT }}
- name: Delete stale or untagged images (2)
id: run-2
if: ${{ steps.run-1.outcome == 'failure' }}
with:
package_name: hub/${{ matrix.package_name }}
token: ${{ secrets.GHCR_CLEANUP_PAT }}
delay: 60
continue-on-error: true
Expand All @@ -73,5 +99,6 @@ jobs:
if: ${{ steps.run-2.outcome == 'failure' }}
uses: ./.github/actions/cleanup-stale
with:
package_name: hub/${{ matrix.package_name }}
token: ${{ secrets.GHCR_CLEANUP_PAT }}
delay: 60

0 comments on commit 8b587d6

Please sign in to comment.