diff --git a/.github/workflows/reusable_build_and_test.yml b/.github/workflows/reusable_build_and_test.yml index 5afbe865..77593914 100644 --- a/.github/workflows/reusable_build_and_test.yml +++ b/.github/workflows/reusable_build_and_test.yml @@ -97,16 +97,9 @@ jobs: '\(.).cache-to=type=registry,ref=${{ env.CACHE_TARGET }}:${{ inputs.tag }}-\(.)"' >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT - - name: Set Tomcat environment variables - run: | - if [[ '${{ inputs.acs_version }}' != '23' ]]; then - echo "TOMCAT_MAJOR=9" >> $GITHUB_ENV - echo "TOMCAT_VERSION=9.0.96" >> $GITHUB_ENV - echo "TOMCAT_SHA512=ef3ac81debbc3a519c43d1fdb1c88ab26a8052af424d81bceccfbd6e663050a06d7aad7960fd5d11c17849829daebbebf33d92ac1158902283d0e534514aab93" >> $GITHUB_ENV - fi - - name: Bake Docker images env: + ACS_VERSION: ${{ inputs.acs_version }} TARGETARCH: ${{ inputs.acs_version == '23' && 'linux/amd64,linux/arm64' || 'linux/amd64' }} DOCKER_PUSH: ${{ github.actor != 'dependabot[bot]'}} uses: docker/bake-action@2e3d19baedb14545e5d41222653874f25d5b4dfb # v5.10.0 diff --git a/docker-bake.hcl b/docker-bake.hcl index aba989b8..44b2f67e 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -150,16 +150,27 @@ target "java_base" { platforms = split(",", "${TARGETARCH}") } +variable "ACS_VERSION" { + default = "23" +} + +function "determine_tomcat_version" { + params = [acs_version, tomcat10, tomcat9] + result = acs_version == "23" ? tomcat10 : tomcat9 +} + variable "TOMCAT_MAJOR" { - default = "10" + default = determine_tomcat_version("${ACS_VERSION}", "10", "9") } variable "TOMCAT_VERSION" { - default = "10.1.31" + default = determine_tomcat_version("${ACS_VERSION}", "10.1.31", "9.0.96") } variable "TOMCAT_SHA512" { - default = "0e3d423a843e2d9ba4f28a9f0a2f1073d5a1389557dfda041759f8df968bace63cd6948bd76df2727b5133ddb7c33e05dab43cea1d519ca0b6d519461152cce9" + default = determine_tomcat_version("${ACS_VERSION}", + "0e3d423a843e2d9ba4f28a9f0a2f1073d5a1389557dfda041759f8df968bace63cd6948bd76df2727b5133ddb7c33e05dab43cea1d519ca0b6d519461152cce9", + "ef3ac81debbc3a519c43d1fdb1c88ab26a8052af424d81bceccfbd6e663050a06d7aad7960fd5d11c17849829daebbebf33d92ac1158902283d0e534514aab93") } variable "TCNATIVE_VERSION" {