From 20e688dcdafe08273e3eca5d10906e3471925199 Mon Sep 17 00:00:00 2001 From: Leo J <153937047+leiicamundi@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:55:30 +0100 Subject: [PATCH] fix(action): missing required tools installation --- .../actions/rosa-cleanup-clusters/README.md | 54 +++++++++++++ .../actions/rosa-cleanup-clusters/action.yml | 80 +++++++++++++++++++ 2 files changed, 134 insertions(+) diff --git a/.github/actions/rosa-cleanup-clusters/README.md b/.github/actions/rosa-cleanup-clusters/README.md index 59c37cc..7decb47 100644 --- a/.github/actions/rosa-cleanup-clusters/README.md +++ b/.github/actions/rosa-cleanup-clusters/README.md @@ -12,6 +12,13 @@ This GitHub Action automates the deletion of ROSA (Red Hat OpenShift Service on | `tf-bucket` |
Bucket containing the clusters states
| `true` | `""` | | `tf-bucket-region` |Region of the bucket containing the resources states, if not set, will fallback on AWS_REGION
| `false` | `""` | | `max-age-hours-cluster` |Maximum age of clusters in hours
| `false` | `20` | +| `rosa-cli-version` |Version of the ROSA CLI to use
| `false` | `latest` | +| `tf-cli-config-credentials-hostname` |The hostname of a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration file. Defaults to app.terraform.io
.
The API token for a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration file.
| `false` | `""` | +| `tf-terraform-version` |The version of Terraform CLI to install. Instead of full version string you can also specify constraint string starting with "<" (for example <1.13.0
) to install the latest version satisfying the constraint. A value of latest
will install the latest version of Terraform CLI. Defaults to latest
.
Whether or not to install a wrapper to wrap subsequent calls of the terraform
binary and expose its STDOUT, STDERR, and exit code as outputs named stdout
, stderr
, and exitcode
respectively. Defaults to true
.
Version of the OpenShift to install
| `true` | `4.17.10` | +| `awscli-version` |Version of the aws cli to use
| `true` | `2.15.52` | ## Runs @@ -40,4 +47,51 @@ This action is a `composite` action. # # Required: false # Default: 20 + + rosa-cli-version: + # Version of the ROSA CLI to use + # + # Required: false + # Default: latest + + tf-cli-config-credentials-hostname: + # The hostname of a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration + # file. Defaults to `app.terraform.io`. + # + # Required: false + # Default: app.terraform.io + + tf-cli-config-credentials-token: + # The API token for a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration + # file. + # + # Required: false + # Default: "" + + tf-terraform-version: + # The version of Terraform CLI to install. Instead of full version string you can also specify constraint string starting with "<" (for + # example `<1.13.0`) to install the latest version satisfying the constraint. A value of `latest` will install the latest version of Terraform + # CLI. Defaults to `latest`. + # + # Required: false + # Default: latest + + tf-terraform-wrapper: + # Whether or not to install a wrapper to wrap subsequent calls of the `terraform` binary and expose its STDOUT, STDERR, and exit code + # as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`. + # + # Required: false + # Default: true + + openshift-version: + # Version of the OpenShift to install + # + # Required: true + # Default: 4.17.10 + + awscli-version: + # Version of the aws cli to use + # + # Required: true + # Default: 2.15.52 ``` diff --git a/.github/actions/rosa-cleanup-clusters/action.yml b/.github/actions/rosa-cleanup-clusters/action.yml index a197477..7fc27a7 100644 --- a/.github/actions/rosa-cleanup-clusters/action.yml +++ b/.github/actions/rosa-cleanup-clusters/action.yml @@ -8,16 +8,96 @@ inputs: tf-bucket: description: Bucket containing the clusters states required: true + tf-bucket-region: description: Region of the bucket containing the resources states, if not set, will fallback on AWS_REGION + max-age-hours-cluster: description: Maximum age of clusters in hours required: false default: '20' + rosa-cli-version: + description: Version of the ROSA CLI to use + default: latest + + # inherited from https://github.com/hashicorp/setup-terraform/blob/main/action.yml + tf-cli-config-credentials-hostname: + description: | + The hostname of a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration + file. Defaults to `app.terraform.io`. + default: app.terraform.io + required: false + + tf-cli-config-credentials-token: + description: | + The API token for a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration + file. + required: false + + tf-terraform-version: + description: | + The version of Terraform CLI to install. Instead of full version string you can also specify constraint string starting with "<" (for + example `<1.13.0`) to install the latest version satisfying the constraint. A value of `latest` will install the latest version of Terraform + CLI. Defaults to `latest`. + default: latest + required: false + + tf-terraform-wrapper: + description: | + Whether or not to install a wrapper to wrap subsequent calls of the `terraform` binary and expose its STDOUT, STDERR, and exit code + as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`. + default: 'true' + required: false + + openshift-version: + description: Version of the OpenShift to install + required: true + # renovate: datasource=custom.rosa-camunda depName=red-hat-openshift versioning=semver + default: 4.17.10 + + awscli-version: + description: Version of the aws cli to use + required: true + # renovate: datasource=github-releases depName=aws/aws-cli + default: 2.15.52 + runs: using: composite steps: + - name: Install ROSA CLI + shell: bash + run: | + curl -LO "https://mirror.openshift.com/pub/openshift-v4/clients/rosa/${{ inputs.rosa-cli-version }}/rosa-linux.tar.gz" + tar -xvf rosa-linux.tar.gz + sudo mv rosa /usr/local/bin/rosa + chmod +x /usr/local/bin/rosa + rm -f rosa-linux.tar.gz + rosa version + + - name: Install Terraform + uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3 + with: + cli_config_credentials_hostname: ${{ inputs.tf-cli-config-credentials-hostname }} + cli_config_credentials_token: ${{ inputs.tf-cli-config-credentials-token }} + terraform_version: ${{ inputs.tf-terraform-version }} + terraform_wrapper: ${{ inputs.tf-terraform-wrapper }} + + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@144527c7d98999f2652264c048c7a9bd103f8a82 # v1 + with: + oc: ${{ inputs.openshift-version }} + + - name: Install aws-cli v2 + shell: bash + run: | + sudo rm -rf /usr/local/aws-cli + mkdir -p /tmp/awscli && cd /tmp/awscli + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${{ inputs.awscli-version }}.zip" -o "awscliv2.zip" + unzip -qq awscliv2.zip + sudo ./aws/install + cd - && rm -Rf /tmp/awscli + - name: Delete clusters id: delete_clusters shell: bash