From ba1aeb21ebada51d92f6ea0111d1d5d98b47a0a1 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:08:46 +0100 Subject: [PATCH 01/16] feat: added workflow to prune old images (#1) --- .github/workflows/prune.yml | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/prune.yml diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml new file mode 100644 index 00000000..cc5d4246 --- /dev/null +++ b/.github/workflows/prune.yml @@ -0,0 +1,45 @@ +name: Prune GHCR + +on: + push: + pull_request: + +permissions: + contents: write + packages: write + security-events: write + +jobs: + prune_images: + + steps: + + - name: Prune Images + uses: vlaurin/action-ghcr-prune@v0.5.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + organization: caas-team + container: sparrow # Package name + dry-run: true # Dry-run first, then change to `false` + keep-younger-than: 7 # days + keep-last: 2 + prune-untagged: true + keep-tags: | + latest + keep-tags-regexes: | + ^v + prune-tags-regexes: | + ^commit- + + - name: Prune Charts + uses: vlaurin/action-ghcr-prune@v0.5.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + organization: caas-team + container: charts/sparrow # Package name + dry-run: true # Dry-run first, then change to `false` + keep-younger-than: 7 # days + keep-last: 2 + prune-untagged: true + prune-tags-regexes: | + 'commit-*$' \ No newline at end of file From f61d40154f92c7baff69868e4225e68c4e466854 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:21:14 +0100 Subject: [PATCH 02/16] fix: added runs-on variable (#2) --- .github/workflows/prune.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index cc5d4246..409191fc 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -11,7 +11,14 @@ permissions: jobs: prune_images: - + name: Prune old sparrow images + runs-on: ubuntu-latest + + permissions: + contents: write + packages: write + security-events: write + steps: - name: Prune Images From f9f36a39151df680f888568b812c8ef19bb4ed08 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:45:38 +0100 Subject: [PATCH 03/16] feat: trying new regex (#3) --- .github/workflows/prune.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 409191fc..38162063 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -49,4 +49,4 @@ jobs: keep-last: 2 prune-untagged: true prune-tags-regexes: | - 'commit-*$' \ No newline at end of file + '(?<=:\s*).*\bcommit\b.*' \ No newline at end of file From e53ac65ca310eb6fbd63cb2fc4c4bc492b647646 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:53:36 +0100 Subject: [PATCH 04/16] fix: trying commit as expression (#4) --- .github/workflows/prune.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 38162063..2590a6ba 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -49,4 +49,4 @@ jobs: keep-last: 2 prune-untagged: true prune-tags-regexes: | - '(?<=:\s*).*\bcommit\b.*' \ No newline at end of file + commit \ No newline at end of file From 7bc7c7815e911bf86cd79e8aa5238701e5e95bc1 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:00:12 +0100 Subject: [PATCH 05/16] fix: trying keep tags (#5) --- .github/workflows/prune.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 2590a6ba..3a5f8578 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -48,5 +48,8 @@ jobs: keep-younger-than: 7 # days keep-last: 2 prune-untagged: true - prune-tags-regexes: | - commit \ No newline at end of file + keep-tags: | + 0.0.1 + 0.0.2 + 0.0.3 + 0.0.4 \ No newline at end of file From d09491a88f6a21fc923764c87c14471fdb3bb8a4 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:10:50 +0100 Subject: [PATCH 06/16] beingtoospecific (#6) --- .github/workflows/prune.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 3a5f8578..dea1f5e3 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -48,8 +48,6 @@ jobs: keep-younger-than: 7 # days keep-last: 2 prune-untagged: true - keep-tags: | - 0.0.1 - 0.0.2 - 0.0.3 - 0.0.4 \ No newline at end of file + prune-tags-regexes: | + ^0.2.2-commit + ^0.3.0-commit \ No newline at end of file From 894e3b0129a98501d1269e86d38b43c0f155cd45 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:19:07 +0100 Subject: [PATCH 07/16] fix: regex expression fixed (#7) --- .github/workflows/prune.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index dea1f5e3..dcc117c8 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -49,5 +49,4 @@ jobs: keep-last: 2 prune-untagged: true prune-tags-regexes: | - ^0.2.2-commit - ^0.3.0-commit \ No newline at end of file + .-commit-. \ No newline at end of file From a7a99381b0f76d65eb7421db48456f37602e9f79 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:26:44 +0100 Subject: [PATCH 08/16] fix: new regex (#8) --- .github/workflows/prune.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index dcc117c8..12277d20 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -49,4 +49,4 @@ jobs: keep-last: 2 prune-untagged: true prune-tags-regexes: | - .-commit-. \ No newline at end of file + ^.-commit \ No newline at end of file From f3c59f51d013d65361af43eaed7fdd84c8b23c2e Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:32:40 +0100 Subject: [PATCH 09/16] Test (#9) * fix: new regex * test --- .github/workflows/prune.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 12277d20..2d4d0e26 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -45,7 +45,7 @@ jobs: organization: caas-team container: charts/sparrow # Package name dry-run: true # Dry-run first, then change to `false` - keep-younger-than: 7 # days + #keep-younger-than: 7 # days keep-last: 2 prune-untagged: true prune-tags-regexes: | From 914c577ff2f73c27b79cb49c0dd069d27a498942 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:43:30 +0100 Subject: [PATCH 10/16] fix: fixed regex hopefully (#10) --- .github/workflows/prune.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 2d4d0e26..9cad95fc 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -49,4 +49,4 @@ jobs: keep-last: 2 prune-untagged: true prune-tags-regexes: | - ^.-commit \ No newline at end of file + commit-.*$ \ No newline at end of file From 6f98993efba7c18e1f357be54dc8042fece968c3 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:06:14 +0100 Subject: [PATCH 11/16] fix: pruning snapshots (#11) --- .github/workflows/prune.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 9cad95fc..1e7ef6c0 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -31,12 +31,10 @@ jobs: keep-younger-than: 7 # days keep-last: 2 prune-untagged: true - keep-tags: | - latest - keep-tags-regexes: | - ^v prune-tags-regexes: | ^commit- + SNAPSHOT-.*$ + actions$ - name: Prune Charts uses: vlaurin/action-ghcr-prune@v0.5.0 From 89abdc01db8807dd77e173b0e5df7b7892073bf1 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Thu, 25 Jan 2024 07:56:44 +0100 Subject: [PATCH 12/16] feat: added new workflow to prune old images for packages sparrow and charts/sparrow --- .github/workflows/prune.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 1e7ef6c0..70c7ee16 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -1,8 +1,8 @@ name: Prune GHCR on: - push: - pull_request: + schedule: + - cron: '0 0 * * *' # Runs workflow at '(minute) (hour) (day of the month) (month) (day of the week)' permissions: contents: write @@ -27,14 +27,13 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} organization: caas-team container: sparrow # Package name - dry-run: true # Dry-run first, then change to `false` + dry-run: true # Dry-run first, then change to `false` or remove keep-younger-than: 7 # days keep-last: 2 prune-untagged: true prune-tags-regexes: | ^commit- SNAPSHOT-.*$ - actions$ - name: Prune Charts uses: vlaurin/action-ghcr-prune@v0.5.0 @@ -42,8 +41,8 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} organization: caas-team container: charts/sparrow # Package name - dry-run: true # Dry-run first, then change to `false` - #keep-younger-than: 7 # days + dry-run: true # Dry-run first, then change to `false` or remove + keep-younger-than: 7 # days keep-last: 2 prune-untagged: true prune-tags-regexes: | From 2938ddbadc892a11ea9658bf8f9fef3c4e627026 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Fri, 26 Jan 2024 09:25:45 +0100 Subject: [PATCH 13/16] fix: removed keep-last conditions --- .github/workflows/prune.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 70c7ee16..827e894f 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -29,7 +29,6 @@ jobs: container: sparrow # Package name dry-run: true # Dry-run first, then change to `false` or remove keep-younger-than: 7 # days - keep-last: 2 prune-untagged: true prune-tags-regexes: | ^commit- @@ -43,7 +42,6 @@ jobs: container: charts/sparrow # Package name dry-run: true # Dry-run first, then change to `false` or remove keep-younger-than: 7 # days - keep-last: 2 prune-untagged: true prune-tags-regexes: | commit-.*$ \ No newline at end of file From b049f23df0e8b01bbd17e4cc9a77737cbe0a5760 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Fri, 26 Jan 2024 09:58:50 +0100 Subject: [PATCH 14/16] fix: removed comments --- .github/workflows/prune.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 827e894f..5b033de8 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -2,7 +2,7 @@ name: Prune GHCR on: schedule: - - cron: '0 0 * * *' # Runs workflow at '(minute) (hour) (day of the month) (month) (day of the week)' + - cron: '0 0 * * *' permissions: contents: write @@ -26,8 +26,8 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} organization: caas-team - container: sparrow # Package name - dry-run: true # Dry-run first, then change to `false` or remove + container: sparrow + dry-run: true keep-younger-than: 7 # days prune-untagged: true prune-tags-regexes: | @@ -39,8 +39,8 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} organization: caas-team - container: charts/sparrow # Package name - dry-run: true # Dry-run first, then change to `false` or remove + container: charts/sparrow + dry-run: true keep-younger-than: 7 # days prune-untagged: true prune-tags-regexes: | From 78c4dd07060d4cae245832d52dc4b5c84c6e7646 Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:55:53 +0100 Subject: [PATCH 15/16] fix: removed unnecessary permission declaration --- .github/workflows/prune.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index 5b033de8..cf89f393 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -14,11 +14,6 @@ jobs: name: Prune old sparrow images runs-on: ubuntu-latest - permissions: - contents: write - packages: write - security-events: write - steps: - name: Prune Images From 2c6bc8a54233879421e198c363a016ebfd957edc Mon Sep 17 00:00:00 2001 From: JTaeuber <157487559+JTaeuber@users.noreply.github.com> Date: Mon, 29 Jan 2024 12:02:21 +0100 Subject: [PATCH 16/16] fix: removed dry-run --- .github/workflows/prune.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/prune.yml b/.github/workflows/prune.yml index cf89f393..1ce393ab 100644 --- a/.github/workflows/prune.yml +++ b/.github/workflows/prune.yml @@ -22,7 +22,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} organization: caas-team container: sparrow - dry-run: true keep-younger-than: 7 # days prune-untagged: true prune-tags-regexes: | @@ -35,7 +34,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} organization: caas-team container: charts/sparrow - dry-run: true keep-younger-than: 7 # days prune-untagged: true prune-tags-regexes: |