Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/test-download-hz-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test download-hz-dist action

on:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
distribution:
- hazelcast
- hazelcast-enterprise
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Download ${{ matrix.distribution }}"
uses: ./download-hz-dist
id: download
with:
repo-vars-as-json: "{\n \"MAVEN_EE_RELEASE_REPO\": \"https://repository.hazelcast.com/release\",\n \"MAVEN_OSS_RELEASE_REPO\": \" \"\n}"
distribution: "${{ matrix.distribution }}"
hz_version: "5.0"
classifier: "slim"
packaging: "tar.gz"

- name: Check file exists
run: |
if [[ ! -f "${{ steps.download.outputs.output_file }}" ]]; then
echo "${{ steps.download.outputs.output_file }} not found!"
exit 1
fi
7 changes: 0 additions & 7 deletions .github/workflows/test-get-hz-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ jobs:
assert_eq "$expected" "$actual" "$msg" && log_success "$msg" || TESTS_RESULT=$?
}

assert_populated() {
local name=$1
local actual=$2
local msg="$name should not be empty"
assert_not_empty "$actual" "$msg" && log_success "$msg" || TESTS_RESULT=$?
}

assert_equals "HZ_VERSION" "1.2.3" "${{ steps.hz_versions.outputs.HZ_VERSION }}"

assert_eq 0 "$TESTS_RESULT" "All tests should pass"
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
test-check-redhat-service-status:
uses: ./.github/workflows/test-check-redhat-service-status.yml

test-download-hz-dist:
uses: ./.github/workflows/test-download-hz-dist.yml

test-get-hz-versions:
uses: ./.github/workflows/test-get-hz-versions.yml

Expand All @@ -34,6 +37,7 @@ jobs:
needs:
- test-check-base-images
- test-check-redhat-service-status
- test-download-hz-dist
- test-get-hz-versions
- test-get-supported-jdks
- test-resolve-editions
Expand Down
79 changes: 79 additions & 0 deletions download-hz-dist/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Download Hazelcast Distribution
inputs:
repo-vars-as-json:
description: 'Repo Vars as JSON - not inherited in composite actions - see https://github.com/orgs/community/discussions/49689#discussioncomment-6398261'
required: true
distribution:
description: 'Distribution type: "hazelcast" or "hazelcast-enterprise"'
required: true
hz_version:
description: 'Hazelcast version'
required: true
classifier:
description: 'Maven classifier'
required: false
packaging:
description: 'Maven packaging'
required: true
output_file:
description: 'Path to the output file'
required: false
outputs:
maven_repo_url:
description: 'The Maven repository root URL used to download the distribution'
value: ${{ steps.get_repo_url.outputs.repo_url }}
output_file:
description: 'Path to the downloaded file'
value: ${{ steps.derive-output-file.outputs.file }}
runs:
using: "composite"
steps:
- name: Get repository URL
id: get_repo_url
shell: bash
run: |
# Pick an appropriate key from "repo-vars-as-json"
case "${{ inputs.distribution }}" in
"hazelcast")
if [[ "${{ inputs.hz_version }}" == *"SNAPSHOT"* ]]; then
repo_var_name=MAVEN_OSS_SNAPSHOT_REPO
else
repo_var_name=MAVEN_OSS_RELEASE_REPO
fi
;;
"hazelcast-enterprise")
if [[ "${{ inputs.hz_version }}" == *"SNAPSHOT"* ]]; then
repo_var_name=MAVEN_EE_SNAPSHOT_REPO
else
repo_var_name=MAVEN_EE_RELEASE_REPO
fi
;;
*)
echoerr "Unsupported distribution type '${{ inputs.distribution }}'" ; return 1
;;
esac

# Lookup up the value of the selected key in "repo-vars-as-json"
echo "repo_url=$(jq --raw-output .${repo_var_name} <<< '${{ inputs.repo-vars-as-json }}')" >> ${GITHUB_OUTPUT}

- name: Derive output file
id: derive-output-file
shell: bash
run: |
echo "file=${{ inputs.output_file || format('distribution.{0}', inputs.packaging) }}" >> ${GITHUB_OUTPUT}

- name: Download via Maven
shell: bash
run: |
mvn \
org.apache.maven.plugins:maven-dependency-plugin:2.10:get \
-DremoteRepositories="${{ steps.get_repo_url.outputs.repo_url }}" \
-DgroupId="com.hazelcast" \
-DartifactId="${{ inputs.distribution }}-distribution" \
-Dversion="${{ inputs.hz_version }}" \
-Dclassifier="${{ inputs.classifier }}" \
-Dpackaging="${{ inputs.packaging }}" \
-Dtransitive=false \
-Ddest="${{ steps.derive-output-file.outputs.file }}" \
--batch-mode \
--no-transfer-progress
Loading