Investigate Docker RHEL 5.5.2 build issue [DI-401] (#868) #696
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build EE RHEL image | |
on: | |
push: | |
branches: | |
- "!*" | |
tags: | |
- "v5.*" | |
- "v6.*" | |
workflow_dispatch: | |
inputs: | |
HZ_VERSION: | |
description: 'Version of Hazelcast to build the image for, e.g. 5.1.1, 5.0.1' | |
required: true | |
RELEASE_VERSION: | |
description: 'Version of the docker image e.g. 5.1.1, 5.1.1-1, defaults to HZ_VERSION' | |
required: false | |
IS_LTS_OVERRIDE: | |
description: 'Override is LTS release' | |
required: false | |
type: choice | |
default: '' | |
options: | |
- '' | |
- 'false' | |
- 'true' | |
DRY_RUN: | |
description: 'Skip pushing the images to remote registry' | |
default: 'false' | |
type: choice | |
options: | |
- 'false' | |
- 'true' | |
workflow_call: | |
inputs: | |
HZ_VERSION: | |
type: string | |
description: 'Version of Hazelcast to build the image for, e.g. 5.1.1, 5.0.1' | |
required: true | |
RELEASE_VERSION: | |
type: string | |
description: 'Version of the docker image e.g. 5.1.1, 5.1.1-1, defaults to HZ_VERSION' | |
required: false | |
IS_LTS_OVERRIDE: | |
description: 'Override is LTS release' | |
required: false | |
type: string | |
default: '' | |
DRY_RUN: | |
description: 'Skip pushing the images to remote registry' | |
default: 'false' | |
type: string | |
jobs: | |
jdks: | |
uses: ./.github/workflows/get-supported-jdks.yaml | |
build: | |
defaults: | |
run: | |
shell: bash | |
env: | |
SCAN_REGISTRY: "quay.io" | |
TIMEOUT_IN_MINS: 240 | |
RHEL_API_KEY: ${{ secrets.RHEL_API_KEY }} | |
HZ_VERSION: ${{ inputs.HZ_VERSION }} | |
RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} | |
PROJECT_NAME: test-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.jdk }} | |
runs-on: ubuntu-latest | |
needs: jdks | |
strategy: | |
fail-fast: false | |
matrix: | |
jdk: ${{ fromJSON(needs.jdks.outputs.jdks) }} | |
steps: | |
- name: Set HZ version as environment variable | |
if: env.HZ_VERSION == '' | |
run: | | |
echo "HZ_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV | |
- name: Set Release version as environment variable | |
if: env.RELEASE_VERSION == '' | |
run: | | |
echo "RELEASE_VERSION=${{ env.HZ_VERSION }}" >> $GITHUB_ENV | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: v0.5.1 | |
- uses: madhead/semver-utils@latest | |
id: version | |
with: | |
version: ${{ env.HZ_VERSION }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: 'us-east-1' | |
- name: Get Secrets | |
uses: aws-actions/aws-secretsmanager-get-secrets@v2 | |
with: | |
secret-ids: | | |
OCP_LOGIN_USERNAME,CN/OCP_USERNAME | |
OCP_LOGIN_PASSWORD,CN/OCP_PASSWORD | |
OCP_CLUSTER_URL,CN/OCP_CLUSTER_URL | |
- name: Set scan registry secrets | |
run: | | |
echo "SCAN_REGISTRY_USER=${{ secrets[format('SCAN_REGISTRY_USER_V{0}', steps.version.outputs.major)] }}" >> $GITHUB_ENV | |
echo "SCAN_REGISTRY_PASSWORD=${{ secrets[format('SCAN_REGISTRY_PASSWORD_V{0}', steps.version.outputs.major)] }}" >> $GITHUB_ENV | |
echo "RHEL_PROJECT_ID=${{ secrets[format('RHEL_PROJECT_ID_V{0}', steps.version.outputs.major)] }}" >> $GITHUB_ENV | |
- name: Set RHEL image as environment variable | |
run: | | |
SCAN_REPOSITORY=${SCAN_REGISTRY}/redhat-isv-containers/${RHEL_PROJECT_ID} | |
echo "SCAN_REPOSITORY=${SCAN_REPOSITORY}" >> $GITHUB_ENV | |
echo "RHEL_IMAGE=${SCAN_REPOSITORY}:${RELEASE_VERSION}-jdk${{ matrix.jdk }}" >> $GITHUB_ENV | |
- name: Log in to Red Hat Scan Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.SCAN_REGISTRY }} | |
username: ${{ env.SCAN_REGISTRY_USER }} | |
password: ${{ env.SCAN_REGISTRY_PASSWORD }} | |
- name: Check if latest EE LTS release | |
id: is_latest_lts | |
uses: ./.github/actions/check-if-latest-lts-release | |
with: | |
release_version: ${{ env.RELEASE_VERSION }} | |
is_lts_override: ${{ inputs.IS_LTS_OVERRIDE }} | |
- name: Delete unpublished images | |
if: inputs.DRY_RUN != 'true' | |
run: | | |
VERSION=${RELEASE_VERSION}-jdk${{ matrix.jdk }} | |
source .github/scripts/publish-rhel.sh | |
delete_unpublished_images "${RHEL_PROJECT_ID}" "${VERSION}" "${RHEL_API_KEY}" | |
- name: Build the Hazelcast Enterprise image | |
run: | | |
. .github/scripts/get-tags-to-push.sh | |
. .github/scripts/docker.functions.sh | |
. .github/scripts/ee-build.functions.sh | |
DOCKER_DIR=hazelcast-enterprise | |
IMAGE_NAME=${SCAN_REPOSITORY} | |
DEFAULT_JDK="$(get_default_jdk $DOCKER_DIR)" | |
IS_LATEST_LTS="${{ steps.is_latest_lts.outputs.is_latest_lts }}" | |
TAGS_TO_PUSH=$(get_tags_to_push ${{ env.RELEASE_VERSION }} "" "${{ matrix.jdk }}" "$DEFAULT_JDK" "$IS_LATEST_LTS") | |
echo "TAGS_TO_PUSH=$TAGS_TO_PUSH" | |
TAGS_ARG="" | |
for tag in ${TAGS_TO_PUSH[@]} | |
do | |
TAGS_ARG="${TAGS_ARG} --tag ${IMAGE_NAME}:${tag}" | |
done | |
output= | |
PLATFORMS="linux/amd64" | |
if [ "${{ inputs.DRY_RUN }}" == "true" ] ; then | |
echo "DRY RUN: Skipping push for platforms ${PLATFORMS} and tags: ${TAGS_TO_PUSH}" | |
else | |
output=--push | |
fi | |
docker buildx build ${output} \ | |
--build-arg HZ_VERSION=${{ env.HZ_VERSION }} \ | |
--build-arg JDK_VERSION=${{ matrix.jdk }} \ | |
--build-arg HAZELCAST_ZIP_URL=$(get_hz_dist_zip "" "${{ env.HZ_VERSION }}") \ | |
${TAGS_ARG} \ | |
--platform=${PLATFORMS} ${DOCKER_DIR} | |
- name: Install `oc` OpenShift tool from mirror | |
uses: redhat-actions/openshift-tools-installer@v1 | |
with: | |
oc: "latest" | |
source: mirror | |
skip_cache: true | |
- name: Install `preflight` OpenShift tool from GitHub | |
uses: redhat-actions/openshift-tools-installer@v1 | |
with: | |
preflight: "latest" | |
source: github | |
skip_cache: true | |
- name: Run preflight scan | |
if: inputs.DRY_RUN != 'true' | |
run: | | |
preflight check container ${RHEL_IMAGE} \ | |
--submit --pyxis-api-token=${RHEL_API_KEY} \ | |
--certification-project-id=${RHEL_PROJECT_ID} \ | |
--docker-config ~/.docker/config.json | |
- name: Wait for Scan to Complete | |
if: inputs.DRY_RUN != 'true' | |
run: | | |
VERSION=${RELEASE_VERSION}-jdk${{ matrix.jdk }} | |
source .github/scripts/publish-rhel.sh | |
wait_for_container_scan "$RHEL_PROJECT_ID" "$VERSION" "$RHEL_API_KEY" "$TIMEOUT_IN_MINS" | |
- name: Set MC version | |
run: | | |
echo "HZ_MC_VERSION=${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}" >> $GITHUB_ENV | |
- 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 | |
if: inputs.DRY_RUN != 'true' | |
run: | | |
WORKDIR=$(pwd)/.github/scripts | |
.github/scripts/smoke-test.sh \ | |
"$WORKDIR" \ | |
"$PROJECT_NAME" \ | |
"$SCAN_REGISTRY_USER" \ | |
"$SCAN_REGISTRY_PASSWORD" \ | |
"$SCAN_REPOSITORY" \ | |
"$RELEASE_VERSION" \ | |
"$CLUSTER_SIZE" \ | |
"$HZ_ENTERPRISE_LICENSE" \ | |
"$HZ_MC_VERSION" \ | |
"$SCAN_REGISTRY" | |
env: | |
CLUSTER_SIZE: 3 | |
HZ_ENTERPRISE_LICENSE: ${{ secrets.HZ_ENTERPRISE_LICENSE }} | |
- name: Validate Cluster Size | |
if: inputs.DRY_RUN != 'true' | |
run: | | |
NAME=hazelcast-enterprise | |
source .github/scripts/cluster-verification.sh | |
wait_for_last_member_initialization $CLUSTER_SIZE | |
verify_cluster_size $CLUSTER_SIZE | |
echo "Waiting for ${PROJECT_NAME}-${NAME}-mancenter-0 pod to be ready" | |
oc wait --for=condition=Ready --timeout=120s pod ${PROJECT_NAME}-${NAME}-mancenter-0 | |
verify_management_center $CLUSTER_SIZE | |
env: | |
CLUSTER_SIZE: 3 | |
- name: Get OpenShift events | |
if: inputs.DRY_RUN != 'true' | |
run: | | |
kubectl get events -n ${PROJECT_NAME} > openshift-events-jdk${{ matrix.jdk }}.log | |
- name: Store OpenShift events as artifact | |
if: inputs.DRY_RUN != 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openshift-events-${{ github.job }}-jdk${{ matrix.jdk }}.log | |
path: openshift-events-${{ github.job }}-jdk${{ matrix.jdk }}.log | |
- name: Clean up After Test | |
if: inputs.DRY_RUN != 'true' | |
run: | | |
.github/scripts/clean-up.sh $PROJECT_NAME | |
- name: Publish the Hazelcast Enterprise image | |
if: inputs.DRY_RUN != 'true' | |
run: | | |
VERSION=${RELEASE_VERSION}-jdk${{ matrix.jdk }} | |
source .github/scripts/publish-rhel.sh | |
publish_the_image "$RHEL_PROJECT_ID" "$VERSION" "$RHEL_API_KEY" | |
wait_for_container_publish "$RHEL_PROJECT_ID" "$VERSION" "$RHEL_API_KEY" "$TIMEOUT_IN_MINS" | |
sync_tags "$RHEL_PROJECT_ID" "$VERSION" "$RHEL_API_KEY" | |
- name: Slack notification | |
uses: ./.github/actions/slack-notification | |
if: failure() | |
with: | |
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK }} |