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

feat: added new workflow to prune old images #88

Merged
merged 16 commits into from
Jan 29, 2024
Merged
47 changes: 47 additions & 0 deletions .github/workflows/prune.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Prune GHCR

on:
schedule:
- cron: '0 0 * * *'

permissions:
contents: write
packages: write
security-events: write

jobs:
prune_images:
name: Prune old sparrow images
runs-on: ubuntu-latest

permissions:
contents: write
packages: write
security-events: write
JTaeuber marked this conversation as resolved.
Show resolved Hide resolved

steps:

- name: Prune Images
uses: vlaurin/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
organization: caas-team
container: sparrow
dry-run: true
keep-younger-than: 7 # days
prune-untagged: true
prune-tags-regexes: |
^commit-
SNAPSHOT-.*$
Copy link
Member

Choose a reason for hiding this comment

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

After the first prune we can remove this regex because our new images don't follow this naming pattern anymore.

Copy link
Member

Choose a reason for hiding this comment

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

The regex is unnecessary. We just want to remove old images, no matter what naming convention they used. Let's just remove it altogether.

Copy link
Member

@lvlcn-t lvlcn-t Jan 26, 2024

Choose a reason for hiding this comment

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

Then we'd also remove our stable release images because git tags != image tags

Copy link
Member

Choose a reason for hiding this comment

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

Totally right, my bad 😅


- name: Prune Charts
uses: vlaurin/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
organization: caas-team
container: charts/sparrow
dry-run: true
keep-younger-than: 7 # days
prune-untagged: true
prune-tags-regexes: |
commit-.*$
Loading