Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHCR: actions/delete-package-versions@v4 #6757

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 38 additions & 16 deletions .github/workflows/ghcrCleanup.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
name: Delete old container images


on:
schedule:
- cron: "0 0 * * *"

permissions:
packages: write

jobs:
clean_ghcr:
name: Delete old unused container images
name: Delete untagged container images
runs-on: ubuntu-latest
steps:
- name: Delete all containers older than a month
uses: snok/container-retention-policy@v2
with:
image-names: backend, cypress, database, frontend, frontend-lighthouse, nginx
cut-off: One month ago UTC
account-type: org
org-name: CDCgov
keep-at-least: 1
skip-tags: main
token: ${{ secrets.GITHUB_TOKEN }}
dry-run: true
# backend, cypress, database, frontend, frontend-lighthouse, nginx
- uses: actions/delete-package-versions@v4
with:
package-name: 'backend'
package-type: 'container'
min-versions-to-keep: 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(for my own knowledge 😅) if we are only deleting untagged versions is there a reason we need to keep a minimum of 10 versions of them? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a good reason except that I want to see the arguments at work. 😃

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that sounds good to me! I would also like to see that too! 😹

delete-only-untagged-versions: 'true'
- uses: actions/delete-package-versions@v4
with:
package-name: 'cypress'
package-type: 'container'
min-versions-to-keep: 10
delete-only-untagged-versions: 'true'
- uses: actions/delete-package-versions@v4
with:
package-name: 'database'
package-type: 'container'
min-versions-to-keep: 10
delete-only-untagged-versions: 'true'
- uses: actions/delete-package-versions@v4
with:
package-name: 'frontend'
package-type: 'container'
min-versions-to-keep: 10
delete-only-untagged-versions: 'true'
- uses: actions/delete-package-versions@v4
with:
package-name: 'frontend-lighthouse'
package-type: 'container'
min-versions-to-keep: 10
delete-only-untagged-versions: 'true'
- uses: actions/delete-package-versions@v4
with:
package-name: 'nginx'
package-type: 'container'
min-versions-to-keep: 10
delete-only-untagged-versions: 'true'