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

Update container image cleanup GitHub actions #5

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions .github/workflows/gitlab-container-image-cleanup-pr-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Delete closed PR container image tag

"on":
pull_request:
types:
- closed

jobs:
cleanup-pr-tag:
uses: ubuntu-latest
steps:
- name: Set image version for PR to branch name
run: echo "VERSION=${GITHUB_HEAD_REF//\//-}" >> ${GITHUB_ENV}

- name: Delete PR container image tag
uses: dataaxiom/ghcr-cleanup-action@v1
with:
tags: ${{ env.VERSION }}
package: ${{ github.event.repository.name }}/gitlab
token: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/gitlab-container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,15 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: 'ghcr.io/${{ env.IMAGE }}:${{ env.VERSION }}'

- name: Delete untagged container images
# We always delete all untagged container images after building an
# image. This way, there should never be stale untagged images laying
# around in the registry. In combination with the workflow that
# deletes PR tags after the PR is closed we should be able to keep the
# container image registry size in check.
uses: dataaxiom/ghcr-cleanup-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
package: ${{ github.event.repository.name }}/gitlab
validate: true
19 changes: 0 additions & 19 deletions .github/workflows/prune-old-container-images.yml

This file was deleted.