Skip to content

Cleanup Old Test Buckets #9

Cleanup Old Test Buckets

Cleanup Old Test Buckets #9

name: Cleanup Old Test Buckets
on:
schedule:
# Run every Wednesday at 6:00 AM UTC (cron: minute hour day-of-month month day-of-week)
- cron: '0 6 * * 3'
workflow_dispatch:
inputs:
days_old:
description: Number of days old for buckets to be deleted
required: false
default: 7
type: number
jobs:
cleanup-old-buckets:
runs-on: ubuntu-latest
# this is to prevent the job to run at forked projects
if: ${{ ! github.repository.fork }}
strategy:
matrix:
environment: [trusted, untrusted, rosa-trusted, rosa-untrusted]
environment: ${{ matrix.environment }}
permissions:
id-token: write # Required for OIDC authentication with AWS
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ vars.IAM_ROLE }}
aws-region: ${{ vars.AWS_REGION }}
role-duration-seconds: 3600 # 1 hour should be sufficient for cleanup
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Delete Old Test Buckets
env:
AWS_REGION: ${{ vars.AWS_REGION }}
run: |
tests/e2e-kubernetes/scripts/bucket-cleanup.py cleanup \
--days-old ${{ github.event.inputs.days_old || '7' }}