Skip to content

ROSA Cluster - Delete #119

ROSA Cluster - Delete

ROSA Cluster - Delete #119

name: ROSA Cluster - Delete
on:
workflow_call:
inputs:
clusterName:
description: 'Name of the cluster'
type: string
deleteAll:
description: 'Delete all clusters'
required: true
default: 'no'
type: string
workflow_dispatch:
inputs:
clusterName:
description: 'Name of the cluster'
type: string
deleteAll:
description: 'Delete all clusters'
required: true
default: 'no'
type: string
concurrency: cluster_${{ github.event.inputs.clusterName || format('gh-{0}', github.repository_owner) }}
jobs:
delete:
name: Delete ROSA cluster
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup ROSA CLI
uses: ./.github/actions/rosa-cli-setup
with:
aws-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-default-region: ${{ vars.AWS_DEFAULT_REGION }}
rosa-token: ${{ secrets.ROSA_TOKEN }}
- name: Login to OpenShift cluster
if: ${{ inputs.deleteAll == 'no' }}
uses: ./.github/actions/oc-keycloak-login
with:
clusterName: ${{ inputs.clusterName || format('gh-{0}', github.repository_owner) }}
- name: Delete a ROSA Cluster
if: ${{ inputs.deleteAll == 'no' }}
shell: bash
run: ./rosa_delete_cluster.sh
working-directory: provision/aws
env:
CLUSTER_NAME: ${{ inputs.clusterName || format('gh-{0}', github.repository_owner) }}
- name: Delete all ROSA Clusters
if: ${{ inputs.deleteAll == 'yes' }}
shell: bash
run: ./rosa_cluster_reaper.sh
working-directory: provision/aws
- name: Archive ROSA logs
uses: actions/upload-artifact@v3
if: always()
with:
name: rosa-logs
path: provision/aws/logs
retention-days: 5