Skip to content

Commit

Permalink
Test JDK version as part of PR builder [DI-317] (#816)
Browse files Browse the repository at this point in the history
Adds additional assertion to the PR builder smoke test that the JDK is
the version expected for the image.

This is currently a _manual, post release_ check, moving earlier in the
cycle to catch defects earlier.

Fixes: [DI-317](https://hazelcast.atlassian.net/browse/DI-317)

Post merge actions:
- [ ] backport
- [ ] _Discuss_ if we remove the manual, post-release check?

[DI-317]:
https://hazelcast.atlassian.net/browse/DI-317?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
JackPGreen authored Nov 5, 2024
1 parent d5dfeae commit 07d456a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 11 deletions.
15 changes: 15 additions & 0 deletions .github/scripts/simple-smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ function stop_container() {
docker stop "${container_name}"
}

function check_java_version() {
local expected_major_version=$1
local actual_major_version
actual_major_version=$(docker run --rm "${image}" sh -c 'java -version 2>&1 | head -n 1 | awk -F "\"" "{print \$2}" | awk -F "." "{print \$1}"')

if [[ "${expected_major_version}" == "${actual_major_version}" ]]; then
echo "Expected Java version (${expected_distribution_type}) identified."
else
echoerr "Expected Java version '${expected_major_version}' but got '${actual_major_version}'"
exit 1;
fi
}

function derive_expected_distribution_type() {
local input_distribution_type=$1

Expand All @@ -50,6 +63,7 @@ image=$1
container_name=$2
input_distribution_type=$3
expected_version=$4
expected_java_major_version=$5


remove_container_if_exists
Expand All @@ -59,3 +73,4 @@ trap stop_container EXIT

expected_distribution_type=$(derive_expected_distribution_type "${input_distribution_type}")
test_package "${expected_distribution_type}" "${expected_version}"
check_java_version "${expected_java_major_version}"
12 changes: 7 additions & 5 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ jobs:
- name: Run smoke test against OSS image
timeout-minutes: 2
run: |
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ needs.prepare.outputs.HZ_VERSION_OSS }}
run: |
. .github/scripts/docker.functions.sh
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ needs.prepare.outputs.HZ_VERSION_OSS }} "$(get_default_jdk hazelcast-oss)"
- name: Build Test EE image
run: |
Expand All @@ -99,8 +100,9 @@ jobs:
- name: Run smoke test against EE image
timeout-minutes: 2
run: |
. .github/scripts/docker.functions.sh
export HZ_LICENSEKEY=${{ secrets.HZ_ENTERPRISE_LICENSE }}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ needs.prepare.outputs.HZ_VERSION_EE }}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ needs.prepare.outputs.HZ_VERSION_EE }} "$(get_default_jdk hazelcast-enterprise)"
- name: Get docker logs
if: ${{ always() }}
Expand Down Expand Up @@ -159,7 +161,7 @@ jobs:
- name: Run smoke test against OSS image
timeout-minutes: 2
run: |
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ needs.prepare.outputs.HZ_VERSION_OSS }}
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ needs.prepare.outputs.HZ_VERSION_OSS }} ${{ matrix.jdk }}
- name: Build Test EE image
run: |
Expand All @@ -177,7 +179,7 @@ jobs:
timeout-minutes: 2
run: |
export HZ_LICENSEKEY=${{ secrets.HZ_ENTERPRISE_LICENSE }}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ needs.prepare.outputs.HZ_VERSION_EE }}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ needs.prepare.outputs.HZ_VERSION_EE }} ${{ matrix.jdk }}
- name: Get docker logs
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ee-nlc-snapshot-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
timeout-minutes: 2
run: |
export HZ_INSTANCETRACKING_FILENAME=instance-tracking.txt
.github/scripts/simple-smoke-test.sh hazelcast-nlc:test ${{ env.test_container_name_ee }} ee ${HZ_VERSION}
.github/scripts/simple-smoke-test.sh hazelcast-nlc:test ${{ env.test_container_name_ee }} ee ${HZ_VERSION} ${{ matrix.jdk }}
- name: Get docker logs
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ee-nlc-tag-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
timeout-minutes: 2
run: |
export HZ_INSTANCETRACKING_FILENAME=instance-tracking.txt
.github/scripts/simple-smoke-test.sh hazelcast-nlc:test ${{ env.test_container_name_ee }} ee ${HZ_VERSION}
.github/scripts/simple-smoke-test.sh hazelcast-nlc:test ${{ env.test_container_name_ee }} ee ${HZ_VERSION} ${{ matrix.jdk }}
- name: Get docker logs
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ee_latest_snapshot_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
timeout-minutes: 2
run: |
export HZ_LICENSEKEY=${{ secrets.HZ_ENTERPRISE_LICENSE }}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${HZ_VERSION}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${HZ_VERSION} ${{ matrix.jdk }}
- name: Get docker logs
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/oss_latest_snapshot_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Run smoke test against OSS image
timeout-minutes: 2
run: |
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${HZ_VERSION}
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${HZ_VERSION} ${{ matrix.jdk }}
- name: Get docker logs
if: ${{ always() }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tag_image_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
if: needs.prepare.outputs.should_build_oss == 'yes'
timeout-minutes: 2
run: |
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ env.HZ_VERSION }}
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ env.HZ_VERSION }} ${{ matrix.jdk }}
- name: Get EE dist ZIP URL
if: needs.prepare.outputs.should_build_ee == 'yes'
Expand All @@ -195,7 +195,7 @@ jobs:
timeout-minutes: 2
run: |
export HZ_LICENSEKEY=${{ secrets.HZ_ENTERPRISE_LICENSE }}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ env.HZ_VERSION }}
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ env.HZ_VERSION }} ${{ matrix.jdk }}
- name: Get docker logs
if: ${{ always() }}
Expand Down

0 comments on commit 07d456a

Please sign in to comment.