From 7bc9fd200868e223ca262fce81489249da6f05f8 Mon Sep 17 00:00:00 2001 From: Tao Li Date: Thu, 13 Aug 2026 13:51:47 +0800 Subject: [PATCH 1/2] ci: add workflow to cleanup -testing operand image Signed-off-by: Tao Li --- .github/workflows/registry-clean.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/registry-clean.yml diff --git a/.github/workflows/registry-clean.yml b/.github/workflows/registry-clean.yml new file mode 100644 index 00000000..69707285 --- /dev/null +++ b/.github/workflows/registry-clean.yml @@ -0,0 +1,27 @@ +# This workflow runs daily to clean up the `*-testing` images older than the +# cut-off period specified in `snok/container-retention-policy` +name: clean-testing-package + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +env: + IMAGE_NAME: "postgis-extension-testing, pgvector-testing, pgaudit-testing, pg-crash-testing, timescaledb-oss-testing, wal2json-testing, pg-ivm-testing, pgrouting-testing" + +jobs: + clean-ghcr: + name: delete old testing container images + permissions: + packages: write + runs-on: ubuntu-latest + steps: + - name: Delete '-testing' operand images in ${{ env.IMAGE_NAME }} + uses: snok/container-retention-policy@d3bdcf5ce9b05f685154e4a16c39233b245e3d53 # v3.1.0 + with: + image-names: ${{ env.IMAGE_NAME }} + cut-off: 1w + keep-n-most-recent: 1 + account: ${{ github.repository_owner }} + token: ${{ secrets.GITHUB_TOKEN }} From 414d33bcc9651afbc8119fe3684f9c985ef57379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Fei?= Date: Thu, 20 Aug 2026 13:03:53 +0200 Subject: [PATCH 2/2] feat: dinamically compute list of images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Niccolò Fei --- .github/workflows/registry-clean.yml | 38 +++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/.github/workflows/registry-clean.yml b/.github/workflows/registry-clean.yml index 69707285..8c9c4443 100644 --- a/.github/workflows/registry-clean.yml +++ b/.github/workflows/registry-clean.yml @@ -7,20 +7,50 @@ on: schedule: - cron: '0 0 * * *' -env: - IMAGE_NAME: "postgis-extension-testing, pgvector-testing, pgaudit-testing, pg-crash-testing, timescaledb-oss-testing, wal2json-testing, pg-ivm-testing, pgrouting-testing" +permissions: {} jobs: clean-ghcr: name: delete old testing container images permissions: + contents: read packages: write runs-on: ubuntu-latest steps: - - name: Delete '-testing' operand images in ${{ env.IMAGE_NAME }} + - name: Checkout Code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + + - name: Fetch valid targets + id: get-targets + uses: dagger/dagger-for-github@27b130bf0f79a7f6fbbbe0fbca6760dc9bb40a77 # v8.4.1 + env: + # renovate: datasource=github-tags depName=dagger/dagger versioning=semver + DAGGER_VERSION: 0.21.8 + with: + version: ${{ env.DAGGER_VERSION }} + verb: call + module: ./dagger/maintenance/ + args: get-targets + + - name: Compute image-names list + id: image-names + env: + VALID_TARGETS: ${{ steps.get-targets.outputs.output }} + run: | + image_names=() + for extension in $(jq -r '.[]' <<< "$VALID_TARGETS"); do + image_name=$(sed -n 's/^\s*image_name\s*=\s*"\(.*\)"$/\1/p' "${extension}/metadata.hcl") + image_names+=("${image_name}-testing") + done + printf -v joined '%s, ' "${image_names[@]}" + echo "value=${joined%, }" >> "$GITHUB_OUTPUT" + + - name: Delete '-testing' operand images uses: snok/container-retention-policy@d3bdcf5ce9b05f685154e4a16c39233b245e3d53 # v3.1.0 with: - image-names: ${{ env.IMAGE_NAME }} + image-names: ${{ steps.image-names.outputs.value }} cut-off: 1w keep-n-most-recent: 1 account: ${{ github.repository_owner }}