Skip to content

Commit

Permalink
fix(action): missing required tools installation
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi committed Jan 20, 2025
1 parent d895f36 commit 20e688d
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/actions/rosa-cleanup-clusters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ This GitHub Action automates the deletion of ROSA (Red Hat OpenShift Service on
| `tf-bucket` | <p>Bucket containing the clusters states</p> | `true` | `""` |
| `tf-bucket-region` | <p>Region of the bucket containing the resources states, if not set, will fallback on AWS_REGION</p> | `false` | `""` |
| `max-age-hours-cluster` | <p>Maximum age of clusters in hours</p> | `false` | `20` |
| `rosa-cli-version` | <p>Version of the ROSA CLI to use</p> | `false` | `latest` |
| `tf-cli-config-credentials-hostname` | <p>The hostname of a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration file. Defaults to <code>app.terraform.io</code>.</p> | `false` | `app.terraform.io` |
| `tf-cli-config-credentials-token` | <p>The API token for a HCP Terraform/Terraform Enterprise instance to place within the credentials block of the Terraform CLI configuration file.</p> | `false` | `""` |
| `tf-terraform-version` | <p>The version of Terraform CLI to install. Instead of full version string you can also specify constraint string starting with "&lt;" (for example <code>&lt;1.13.0</code>) to install the latest version satisfying the constraint. A value of <code>latest</code> will install the latest version of Terraform CLI. Defaults to <code>latest</code>.</p> | `false` | `latest` |
| `tf-terraform-wrapper` | <p>Whether or not to install a wrapper to wrap subsequent calls of the <code>terraform</code> binary and expose its STDOUT, STDERR, and exit code as outputs named <code>stdout</code>, <code>stderr</code>, and <code>exitcode</code> respectively. Defaults to <code>true</code>.</p> | `false` | `true` |
| `openshift-version` | <p>Version of the OpenShift to install</p> | `true` | `4.17.10` |
| `awscli-version` | <p>Version of the aws cli to use</p> | `true` | `2.15.52` |


## Runs
Expand Down Expand Up @@ -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
```
80 changes: 80 additions & 0 deletions .github/actions/rosa-cleanup-clusters/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 20e688d

Please sign in to comment.