Skip to content

Commit

Permalink
feat: add container cleanup cronjob
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Baker <[email protected]>
  • Loading branch information
rbtr authored Jun 5, 2024
1 parent 149b880 commit b9b5a22
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/container-cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Container Registry Cleanup

on:
schedule:
- cron: "0 0 * * *" # every day at midnight
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
container-cleanup:
name: delete-images
runs-on: ubuntu-latest
strategy:
matrix:
image:
- "retina/charts/retina"
- "retina/kubectl-retina"
- "retina/retina-agent"
- "retina/retina-init"
- "retina/retina-operator"
steps:
# This is a fork of the official actions/delete-package-versions which adds GHCR image tag support
# https://github.com/actions/delete-package-versions/pull/104
- uses: port-of-rotterdam-dtis/delete-package-versions@bf25fb8df311fdcbeac67ba2e5153495d76415a8
with:
package-name: ${{ matrix.image }}
package-type: "container"
min-versions-to-keep: 0
ignore-versions: "^v(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(\\.*)$"
ignore-versions-include-tags: true
6 changes: 2 additions & 4 deletions .github/workflows/release-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Release Retina Charts

on:
push:
branches: [main]
tags: ["v*"]

permissions:
Expand All @@ -25,15 +24,15 @@ jobs:

- uses: azure/[email protected]
id: install

- name: Install Cosign
uses: sigstore/[email protected]

- name: Log in to registry (Helm for pushing chart, Docker for signing and push signature)
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u $ --password-stdin
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Build, Push and Sign chart
id: build_chart
shell: bash
Expand All @@ -45,4 +44,3 @@ jobs:
helm push retina-$TAG.tgz oci://ghcr.io/${{ github.repository }}/charts >> helm_push_result.txt 2>&1
cat helm_push_result.txt
cosign sign --yes ghcr.io/${{ github.repository }}/charts/retina@$(tail -n 1 helm_push_result.txt | awk '{ print $2 }')

0 comments on commit b9b5a22

Please sign in to comment.