diff --git a/.github/workflows/build-push-container-images.yml b/.github/workflows/build-push-container-images.yml index f9effc416..5bc366450 100644 --- a/.github/workflows/build-push-container-images.yml +++ b/.github/workflows/build-push-container-images.yml @@ -28,17 +28,18 @@ jobs: java: - '17' project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - - rest-narration - - grpc-locations - - ui-super-heroes + - { name: event-statistics } + - { name: rest-fights } + - { name: rest-heroes } + - { name: rest-villains } + - { name: rest-narration } + - { name: rest-narration, openai-type: azure-openai } + - { name: grpc-locations } + - { name: ui-super-heroes } arch: - amd64 - arm64 - name: "Build JVM images (${{ matrix.arch }}-${{ matrix.project }}-java${{ matrix.java }})" + name: "Build JVM images (${{ matrix.arch }}-${{ matrix.project.name }}-java${{ matrix.java }}-${{ matrix.project.openai-type }})" steps: - name: Calculate Branch (workflow_run event) if: github.event_name == 'workflow_run' @@ -65,7 +66,7 @@ jobs: cache: maven - name: Create env vars - working-directory: ${{ matrix.project }} + working-directory: ${{ matrix.project.name }} run: | echo "QUARKUS_VERSION=$(./mvnw help:evaluate -Dexpression=quarkus.platform.version -q -DforceStdout)" >> $GITHUB_ENV && echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV && @@ -75,9 +76,15 @@ jobs: echo "JVM_DOCKERFILE=Dockerfile.jvm${{ matrix.java }}" >> "$GITHUB_ENV" fi - - name: Create container tags - working-directory: ${{ matrix.project }} - run: echo "CONTAINER_TAG=${{ env.APP_VERSION }}-quarkus-${{ env.QUARKUS_VERSION }}-java${{ matrix.java }}" >> $GITHUB_ENV + - name: Create OpenAI env vars + if: matrix.project.openai-type + working-directory: ${{ matrix.project.name }} + run: echo "QUARKUS_PROFILE=${{ matrix.project.openai-type }}" >> $GITHUB_ENV + + - name: Create CONTAINER_TAG + working-directory: .github/workflows/scripts + shell: bash + run: echo "CONTAINER_TAG=$(./compute-container-tag.sh ${{ env.APP_VERSION }} ${{ env.QUARKUS_VERSION }} "" ${{ matrix.java }} "${{ matrix.project.openai-type }}")" >> $GITHUB_ENV - name: Set up QEMU if: matrix.arch == 'arm64' @@ -90,8 +97,8 @@ jobs: with: install: true - - name: Build JVM image (${{ matrix.project }}-java${{ matrix.java }}-${{ matrix.arch }}) - working-directory: ${{ matrix.project }} + - name: Build JVM image (${{ matrix.project.name }}-java${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.project.openai-type }}) + working-directory: ${{ matrix.project.name }} run: | ./mvnw -B clean package -DskipTests \ -Dmaven.compiler.release=${{ matrix.java }} \ @@ -102,10 +109,10 @@ jobs: -Dquarkus.docker.dockerfile-jvm-path=src/main/docker/${{ env.JVM_DOCKERFILE }} \ -Dquarkus.docker.buildx.platform=linux/${{ matrix.arch }} - - name: Save JVM Image (${{ matrix.project }}-java${{ matrix.java }}-${{ matrix.arch }}) + - name: Save JVM Image (${{ matrix.project.name }}-java${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.project.openai-type }}) uses: ishworkh/docker-image-artifact-upload@v1 with: - image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}" + image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}" build-native-images: if: ((github.event_name == 'workflow_dispatch') || ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success'))) && ((github.repository == 'quarkusio/quarkus-super-heroes') && ((github.event.workflow_run.head_branch == 'main'))) @@ -116,17 +123,18 @@ jobs: java: - '17' project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - - rest-narration - - grpc-locations - - ui-super-heroes + - { name: event-statistics } + - { name: rest-fights } + - { name: rest-heroes } + - { name: rest-villains } + - { name: rest-narration } + - { name: rest-narration, openai-type: azure-openai } + - { name: grpc-locations } + - { name: ui-super-heroes } arch: - amd64 - arm64 - name: "Build Native images (${{ matrix.arch }}-${{ matrix.project }}-java${{ matrix.java }})" + name: "Build Native images (${{ matrix.arch }}-${{ matrix.project.name }}-java${{ matrix.java }}-${{ matrix.project.openai-type }})" steps: - name: Calculate Branch (workflow_run event) if: github.event_name == 'workflow_run' @@ -153,14 +161,20 @@ jobs: cache: maven - name: Create env vars - working-directory: ${{ matrix.project }} + working-directory: ${{ matrix.project.name }} run: | echo "QUARKUS_VERSION=$(./mvnw help:evaluate -Dexpression=quarkus.platform.version -q -DforceStdout)" >> $GITHUB_ENV && \ echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - name: Create container tags - working-directory: ${{ matrix.project }} - run: echo "CONTAINER_TAG=${{ env.APP_VERSION }}-quarkus-${{ env.QUARKUS_VERSION }}-native" >> $GITHUB_ENV + - name: Create OpenAI env vars + if: matrix.project.openai-type + working-directory: ${{ matrix.project.name }} + run: echo "QUARKUS_PROFILE=${{ matrix.project.openai-type }}" >> $GITHUB_ENV + + - name: Create CONTAINER_TAG + working-directory: .github/workflows/scripts + shell: bash + run: echo "CONTAINER_TAG=$(./compute-container-tag.sh ${{ env.APP_VERSION }} ${{ env.QUARKUS_VERSION }} "native-" ${{ matrix.java }} "${{ matrix.project.openai-type }}")" >> $GITHUB_ENV - name: Set up QEMU if: matrix.arch == 'arm64' @@ -173,8 +187,8 @@ jobs: with: install: true - - name: Build native image (${{ matrix.project }}-java${{ matrix.java }}-${{ matrix.arch }}) - working-directory: ${{ matrix.project }} + - name: Build native image (${{ matrix.project.name }}-java${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.project.openai-type }}) + working-directory: ${{ matrix.project.name }} run: | ./mvnw -B clean package -DskipTests -Pnative \ -Dmaven.compiler.release=${{ matrix.java }} \ @@ -187,10 +201,10 @@ jobs: -Dquarkus.container-image.tag=${{ env.CONTAINER_TAG }}-${{ matrix.arch }} \ -Dquarkus.docker.buildx.platform=linux/${{ matrix.arch }} - - name: Save native Image (${{ matrix.project }}-java${{ matrix.java }}-${{ matrix.arch }}) + - name: Save native Image (${{ matrix.project.name }}-java${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.project.openai-type }}) uses: ishworkh/docker-image-artifact-upload@v1 with: - image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}" + image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}" push-app-images: if: ((github.event_name == 'workflow_dispatch') || ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success'))) && ((github.repository == 'quarkusio/quarkus-super-heroes') && ((github.event.workflow_run.head_branch == 'main'))) @@ -206,17 +220,18 @@ jobs: - "" - "native-" project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - - rest-narration - - grpc-locations - - ui-super-heroes + - { name: event-statistics } + - { name: rest-fights } + - { name: rest-heroes } + - { name: rest-villains } + - { name: rest-narration } + - { name: rest-narration, openai-type: azure-openai } + - { name: grpc-locations } + - { name: ui-super-heroes } arch: - amd64 - arm64 - name: "Push app images (${{ matrix.arch }}-${{ matrix.project }}-${{ matrix.kind }}java${{ matrix.java }})" + name: "Push app images (${{ matrix.arch }}-${{ matrix.project.name }}-${{ matrix.kind }}java${{ matrix.java }}-${{ matrix.project.openai-type }})" steps: - name: Calculate Branch (workflow_run event) if: github.event_name == 'workflow_run' @@ -243,45 +258,25 @@ jobs: cache: maven - name: Create env vars - working-directory: ${{ matrix.project }} + working-directory: ${{ matrix.project.name }} run: | echo "QUARKUS_VERSION=$(./mvnw help:evaluate -Dexpression=quarkus.platform.version -q -DforceStdout)" >> $GITHUB_ENV && echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - name: Create CONTAINER_TAG (JVM) - if: matrix.kind == '' - working-directory: ${{ matrix.project }} - run: echo "CONTAINER_TAG=${{ env.APP_VERSION }}-quarkus-${{ env.QUARKUS_VERSION }}-${{ matrix.kind }}java${{ matrix.java }}" >> $GITHUB_ENV - - - name: Create CONTAINER_TAG (native) - if: matrix.kind == 'native-' - working-directory: ${{ matrix.project }} - run: echo "CONTAINER_TAG=${{ env.APP_VERSION }}-quarkus-${{ env.QUARKUS_VERSION }}-native" >> $GITHUB_ENV - - - name: Create ADDITIONAL_TAG (JVM - main branch) - if: (env.BRANCH == 'main') && (matrix.kind == '') - working-directory: ${{ matrix.project }} - run: echo "ADDITIONAL_TAG=${{ matrix.kind }}java${{ matrix.java }}-${{ env.LATEST_IMAGE_TAG }}" >> $GITHUB_ENV - - - name: Create ADDITIONAL_TAG (JVM - other branch) - if: (env.BRANCH != 'main') && (matrix.kind == '') - working-directory: ${{ matrix.project }} - run: echo "ADDITIONAL_TAG=${{ matrix.kind }}java${{ matrix.java }}-${{ env.LATEST_IMAGE_TAG }}-${{ env.BRANCH }}" >> $GITHUB_ENV - - - name: Create ADDITIONAL_TAG (Native - main branch) - if: (env.BRANCH == 'main') && (matrix.kind == 'native-') - working-directory: ${{ matrix.project }} - run: echo "ADDITIONAL_TAG=${{ matrix.kind }}${{ env.LATEST_IMAGE_TAG }}" >> $GITHUB_ENV - - - name: Create ADDITIONAL_TAG (Native - other branch) - if: (env.BRANCH != 'main') && (matrix.kind == 'native-') - working-directory: ${{ matrix.project }} - run: echo "ADDITIONAL_TAG=${{ matrix.kind }}${{ env.LATEST_IMAGE_TAG }}-${{ env.BRANCH }}" >> $GITHUB_ENV - - - name: Get saved images (${{ matrix.project }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}) + - name: Create CONTAINER_TAG + working-directory: .github/workflows/scripts + shell: bash + run: echo "CONTAINER_TAG=$(./compute-container-tag.sh ${{ env.APP_VERSION }} ${{ env.QUARKUS_VERSION }} "${{ matrix.kind }}" ${{ matrix.java }} "${{ matrix.project.openai-type }}")" >> $GITHUB_ENV + + - name: Create ADDITIONAL_TAG + working-directory: .github/workflows/scripts + shell: bash + run: echo "ADDITIONAL_TAG=$(./compute-additional-tag.sh "${{ matrix.kind }}" ${{ matrix.java }} ${{ env.LATEST_IMAGE_TAG }} ${{ env.BRANCH }} "${{ matrix.project.openai-type }}")" >> $GITHUB_ENV + + - name: Get saved images (${{ matrix.project.name }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}) uses: ishworkh/docker-image-artifact-download@v1 with: - image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}" + image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}" - name: Login to quay uses: docker/login-action@v3 @@ -291,12 +286,12 @@ jobs: password: ${{ secrets.QUAY_REPO_TOKEN }} - name: Tag image - working-directory: ${{ matrix.project }} - run: "docker tag ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }} ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.ADDITIONAL_TAG }}-${{ matrix.arch }}" + working-directory: ${{ matrix.project.name }} + run: "docker tag ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }} ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.ADDITIONAL_TAG }}-${{ matrix.arch }}" - name: Push images - working-directory: ${{ matrix.project }} - run: "docker push -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}" + working-directory: ${{ matrix.project.name }} + run: "docker push -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}" create-app-multiarch-manifests: if: ((github.event_name == 'workflow_dispatch') || ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success'))) && ((github.repository == 'quarkusio/quarkus-super-heroes') && ((github.event.workflow_run.head_branch == 'main'))) @@ -310,16 +305,17 @@ jobs: - "" - "native-" project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - - rest-narration - - grpc-locations - - ui-super-heroes - name: Create app multiarch manifests (${{ matrix.project }}-${{ matrix.kind }}java${{ matrix.java }}) + - { name: event-statistics } + - { name: rest-fights } + - { name: rest-heroes } + - { name: rest-villains } + - { name: rest-narration } + - { name: rest-narration, openai-type: azure-openai } + - { name: grpc-locations } + - { name: ui-super-heroes } + name: Create app multiarch manifests (${{ matrix.project.name }}-${{ matrix.kind }}java${{ matrix.java }}-${{ matrix.project.openai-type }}) steps: - - name: Calculate Branch (workflow_run event) + - name: Calculate Branch (workflow_run) if: github.event_name == 'workflow_run' run: | echo "REF=${{ github.event.workflow_run.head_commit.id }}" >> $GITHUB_ENV @@ -344,40 +340,20 @@ jobs: cache: maven - name: Create env vars - working-directory: ${{ matrix.project }} + working-directory: ${{ matrix.project.name }} run: | echo "QUARKUS_VERSION=$(./mvnw help:evaluate -Dexpression=quarkus.platform.version -q -DforceStdout)" >> $GITHUB_ENV && echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - name: Create CONTAINER_TAG (JVM) - if: matrix.kind == '' - working-directory: ${{ matrix.project }} - run: echo "CONTAINER_TAG=${{ env.APP_VERSION }}-quarkus-${{ env.QUARKUS_VERSION }}-${{ matrix.kind }}java${{ matrix.java }}" >> $GITHUB_ENV - - - name: Create CONTAINER_TAG (native) - if: matrix.kind == 'native-' - working-directory: ${{ matrix.project }} - run: echo "CONTAINER_TAG=${{ env.APP_VERSION }}-quarkus-${{ env.QUARKUS_VERSION }}-native" >> $GITHUB_ENV - - - name: Create ADDITIONAL_TAG (JVM - main branch) - if: (env.BRANCH == 'main') && (matrix.kind == '') - working-directory: ${{ matrix.project }} - run: echo "ADDITIONAL_TAG=${{ matrix.kind }}java${{ matrix.java }}-${{ env.LATEST_IMAGE_TAG }}" >> $GITHUB_ENV - - - name: Create ADDITIONAL_TAG (JVM - other branch) - if: (env.BRANCH != 'main') && (matrix.kind == '') - working-directory: ${{ matrix.project }} - run: echo "ADDITIONAL_TAG=${{ matrix.kind }}java${{ matrix.java }}-${{ env.LATEST_IMAGE_TAG }}-${{ env.BRANCH }}" >> $GITHUB_ENV - - - name: Create ADDITIONAL_TAG (Native - main branch) - if: (env.BRANCH == 'main') && (matrix.kind == 'native-') - working-directory: ${{ matrix.project }} - run: echo "ADDITIONAL_TAG=${{ matrix.kind }}${{ env.LATEST_IMAGE_TAG }}" >> $GITHUB_ENV + - name: Create CONTAINER_TAG + working-directory: .github/workflows/scripts + shell: bash + run: echo "CONTAINER_TAG=$(./compute-container-tag.sh ${{ env.APP_VERSION }} ${{ env.QUARKUS_VERSION }} "${{ matrix.kind }}" ${{ matrix.java }} "${{ matrix.project.openai-type }}")" >> $GITHUB_ENV - - name: Create ADDITIONAL_TAG (Native - other branch) - if: (env.BRANCH != 'main') && (matrix.kind == 'native-') - working-directory: ${{ matrix.project }} - run: echo "ADDITIONAL_TAG=${{ matrix.kind }}${{ env.LATEST_IMAGE_TAG }}-${{ env.BRANCH }}" >> $GITHUB_ENV + - name: Create ADDITIONAL_TAG + working-directory: .github/workflows/scripts + shell: bash + run: echo "ADDITIONAL_TAG=$(./compute-additional-tag.sh "${{ matrix.kind }}" ${{ matrix.java }} ${{ env.LATEST_IMAGE_TAG }} ${{ env.BRANCH }} "${{ matrix.project.openai-type }}")" >> $GITHUB_ENV - name: Login to quay uses: docker/login-action@v3 @@ -386,22 +362,21 @@ jobs: username: ${{ secrets.QUAY_REPO_USERNAME }} password: ${{ secrets.QUAY_REPO_TOKEN }} - - name: Create and push multi-arch JVM manifests + - name: Create and push multi-arch manifests shell: bash run: | - docker manifest create ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }} \ - -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-amd64 \ - -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-arm64 - docker manifest push ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }} - docker manifest create ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.ADDITIONAL_TAG }} \ - -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.ADDITIONAL_TAG }}-amd64 \ - -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.ADDITIONAL_TAG }}-arm64 - docker manifest push ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.ADDITIONAL_TAG }} + docker manifest create ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.CONTAINER_TAG }} \ + -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.CONTAINER_TAG }}-amd64 \ + -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.CONTAINER_TAG }}-arm64 + docker manifest push ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.CONTAINER_TAG }} + docker manifest create ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.ADDITIONAL_TAG }} \ + -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.ADDITIONAL_TAG }}-amd64 \ + -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.ADDITIONAL_TAG }}-arm64 + docker manifest push ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project.name }}:${{ env.ADDITIONAL_TAG }} deploy-resources-workflow-run: if: ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success') && (github.repository == 'quarkusio/quarkus-super-heroes')) && ((github.event.workflow_run.head_branch == 'main')) - needs: - - create-app-multiarch-manifests + needs: create-app-multiarch-manifests uses: quarkusio/quarkus-super-heroes/.github/workflows/create-deploy-resources.yml@main secrets: inherit with: @@ -410,8 +385,7 @@ jobs: deploy-resources-workflow-dispatch: if: ((github.event_name == 'workflow_dispatch') && (github.repository == 'quarkusio/quarkus-super-heroes')) && ((github.ref_name == 'main')) - needs: - - create-app-multiarch-manifests + needs: create-app-multiarch-manifests uses: quarkusio/quarkus-super-heroes/.github/workflows/create-deploy-resources.yml@main secrets: inherit with: diff --git a/.github/workflows/scripts/compute-additional-tag.sh b/.github/workflows/scripts/compute-additional-tag.sh new file mode 100755 index 000000000..d9c78251b --- /dev/null +++ b/.github/workflows/scripts/compute-additional-tag.sh @@ -0,0 +1,34 @@ +#!/bin/bash -e + +#################### +# Create the ADDITIONAL_TAG that should be used + +if [[ $# -lt 4 ]]; then + echo "$0: Should have at least 4 arguments: [kind java_version latest_image_tag branch]" + exit 1 +fi + +kind=$1 +java_version=$2 +latest_image_tag=$3 +branch=$4 + +additional_tag="${kind}" + +if [[ "$kind" == "native-" ]]; then + additional_tag="${additional_tag}${latest_image_tag}" +else + additional_tag="${additional_tag}java${java_version}-${latest_image_tag}" +fi + +if [[ "$branch" != "main" ]]; then + additional_tag="${additional_tag}-${branch}" +fi + +if [[ $# -eq 5 && $5 != "" ]]; then + # They specified an openai type + openai_type=$5 + additional_tag="${additional_tag}-${openai_type}" +fi + +echo "$additional_tag" \ No newline at end of file diff --git a/.github/workflows/scripts/compute-container-tag.sh b/.github/workflows/scripts/compute-container-tag.sh new file mode 100755 index 000000000..1eea9ff6b --- /dev/null +++ b/.github/workflows/scripts/compute-container-tag.sh @@ -0,0 +1,30 @@ +#!/bin/bash -e + +#################### +# Create the CONTAINER_TAG that should be used + +if [[ $# -lt 4 ]]; then + echo "$0: Should have at least 4 arguments: [app_version quarkus_version kind java_version]" + exit 1 +fi + +app_version=$1 +quarkus_version=$2 +kind=$3 +java_version=$4 + +container_tag="${app_version}-quarkus-${quarkus_version}" + +if [[ "$kind" == "native-" ]]; then + container_tag="${container_tag}-native" +else + container_tag="${container_tag}-${kind}java${java_version}" +fi + +if [[ $# -eq 5 && $5 != "" ]]; then + # They specified an openai type + openai_type=$5 + container_tag="${container_tag}-${openai_type}" +fi + +echo "$container_tag" \ No newline at end of file diff --git a/.github/workflows/simple-build-test.yml b/.github/workflows/simple-build-test.yml index 5a3cb0735..a90413c23 100644 --- a/.github/workflows/simple-build-test.yml +++ b/.github/workflows/simple-build-test.yml @@ -59,14 +59,15 @@ jobs: java: - '17' project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - - rest-narration - - grpc-locations - - ui-super-heroes - name: "build-test-${{ matrix.project }}-${{ matrix.java }}" + - { name: event-statistics } + - { name: rest-fights } + - { name: rest-heroes } + - { name: rest-villains } + - { name: rest-narration } + - { name: rest-narration, openai-type: azure-openai } + - { name: grpc-locations } + - { name: ui-super-heroes } + name: "build-test-${{ matrix.project.name }}-${{ matrix.java }}-${{ matrix.project.openai-type }}" steps: - uses: actions/checkout@v4 @@ -77,19 +78,15 @@ jobs: distribution: temurin cache: maven - - name: "build-test-jvm-${{ matrix.project }}-java-${{ matrix.java }}" - working-directory: ${{ matrix.project }} + - name: Create env vars + if: matrix.project.openai-type + working-directory: ${{ matrix.project.name }} run: | - ./mvnw -B clean verify \ - -Dquarkus.http.host=0.0.0.0 \ - -Dmaven.compiler.release=${{ matrix.java }} + echo "QUARKUS_PROFILE=${{ matrix.project.openai-type }}" >> $GITHUB_ENV && \ + echo "QUARKUS_TEST_INTEGRATION_TEST_PROFILE=${{ matrix.project.openai-type }}" >> $GITHUB_ENV - - name: Build/test with Azure OpenAI - if: matrix.project == 'rest-narration' - working-directory: ${{ matrix.project }} - env: - QUARKUS_PROFILE: azure-openai - QUARKUS_TEST_INTEGRATION_TEST_PROFILE: azure-openai + - name: "build-test-jvm-${{ matrix.project.name }}-java-${{ matrix.java }}-${{ matrix.project.openai-type }}" + working-directory: ${{ matrix.project.name }} run: | ./mvnw -B clean verify \ -Dquarkus.http.host=0.0.0.0 \ @@ -104,14 +101,15 @@ jobs: java: - '17' project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - - rest-narration - - grpc-locations - - ui-super-heroes - name: "native-build-test-${{ matrix.project }}" + - { name: event-statistics } + - { name: rest-fights } + - { name: rest-heroes } + - { name: rest-villains } + - { name: rest-narration } + - { name: rest-narration, openai-type: azure-openai } + - { name: grpc-locations } + - { name: ui-super-heroes } + name: "native-build-test-${{ matrix.project.name }}-${{ matrix.project.openai-type }}" steps: - uses: actions/checkout@v4 @@ -140,19 +138,15 @@ jobs: architecture: x64 cache: maven - - name: "build-test-native-${{ matrix.project }}-java-${{ matrix.java }}" - working-directory: ${{ matrix.project }} + - name: Create env vars + if: matrix.project.openai-type + working-directory: ${{ matrix.project.name }} run: | - ./mvnw -B clean verify -Pnative \ - -Dquarkus.http.host=0.0.0.0 \ - -Dmaven.compiler.release=${{ matrix.java }} + echo "QUARKUS_PROFILE=${{ matrix.project.openai-type }}" >> $GITHUB_ENV && \ + echo "QUARKUS_TEST_INTEGRATION_TEST_PROFILE=${{ matrix.project.openai-type }}" >> $GITHUB_ENV - - name: Build/test with Azure OpenAI - if: matrix.project == 'rest-narration' - working-directory: ${{ matrix.project }} - env: - QUARKUS_PROFILE: azure-openai - QUARKUS_TEST_INTEGRATION_TEST_PROFILE: azure-openai + - name: "build-test-native-${{ matrix.project.name }}-java-${{ matrix.java }}-${{ matrix.project.openai-type }}" + working-directory: ${{ matrix.project.name }} run: | ./mvnw -B clean verify -Pnative \ -Dquarkus.http.host=0.0.0.0 \