John B at UW

Technical content relevant to the University of Washington.

We use podman images for development, stored in the GitHub container registry. Our process adds new images to the registry, but we need a way to “clean up” the registry. Here’s the github action, stored in .github/workflows/main.yml in the default repository branch:

name: Delete old container images

on:
  schedule:
    - cron: "0 0 * * SUN" # Sundays
  workflow_dispatch:

jobs:
  clean-ghcr:
    name: Delete old unused container images
    runs-on: ubuntu-latest
    steps:
      - name: Delete untagged containers older than 1 month
        uses: snok/container-retention-policy@v2
        with:
          image-names: FIXME*
          cut-off: A month ago UTC
          account-type: org
          org-name: FIXME
          keep-at-least: 1
          skip-tags: develop, main, production, v*
          token: $

This job relies on container-retention-policy. There are a few notable parts: