Convert manual post-release test into a reusable GitHub Action [DI-316] #10
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: Test published images | |
on: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
IMAGE_VERSION: | |
required: true | |
EXPECTED_HZ_VERSION: | |
required: true | |
env: | |
CONTAINER_NAME: my-container | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
variant: | |
- '' | |
- 'slim' | |
jdk: | |
- '' | |
- jdk17 | |
- jdk21 | |
distribution_type: | |
- os | |
- ee | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Run smoke test against EE image | |
timeout-minutes: 2 | |
run: | | |
# TODO REMOVE | |
set -x | |
# TODO Make dynamic | |
#expected_hz_version=${{ inputs.EXPECTED_HZ_VERSION }} | |
expected_hz_version=5.5.0 | |
# tag_elements=("${{ inputs.IMAGE_VERSION }}") | |
tag_elements=("5.5.0") | |
if [[ -n "${{ matrix.variant }}" ]]; then | |
tag_elements+=("${{ matrix.variant }}") | |
fi | |
if [[ -n "${{ matrix.jdk }}" ]]; then | |
tag_elements+=("${{ matrix.jdk }}") | |
fi | |
echo $tag_elements | |
IFS=- ; image_tag="${tag_elements[*]}" | |
function simple-smoke-test() { | |
local organization=$1 | |
.github/scripts/simple-smoke-test.sh ${organization}/${image_name}:${image_tag} ${CONTAINER_NAME} ${{ matrix.distribution_type }} ${expected_hz_version} | |
} | |
case "${{ matrix.distribution_type }}" in | |
"os") | |
image_name="hazelcast" | |
;; | |
"ee") | |
image_name="hazelcast-enterprise" | |
simple-smoke-test quay.io/hazelcast_cloud/hazelcast-nlc | |
simple-smoke-test registry.connect.redhat.com/hazelcast/hazelcast-enterprise-5-rhel8 | |
;; | |
*) | |
echoerr "Unrecognized distribution type ${{ matrix.distribution_type }}" | |
exit 1 | |
;; | |
esac | |
# Prints the given message to stderr | |
function echoerr() { | |
echo "ERROR - $*" 1>&2; | |
} | |
simple-smoke-test hazelcast |