Skip to content

Commit 94b33ff

Browse files
committed
Migrate ee-nlc-snapshot-push.yml to reusable workflow
1 parent 74b485f commit 94b33ff

File tree

2 files changed

+157
-112
lines changed

2 files changed

+157
-112
lines changed
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
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 }}

.github/workflows/ee-nlc-snapshot-push.yml

Lines changed: 6 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -9,118 +9,12 @@ on:
99
HZ_EE_REVISION:
1010
description: 'Commit id of Hazelcast Enterprise snapshot jar'
1111
required: true
12-
env:
13-
test_container_name_ee: hazelcast-ee-test
1412

1513
jobs:
16-
jdks:
17-
uses: ./.github/workflows/get-supported-jdks.yaml
14+
ee-nlc-snapshot-push:
15+
uses: hazelcast/hazelcast-docker/.github/workflows/_reusable-ee-nlc-snapshot-push.yml@reusable-build-pr
16+
with:
17+
HZ_VERSION: ${{ github.event.inputs.HZ_VERSION }}
18+
HZ_EE_REVISION: ${{ github.event.inputs.HZ_EE_REVISION }}
19+
secrets: inherit
1820

19-
push:
20-
runs-on: ubuntu-latest
21-
needs: jdks
22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
jdk: ${{ fromJSON(needs.jdks.outputs.jdks) }}
26-
env:
27-
HZ_VERSION : ${{ inputs.HZ_VERSION }}
28-
NLC_IMAGE_NAME: ${{ secrets.NLC_IMAGE_NAME }}
29-
S3_NLC_URL: ${{ secrets.S3_NLC_URL }}
30-
steps:
31-
- name: Checkout Code
32-
uses: actions/checkout@v4
33-
34-
- name: Configure AWS credentials
35-
uses: aws-actions/configure-aws-credentials@v4
36-
with:
37-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
38-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
39-
aws-region: 'us-east-1'
40-
41-
- name: Get presigned NLC URL from S3
42-
run: |
43-
ZIP_NAME=hazelcast-enterprise-${HZ_VERSION}-nlc.zip
44-
S3_NLC_ZIP_URL=${S3_NLC_URL}/snapshot/${ZIP_NAME}
45-
46-
HAZELCAST_ZIP_URL="$(aws s3 presign ${S3_NLC_ZIP_URL} --expires-in 600)"
47-
echo "HAZELCAST_ZIP_URL=${HAZELCAST_ZIP_URL}" >> $GITHUB_ENV
48-
49-
- name: Login to Docker Hub
50-
uses: docker/login-action@v3
51-
with:
52-
registry: ${{ secrets.NLC_REPOSITORY }}
53-
username: ${{ secrets.NLC_REPO_USERNAME }}
54-
password: ${{ secrets.NLC_REPO_TOKEN }}
55-
56-
- name: Set up QEMU
57-
uses: docker/setup-qemu-action@v3.6.0
58-
59-
- name: Set up Docker Buildx
60-
uses: docker/setup-buildx-action@v3
61-
with:
62-
version: v0.5.1
63-
64-
- name: Build EE image
65-
run: |
66-
docker buildx build --load \
67-
--build-arg HZ_VERSION=${HZ_VERSION} \
68-
--build-arg HAZELCAST_ZIP_URL=${HAZELCAST_ZIP_URL} \
69-
--build-arg JDK_VERSION=${{ matrix.jdk }} \
70-
--label hazelcast.ee.revision=${{ inputs.HZ_EE_REVISION }} \
71-
--tag hazelcast-nlc:test hazelcast-enterprise
72-
73-
- name: Run smoke test against EE image
74-
timeout-minutes: 2
75-
run: |
76-
export HZ_INSTANCETRACKING_FILENAME=instance-tracking.txt
77-
.github/scripts/simple-smoke-test.sh hazelcast-nlc:test "${{ env.test_container_name_ee }}" ee ${HZ_VERSION} "${{ matrix.jdk }}"
78-
79-
- name: Get docker logs
80-
if: ${{ always() }}
81-
run: |
82-
DOCKER_LOG_FILE_EE=docker-${{ env.test_container_name_ee }}-jdk${{ matrix.jdk }}.log
83-
echo "DOCKER_LOG_FILE_EE=${DOCKER_LOG_FILE_EE}" >> $GITHUB_ENV
84-
docker logs "${{ env.test_container_name_ee }}" > "${DOCKER_LOG_FILE_EE}"
85-
86-
- name: Store docker logs as artifact
87-
if: ${{ always() }}
88-
uses: actions/upload-artifact@v4
89-
with:
90-
name: docker-logs-${{ github.job }}-jdk${{ matrix.jdk }}
91-
path: |
92-
${{ env.DOCKER_LOG_FILE_EE }}
93-
94-
- name: Build/Push EE image
95-
run: |
96-
. .github/scripts/get-tags-to-push.sh
97-
. .github/scripts/docker.functions.sh
98-
99-
DOCKER_DIR=hazelcast-enterprise
100-
IMAGE_NAME=${NLC_IMAGE_NAME}
101-
DEFAULT_JDK="$(get_default_jdk $DOCKER_DIR)"
102-
103-
TAGS_TO_PUSH=$(augment_with_suffixed_tags "$HZ_VERSION" "" "${{ matrix.jdk }}" "$DEFAULT_JDK")
104-
echo "TAGS_TO_PUSH=$TAGS_TO_PUSH"
105-
TAGS_ARG=""
106-
for tag in ${TAGS_TO_PUSH[@]}
107-
do
108-
TAGS_ARG="${TAGS_ARG} --tag ${IMAGE_NAME}:${tag}"
109-
done
110-
111-
PLATFORMS="$(get_ubi_supported_platforms "${{ matrix.jdk }}")"
112-
docker buildx build --push \
113-
--build-arg HZ_VERSION=${HZ_VERSION} \
114-
--build-arg JDK_VERSION=${{ matrix.jdk }} \
115-
--build-arg HAZELCAST_ZIP_URL=${HAZELCAST_ZIP_URL} \
116-
--label hazelcast.ee.revision=${{ inputs.HZ_EE_REVISION }} \
117-
${TAGS_ARG} \
118-
--platform=${PLATFORMS} $DOCKER_DIR
119-
- name: Check RedHat service status
120-
if: failure()
121-
uses: ./.github/actions/check-redhat-service-status
122-
- name: Slack notification
123-
uses: ./.github/actions/slack-notification
124-
if: failure()
125-
with:
126-
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)