Skip to content

Commit

Permalink
create a reusable gha for cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi committed May 30, 2024
1 parent 4b6665c commit 944130b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/actions/rosa-cleanup-clusters/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Delete ROSA Clusters

description: |
This GitHub Action automates the deletion of ROSA (Red Hat OpenShift Service on AWS) clusters using a shell script.
inputs:
tf-bucket:
description: 'Bucket containing the clusters states'
required: true
max-age-hours-cluster:
description: 'Maximum age of clusters in hours'
required: false
default: "20"

runs:
using: 'composite'
steps:
- name: Delete clusters
id: delete_clusters
shell: bash
run: |
.scripts/destroy-clusters.sh "${{ inputs.tf-bucket }}" ../../../modules/rosa-hcp/modules/rosa-hcp/ /tmp/rosa/ ${{ inputs.max-age-hours-cluster }}
10 changes: 5 additions & 5 deletions .github/workflows/daily-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- cron: '0 1 * * *' # At 01:00 everyday.

env:
MAX_AGE_HOURS_CLUSTER: 20
MAX_AGE_HOURS_CLUSTER: "${{ github.event.inputs.max_age_hours_cluster || '20' }}"
AWS_PROFILE: "infex"

# please keep those variables synced with tests.yml
Expand Down Expand Up @@ -63,13 +63,13 @@ jobs:
- name: Delete clusters
id: delete_clusters
timeout-minutes: 125
shell: bash
uses: ./.github/actions/rosa-cleanup-clusters
env:
RH_TOKEN: "${{ steps.secrets.outputs.RH_OPENSHIFT_TOKEN }}"
AWS_REGION: "${{ env.TESTS_AWS_REGION }}"
MAX_AGE_HOURS_CLUSTER: ${{ github.event.inputs.max_age_hours_cluster || env.MAX_AGE_HOURS_CLUSTER }}
run: |
.github/workflows/scripts/destroy-clusters.sh "${{ env.TF_S3_BUCKET }}" ./modules/rosa-hcp/ /tmp/rosa/ ${{ env.MAX_AGE_HOURS_CLUSTER }}
with:
tf-bucket: "${{ env.TF_S3_BUCKET }}"
max-age-hours-cluster: "${{ env.MAX_AGE_HOURS_CLUSTER }}"

- name: Close issue in case of success
shell: bash
Expand Down

0 comments on commit 944130b

Please sign in to comment.