Skip to content

Commit

Permalink
Explicitly install OpenShift CLI tools as not included in latest GitH…
Browse files Browse the repository at this point in the history
…ub Runner image [DI-396] (#850)

The latest GitHub `ubuntu-24.04` runner image [no longer includes the
OpenShift CLI](actions/runner-images#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
  • Loading branch information
JackPGreen committed Jan 9, 2025
1 parent c064c42 commit 2c59b1d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
27 changes: 10 additions & 17 deletions .github/scripts/smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/tag_image_push_rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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" \
Expand Down

0 comments on commit 2c59b1d

Please sign in to comment.