Skip to content

fix commands

fix commands #3

Workflow file for this run

---
name: Daily cleanup cluster
on:
push: # TODO: remove this
workflow_dispatch:
inputs:
max_age_hours_cluster:
description: "Maximum age of clusters in hours"
required: true
default: "20"
schedule:
- cron: '0 1 * * *' # At 01:00 everyday.
env:
MAX_AGE_HOURS_CLUSTER: 20
AWS_PROFILE: "infex"
# please keep those variables synced with tests.yml
TESTS_AWS_REGION: "eu-west-2"
TF_S3_BUCKET: "camunda-tf-rosa"
ASSIGNEES_ISSUE_ERROR: "Langleu, leiicamundi"
jobs:
cleanup-clusters:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Import Secrets
id: secrets
uses: hashicorp/vault-action@d1720f055e0635fd932a1d2a48f87a666a57906c # v3
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
exportEnv: false
secrets: |
secret/data/products/infrastructure-experience/ci/common AWS_ACCESS_KEY;
secret/data/products/infrastructure-experience/ci/common AWS_SECRET_KEY;
secret/data/products/infrastructure-experience/ci/common RH_OPENSHIFT_TOKEN;
# Official action does not support profiles
- name: Add profile credentials to ~/.aws/credentials
run: |
aws configure set aws_access_key_id ${{ steps.secrets.outputs.AWS_ACCESS_KEY }} --profile ${{ env.AWS_PROFILE }}
aws configure set aws_secret_access_key ${{ steps.secrets.outputs.AWS_SECRET_KEY }} --profile ${{ env.AWS_PROFILE }}
aws configure set region ${{ env.TESTS_AWS_REGION }} --profile ${{ env.AWS_PROFILE }}
- name: Delete clusters
id: delete_clusters
timeout-minutes: 125
shell: bash
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 }}
- name: Create issue on failure
if: failure()
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKFLOW_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
with:
assignees: "${{ env.ASSIGNEES_ISSUE_ERROR }}"
update_existing: true
search_existing: all
filename: .github/templates/issue_delete_clusters_failed.md