From d05ac15a19da14909740cf4dd89e99ce82583fb3 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 24 Nov 2023 10:15:19 +0100 Subject: [PATCH 1/2] Remove container images that have not been pulled for over a year --- .github/workflows/prune-container-images.yml | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/prune-container-images.yml diff --git a/.github/workflows/prune-container-images.yml b/.github/workflows/prune-container-images.yml new file mode 100644 index 00000000000..de5954b9ba9 --- /dev/null +++ b/.github/workflows/prune-container-images.yml @@ -0,0 +1,22 @@ +name: 'Delete unused snapshot container images' + +on: + schedule: + - cron: '0 12 1 * *' + workflow_dispatch: + +jobs: + container-image: + if: github.repository_owner == 'opentripplanner' + runs-on: ubuntu-latest + steps: + - name: Delete unused container images + env: + CONTAINER_REPO: opentripplanner/opentripplanner + CONTAINER_REGISTRY_USER: otpbot + CONTAINER_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} + run: | + # remove all snapshot container images that have not been pulled for over a year + # --keep-semver makes sure that any image with a x.y.z version scheme is unaffected by this + pip install prune-container-repo==0.0.3 + prune-container-repo -u ${CONTAINER_REGISTRY_USER} -r ${CONTAINER_REPO} --days=365 --keep-semver --activate From 053f87572b2c733d9624bc96e19b331ede0a5ff5 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Sun, 26 Nov 2023 19:01:21 +0100 Subject: [PATCH 2/2] Correct cron expression --- .github/workflows/prune-container-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prune-container-images.yml b/.github/workflows/prune-container-images.yml index de5954b9ba9..518e8afb67b 100644 --- a/.github/workflows/prune-container-images.yml +++ b/.github/workflows/prune-container-images.yml @@ -2,7 +2,7 @@ name: 'Delete unused snapshot container images' on: schedule: - - cron: '0 12 1 * *' + - cron: '0 12 * * 1' workflow_dispatch: jobs: