|
| 1 | +name: Build EE NLC snapshot image |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + HZ_VERSION: |
| 7 | + description: 'Version of Hazelcast to build the image for' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + HZ_EE_REVISION: |
| 11 | + description: 'Commit id of Hazelcast Enterprise snapshot jar' |
| 12 | + required: true |
| 13 | + type: string |
| 14 | +env: |
| 15 | + test_container_name_ee: hazelcast-ee-test |
| 16 | + |
| 17 | +jobs: |
| 18 | + jdks: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Get supported JDKs |
| 22 | + id: jdks |
| 23 | + uses: hazelcast/hazelcast-docker/.github/actions/get-supported-jdks@reusable-build-pr |
| 24 | + with: |
| 25 | + HZ_VERSION: '${{ inputs.HZ_VERSION }}' |
| 26 | + |
| 27 | + push: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + needs: jdks |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + jdk: ${{ fromJSON(needs.jdks.outputs.jdks) }} |
| 34 | + env: |
| 35 | + HZ_VERSION : ${{ inputs.HZ_VERSION }} |
| 36 | + NLC_IMAGE_NAME: ${{ secrets.NLC_IMAGE_NAME }} |
| 37 | + S3_NLC_URL: ${{ secrets.S3_NLC_URL }} |
| 38 | + steps: |
| 39 | + - name: Checkout Code |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Configure AWS credentials |
| 43 | + uses: aws-actions/configure-aws-credentials@v4 |
| 44 | + with: |
| 45 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 46 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 47 | + aws-region: 'us-east-1' |
| 48 | + |
| 49 | + - name: Get presigned NLC URL from S3 |
| 50 | + run: | |
| 51 | + ZIP_NAME=hazelcast-enterprise-${HZ_VERSION}-nlc.zip |
| 52 | + S3_NLC_ZIP_URL=${S3_NLC_URL}/snapshot/${ZIP_NAME} |
| 53 | +
|
| 54 | + HAZELCAST_ZIP_URL="$(aws s3 presign ${S3_NLC_ZIP_URL} --expires-in 600)" |
| 55 | + echo "HAZELCAST_ZIP_URL=${HAZELCAST_ZIP_URL}" >> $GITHUB_ENV |
| 56 | +
|
| 57 | + - name: Login to Docker Hub |
| 58 | + uses: docker/login-action@v3 |
| 59 | + with: |
| 60 | + registry: ${{ secrets.NLC_REPOSITORY }} |
| 61 | + username: ${{ secrets.NLC_REPO_USERNAME }} |
| 62 | + password: ${{ secrets.NLC_REPO_TOKEN }} |
| 63 | + |
| 64 | + - name: Set up QEMU |
| 65 | + uses: docker/setup-qemu-action@v3.6.0 |
| 66 | + |
| 67 | + - name: Set up Docker Buildx |
| 68 | + uses: docker/setup-buildx-action@v3 |
| 69 | + with: |
| 70 | + version: v0.5.1 |
| 71 | + |
| 72 | + - name: Build EE image |
| 73 | + run: | |
| 74 | + docker buildx build --load \ |
| 75 | + --build-arg HZ_VERSION=${HZ_VERSION} \ |
| 76 | + --build-arg HAZELCAST_ZIP_URL=${HAZELCAST_ZIP_URL} \ |
| 77 | + --build-arg JDK_VERSION=${{ matrix.jdk }} \ |
| 78 | + --label hazelcast.ee.revision=${{ inputs.HZ_EE_REVISION }} \ |
| 79 | + --tag hazelcast-nlc:test hazelcast-enterprise |
| 80 | +
|
| 81 | + - name: Run smoke test against EE image |
| 82 | + timeout-minutes: 2 |
| 83 | + uses: hazelcast/hazelcast-docker/.github/actions/simple-smoke-test@reusable-build-pr |
| 84 | + env: |
| 85 | + HZ_LICENSEKEY: ${{ secrets.HZ_ENTERPRISE_LICENSE }} |
| 86 | + HZ_INSTANCETRACKING_FILENAME: instance-tracking.txt |
| 87 | + with: |
| 88 | + IMAGE: hazelcast-nlc:test |
| 89 | + CONTAINER_NAME: ${{ env.test_container_name_ee }} |
| 90 | + DISTRIBUTION_TYPE: ee |
| 91 | + EXPECTED_VERSION: ${{ inputs.HZ_VERSION }} |
| 92 | + EXPECTED_JAVA_MAJOR_VERSION: ${{ matrix.jdk }} |
| 93 | + |
| 94 | + - name: Get docker logs |
| 95 | + if: ${{ always() }} |
| 96 | + run: | |
| 97 | + DOCKER_LOG_FILE_EE=docker-${{ env.test_container_name_ee }}-jdk${{ matrix.jdk }}.log |
| 98 | + echo "DOCKER_LOG_FILE_EE=${DOCKER_LOG_FILE_EE}" >> $GITHUB_ENV |
| 99 | + docker logs "${{ env.test_container_name_ee }}" > "${DOCKER_LOG_FILE_EE}" |
| 100 | +
|
| 101 | + - name: Store docker logs as artifact |
| 102 | + if: ${{ always() }} |
| 103 | + uses: actions/upload-artifact@v4 |
| 104 | + with: |
| 105 | + name: docker-logs-${{ github.job }}-jdk${{ matrix.jdk }} |
| 106 | + path: | |
| 107 | + ${{ env.DOCKER_LOG_FILE_EE }} |
| 108 | +
|
| 109 | + - name: Get default JDK for hazelcast-enterprise |
| 110 | + id: get_default_ee_jdk |
| 111 | + uses: hazelcast/hazelcast-docker/.github/actions/docker-info@reusable-build-pr |
| 112 | + with: |
| 113 | + DOCKER_PATH: hazelcast-enterprise |
| 114 | + |
| 115 | + - name: Get EE tags to push |
| 116 | + id: get_ee_tags_to_push |
| 117 | + uses: hazelcast/hazelcast-docker/.github/actions/get-tags-to-push@reusable-build-pr |
| 118 | + with: |
| 119 | + HZ_VERSION: ${{ env.HZ_VERSION }} |
| 120 | + CURRENT_JDK: ${{ matrix.jdk }} |
| 121 | + DEFAULT_JDK: ${{ steps.get_default_ee_jdk.outputs.DEFAULT_JDK }} |
| 122 | + IS_LATEST_LTS: false |
| 123 | + |
| 124 | + - name: Build/Push EE image |
| 125 | + run: | |
| 126 | + IMAGE_NAME=${NLC_IMAGE_NAME} |
| 127 | + |
| 128 | + TAGS_TO_PUSH="${{ steps.get_ee_tags_to_push.outputs.TAGS_TO_PUSH }}" |
| 129 | + echo "TAGS_TO_PUSH=$TAGS_TO_PUSH" |
| 130 | + TAGS_ARG="" |
| 131 | + for tag in ${TAGS_TO_PUSH[@]} |
| 132 | + do |
| 133 | + TAGS_ARG="${TAGS_ARG} --tag ${IMAGE_NAME}:${tag}" |
| 134 | + done |
| 135 | +
|
| 136 | + PLATFORMS="$(get_ubi_supported_platforms "${{ matrix.jdk }}")" |
| 137 | + docker buildx build --push \ |
| 138 | + --build-arg HZ_VERSION=${HZ_VERSION} \ |
| 139 | + --build-arg JDK_VERSION=${{ matrix.jdk }} \ |
| 140 | + --build-arg HAZELCAST_ZIP_URL=${HAZELCAST_ZIP_URL} \ |
| 141 | + --label hazelcast.ee.revision=${{ inputs.HZ_EE_REVISION }} \ |
| 142 | + ${TAGS_ARG} \ |
| 143 | + --platform=${PLATFORMS} $DOCKER_DIR |
| 144 | + - name: Check RedHat service status |
| 145 | + if: failure() |
| 146 | + uses: hazelcast/hazelcast-docker/.github/actions/check-redhat-service-status@reusable-build-pr |
| 147 | + - name: Slack notification |
| 148 | + uses: hazelcast/hazelcast-docker/.github/actions/slack-notification@reusable-build-pr |
| 149 | + if: failure() |
| 150 | + with: |
| 151 | + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK }} |
0 commit comments