Skip to content

Commit

Permalink
conditional cluster definition
Browse files Browse the repository at this point in the history
ocp_cluster_name=leogit2

delete_ocp_cluster=false
  • Loading branch information
leiicamundi committed May 15, 2024
1 parent 150ec70 commit 8f646c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
15 changes: 4 additions & 11 deletions .github/actions/rosa-create-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ inputs:
description: 'Version of the aws cli to use'
required: true
default: "1.32.105" # TODO: for all versions, update default one with renovate
oc-version:
description: 'Version of the oc cli to install'
required: true
default: "latest"
openshift-version:
description: 'Version of the OpenShift to install'
required: true
Expand Down Expand Up @@ -84,10 +80,10 @@ runs:
- name: Install Terraform
uses: hashicorp/setup-terraform@v3

- name: Install oc CLI
uses: redhat-actions/oc-installer@v1
- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
with:
oc_version: ${{ inputs.oc-version }}
oc: "${{ inputs.openshift-version }}"

- name: Login to Red Hat Hybrid Cloud Console
shell: bash
Expand Down Expand Up @@ -175,14 +171,11 @@ runs:
- name: Generate kubeconfig
shell: bash
id: kube_config
# TODO: remove sleep time
run: |
export server_api=$(rosa describe cluster --output=json -c "${{ steps.apply.outputs.cluster_id }}" | jq -r '.api.url')
echo "server_api=$server_api"
echo "server_api=$server_api" >> "$GITHUB_OUTPUT"
echo "Wait some time before login"
sleep 30
oc login --username "${{ inputs.admin-username }}" --password "${{ inputs.admin-password }}" --server=$server_api
kubectl config rename-context $(oc config current-context) "${{ inputs.cluster-name }}"
kubectl config use "${{ inputs.cluster-name }}"
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ jobs:
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.AWS_REGION }} --profile ${{ env.AWS_PROFILE }}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
detached: true

- name: Create Cluster
timeout-minutes: 125
Expand All @@ -92,6 +97,6 @@ jobs:
uses: ./.github/actions/rosa-delete-cluster
with:
rh-token: ${{ steps.secrets.outputs.RH_OPENSHIFT_TOKEN }}
cluster-name: "${{ steps.ocp_cluster_name.outputs.cluster_name }}"
cluster-name: "${{ steps.commit_info.outputs.cluster_name }}"
aws-region: ${{ env.AWS_REGION }}
s3-backend-bucket: ${{ env.TF_S3_BUCKET }}

0 comments on commit 8f646c8

Please sign in to comment.