From 2c59b1d1f10bca03dc2fc4dfb5fa0547ded3ed29 Mon Sep 17 00:00:00 2001 From: Jack Green Date: Thu, 9 Jan 2025 13:05:44 +0000 Subject: [PATCH] Explicitly install OpenShift CLI tools as not included in latest GitHub Runner image [DI-396] (#850) The latest GitHub `ubuntu-24.04` runner image [no longer includes the OpenShift CLI](https://github.com/actions/runner-images/issues/10636), which has cause [unexpected action failures](https://github.com/hazelcast/hazelcast-docker/actions/runs/12684539163): `oc: command not found.` Changes: - Explicitly install the OpenShift tools [(as per `hazelcast-platform-operator`)](https://github.com/search?q=repo%3Ahazelcast%2Fhazelcast-platform-operator%20redhat-actions%2Fopenshift-tools-installer&type=code) - includes migrating `preflight` tool - Replace explicit `oc login` command with action Fixes: [DI-396](https://hazelcast.atlassian.net/browse/DI-396) [DI-396]: https://hazelcast.atlassian.net/browse/DI-396?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- .github/scripts/smoke-test.sh | 27 +++++++++-------------- .github/workflows/tag_image_push_rhel.yml | 22 +++++++++++------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index 78d58d03..98eccf3e 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -4,23 +4,16 @@ set -e set -o pipefail # Fill the variables before running the script -WORKDIR=$1 -PROJECT=$2 -OCP_LOGIN_USERNAME=$3 -OCP_LOGIN_PASSWORD=$4 -OCP_CLUSTER_URL=$5 -SCAN_REGISTRY_USER=$6 -SCAN_REGISTRY_PASSWORD=$7 -SCAN_REPOSITORY=$8 -RELEASE_VERSION=$9 -HAZELCAST_CLUSTER_SIZE=${10} -HZ_ENTERPRISE_LICENSE=${11} -HZ_MC_VERSION=${12} -SCAN_REGISTRY=${13} -LOGIN_COMMAND="oc login ${OCP_CLUSTER_URL} -u=${OCP_LOGIN_USERNAME} -p=${OCP_LOGIN_PASSWORD} --insecure-skip-tls-verify" - -# LOG INTO OpenShift -eval "${LOGIN_COMMAND}" +WORKDIR=${1} +PROJECT=${2} +SCAN_REGISTRY_USER=${3} +SCAN_REGISTRY_PASSWORD=${4} +SCAN_REPOSITORY=${5} +RELEASE_VERSION=${6} +HAZELCAST_CLUSTER_SIZE=${7} +HZ_ENTERPRISE_LICENSE=${8} +HZ_MC_VERSION=${9} +SCAN_REGISTRY=${10} # CREATE PROJECT oc new-project $PROJECT diff --git a/.github/workflows/tag_image_push_rhel.yml b/.github/workflows/tag_image_push_rhel.yml index 26d5d932..dcc37ca1 100644 --- a/.github/workflows/tag_image_push_rhel.yml +++ b/.github/workflows/tag_image_push_rhel.yml @@ -151,11 +151,12 @@ jobs: ${TAGS_ARG} \ --platform=${PLATFORMS} $DOCKER_DIR - - name: Install preflight tool - run: | - PREFLIGHT_VERSION=$(curl -s https://api.github.com/repos/redhat-openshift-ecosystem/openshift-preflight/releases/latest | grep 'tag_name' | cut -d\" -f4) - wget https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/${PREFLIGHT_VERSION}/preflight-linux-amd64 - chmod +x preflight-linux-amd64 + - uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "latest" + preflight: "latest" + source: github + skip_cache: true - name: Run preflight scan run: | @@ -171,15 +172,20 @@ jobs: wait_for_container_scan "$RHEL_PROJECT_ID" "$VERSION" "$RHEL_API_KEY" "$TIMEOUT_IN_MINS" + - uses: redhat-actions/oc-login@v1 + with: + openshift_server_url: ${{ env.OCP_CLUSTER_URL }} + openshift_username: ${{ env.OCP_LOGIN_USERNAME }} + openshift_password: ${{ env.OCP_LOGIN_PASSWORD }} + insecure_skip_tls_verify: true + + - name: Deploy Hazelcast Cluster run: | WORKDIR=$(pwd)/.github/scripts .github/scripts/smoke-test.sh \ "$WORKDIR" \ "$PROJECT_NAME" \ - "$OCP_LOGIN_USERNAME" \ - "$OCP_LOGIN_PASSWORD" \ - "$OCP_CLUSTER_URL" \ "$SCAN_REGISTRY_USER" \ "$SCAN_REGISTRY_PASSWORD" \ "$SCAN_REPOSITORY" \