Skip to content

Commit

Permalink
Add cleanup container registry jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
msom authored Jun 20, 2024
1 parent e69e603 commit 7a8d3f4
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build-and-push-image:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest

permissions:
contents: read
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
push-to-registry: true

test-image:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
needs: build-and-push-image
if: startsWith(github.ref, 'refs/tags/')
strategy:
Expand Down Expand Up @@ -80,3 +80,35 @@ jobs:
run: |
docker pull ghcr.io/onegov/onegov-cloud:${{ steps.meta.outputs.version }}
docker run ghcr.io/onegov/onegov-cloud:${{ steps.meta.outputs.version }} test-container "${{matrix.group}}" 6
cleanup-images:
runs-on: ubuntu-latest
needs: build-and-push-image

steps:

- name: Delete unttaged images
uses: seantis/delete-package-versions@main
with:
package-name: 'onegov-cloud'
package-type: 'container'
min-versions-to-keep: 0
delete-only-untagged-versions: 'true'

- name: Delete images tagged with commit hash
uses: seantis/delete-package-versions@main
with:
package-name: 'onegov-cloud'
package-type: 'container'
min-versions-to-keep: 0
ignore-versions: '^(?!sha).*$'
ignore-versions-include-tags: true

- name: Delete old images
uses: seantis/delete-package-versions@main
with:
package-name: 'onegov-cloud'
package-type: 'container'
min-versions-to-keep: 20
ignore-versions: '^release-.*$'
ignore-versions-include-tags: true

0 comments on commit 7a8d3f4

Please sign in to comment.