Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
Remove testing images from quay on PR closure (#77)
Browse files Browse the repository at this point in the history
We should remove stale testing images if the associated PR closes.  This
will help spare us some repository clutter.

Signed-off-by: Andy Sadler <ansadler@redhat.com>
  • Loading branch information
sadlerap authored Apr 16, 2024
1 parent 030846f commit 8dfe2e9
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/clean-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "PR checks - Clean operator images"

on:
pull_request_target:
types: [closed]

jobs:
clean-operator-images:
name: "Clean operator images (PR)"
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- image_base: host-operator
- image_base: host-operator-bundle
- image_base: host-operator-index
- image_base: member-operator
- image_base: member-operator-bundle
- image_base: member-operator-console-plugin
- image_base: member-operator-index
- image_base: member-operator-webhook
- image_base: registration-service
- image_base: workspace-operator
- image_base: workspace-server

steps:
- name: Checkout Git Repository
uses: actions/checkout@v4

- name: Delete stale images
env:
REPO: quay.io/konflux-workspaces/${{ matrix.image_base }}
TAGS: "pr-${{ github.event.pull_request.number }}-.*"
run: |
for tag in $(skopeo list-tags --tls-verify=false docker://${REPO} | jq -r ".Tags[] | select(.? | match(\"${TAGS}\"))"); do
echo "Deleting docker://${REPO}:${tag}"
skopeo delete --creds "${{ secrets.QUAY_USERNAME }}:${{ secrets.QUAY_TOKEN }}" docker://${REPO}:${tag}
done

0 comments on commit 8dfe2e9

Please sign in to comment.