diff --git a/.github/workflows/test-multiarch-images.yml b/.github/workflows/test-multiarch-images.yml deleted file mode 100644 index 8b9bf2082..000000000 --- a/.github/workflows/test-multiarch-images.yml +++ /dev/null @@ -1,420 +0,0 @@ -name: Test building multi-arch images - -env: - IMAGE_BASE_NAME: "quay.io/quarkus-super-heroes" - MANDREL_IMAGE: "quay.io/quarkus/ubi-quarkus-mandrel" - MANDREL_VERSION: "22.0" - LATEST_IMAGE_TAG: "multiarch-latest" - -on: - workflow_dispatch: - -concurrency: - group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}" - cancel-in-progress: false - -jobs: - build-jvm-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.ref == 'refs/heads/main')) - runs-on: ubuntu-latest - strategy: - matrix: - java: - - '11' - - '17' - project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - arch: - - amd64 - - arm64 - name: "Build JVM images (${{ matrix.arch}}-${{ matrix.project }}-java${{ matrix.java }})" - steps: - - uses: actions/checkout@v3 - - - name: Setup Java - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java }} - distribution: temurin - cache: maven - - - name: Create env vars - working-directory: ${{ matrix.project }} - 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 && - if [[ ${{ matrix.java }} == '11' ]]; then - echo "JVM_DOCKERFILE=Dockerfile.jvm" >> "$GITHUB_ENV" - else - 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 }}-multiarch" >> $GITHUB_ENV - - - name: Build app (${{ matrix.project }}-java${{ matrix.java }}-${{ matrix.arch}}) - working-directory: ${{ matrix.project }} - run: ./mvnw -B clean package -DskipTests -Dmaven.compiler.release=${{ matrix.java }} -Dquarkus.http.host=0.0.0.0 - - - name: Set up QEMU - if: matrix.arch == 'arm64' - uses: docker/setup-qemu-action@v2 - with: - platforms: arm64 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - install: true - - - name: Build JVM image (${{ matrix.project }}-java${{ matrix.java }}-${{ matrix.arch}}) - uses: docker/build-push-action@v3 - with: - context: ${{ matrix.project }} - platforms: linux/${{ matrix.arch }} - push: false - load: true - file: ${{ matrix.project }}/src/main/docker/${{ env.JVM_DOCKERFILE }} - tags: ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }} - - - name: Save JVM Image (${{ matrix.project }}-java${{ matrix.java }}-${{ matrix.arch }}) - uses: ishworkh/docker-image-artifact-upload@v1 - with: - image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ 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.ref == 'refs/heads/main')) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - java: - - '11' - - '17' - project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - arch: - - amd64 -# - arm64 - name: "Build Native images (${{ matrix.arch}}-${{ matrix.project }}-java${{ matrix.java }})" - steps: - - uses: actions/checkout@v3 - - - name: Setup Java - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java }} - distribution: temurin - cache: maven - - - name: Create env vars - working-directory: ${{ matrix.project }} - 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-java${{ matrix.java }}-multiarch" >> $GITHUB_ENV - - - name: Build native image (${{ matrix.project }}-java${{ matrix.java }}-${{ matrix.arch}}) - working-directory: ${{ matrix.project }} - run: | - ./mvnw -B clean package -DskipTests -Pnative \ - -Dmaven.compiler.release=${{ matrix.java }} \ - -Dquarkus.http.host=0.0.0.0 \ - -Dquarkus.native.container-build=true \ - -Dquarkus.native.builder-image=${{ env.MANDREL_IMAGE }}:${{ env.MANDREL_VERSION }}-java${{ matrix.java }} \ - -Dquarkus.container-image.build=true \ - -Dquarkus.container-image.push=false \ - -Dquarkus.container-image.tag=${{ env.CONTAINER_TAG }}-${{ matrix.arch }} - - - name: Save native Image (${{ matrix.project }}-java${{ matrix.java }}-${{ matrix.arch }}) - uses: ishworkh/docker-image-artifact-upload@v1 - with: - image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}" - - build-ui-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.ref == 'refs/heads/main')) - runs-on: ubuntu-latest - strategy: - matrix: - arch: - - amd64 - - arm64 - steps: - - uses: actions/checkout@v3 - - - name: Set up QEMU - if: matrix.arch == 'arm64' - uses: docker/setup-qemu-action@v2 - with: - platforms: arm64 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - install: true - - - name: Build UI image (${{ matrix.arch }}) - uses: docker/build-push-action@v3 - with: - context: ui-super-heroes - platforms: linux/${{ matrix.arch }} - push: false - load: true - tags: ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.LATEST_IMAGE_TAG }}-${{ matrix.arch }} - - - name: Save UI image (${{ matrix.arch }}) - uses: ishworkh/docker-image-artifact-upload@v1 - with: - image: "${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.LATEST_IMAGE_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.ref == 'refs/heads/main')) - needs: - - build-jvm-images - - build-native-images - - build-ui-images - runs-on: ubuntu-latest - strategy: - matrix: - java: - - '11' - - '17' - kind: - - "" - - "native-" - project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - arch: - - amd64 - - arm64 - name: "Push app images (${{ matrix.arch}}-${{ matrix.project }}-${{ matrix.kind }}java${{ matrix.java }})" - steps: - - uses: actions/checkout@v3 - if: ((matrix.arch == 'amd64') || (matrix.kind != 'native-')) - - - name: Setup Java - if: ((matrix.arch == 'amd64') || (matrix.kind != 'native-')) - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java }} - distribution: temurin - cache: maven - - - name: Create env vars - if: ((matrix.arch == 'amd64') || (matrix.kind != 'native-')) - working-directory: ${{ matrix.project }} - 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 - if: ((matrix.arch == 'amd64') || (matrix.kind != 'native-')) - working-directory: ${{ matrix.project }} - run: | - echo "CONTAINER_TAG=${{ env.APP_VERSION }}-quarkus-${{ env.QUARKUS_VERSION }}-${{ matrix.kind }}java${{ matrix.java }}-multiarch" >> $GITHUB_ENV && - echo "ADDITIONAL_TAG=${{ matrix.kind }}java${{ matrix.java }}-${{ env.LATEST_IMAGE_TAG }}" >> $GITHUB_ENV - - - name: Get saved images (${{ matrix.project }}-${{ matrix.kind }}java${{ matrix.java }}-${{ matrix.arch }}) - if: ((matrix.arch == 'amd64') || (matrix.kind != 'native-')) - uses: ishworkh/docker-image-artifact-download@v1 - with: - image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}" - - - name: Login to quay - if: ((matrix.arch == 'amd64') || (matrix.kind != 'native-')) - uses: docker/login-action@v2 - with: - registry: quay.io - username: ${{ secrets.QUAY_REPO_USERNAME }} - password: ${{ secrets.QUAY_REPO_TOKEN }} - - - name: Tag image - if: ((matrix.arch == 'amd64') || (matrix.kind != 'native-')) - 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 }}" - - - name: Push images - if: ((matrix.arch == 'amd64') || (matrix.kind != 'native-')) - working-directory: ${{ matrix.project }} - run: "docker push -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}" - - push-ui-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.ref == 'refs/heads/main')) - needs: - - build-jvm-images - - build-native-images - - build-ui-images - runs-on: ubuntu-latest - strategy: - matrix: - arch: - - amd64 - - arm64 - steps: - - uses: actions/checkout@v3 - - - name: Setup Java - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - cache: maven - - - name: Create env vars - working-directory: ui-super-heroes - run: echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Get Saved UI Image (${{ matrix.arch }}) - uses: ishworkh/docker-image-artifact-download@v1 - with: - image: "${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.LATEST_IMAGE_TAG }}-${{ matrix.arch }}" - - - name: Login to quay - uses: docker/login-action@v2 - with: - registry: quay.io - username: ${{ secrets.QUAY_REPO_USERNAME }} - password: ${{ secrets.QUAY_REPO_TOKEN }} - - - name: Tag UI image (${{ matrix.arch }}) - working-directory: ui-super-heroes - run: docker tag ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.LATEST_IMAGE_TAG }}-${{ matrix.arch }} ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }}-multiarch-${{ matrix.arch }} - - - name: Push UI image (${{ matrix.arch }}) - working-directory: ui-super-heroes - run: "docker push -a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes" - - 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.ref == 'refs/heads/main')) - needs: push-app-images - runs-on: ubuntu-latest - strategy: - matrix: - java: - - '11' - - '17' - kind: - - "" - - "native-" - project: - - event-statistics - - rest-fights - - rest-heroes - - rest-villains - name: Create app multiarch manifests (${{ matrix.project }}-${{ matrix.kind }}java${{ matrix.java }}) - steps: - - uses: actions/checkout@v3 - - - name: Setup Java - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java }} - distribution: temurin - cache: maven - - - name: Create env vars - working-directory: ${{ matrix.project }} - 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 }}-${{ matrix.kind }}java${{ matrix.java }}-multiarch" >> $GITHUB_ENV && - echo "ADDITIONAL_TAG=${{ matrix.kind }}java${{ matrix.java }}-${{ env.LATEST_IMAGE_TAG }}" >> $GITHUB_ENV - - - name: Login to quay - uses: docker/login-action@v2 - with: - registry: quay.io - username: ${{ secrets.QUAY_REPO_USERNAME }} - password: ${{ secrets.QUAY_REPO_TOKEN }} - - - name: Create and push multi-arch JVM manifests - if: matrix.kind != 'native-' - 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 }} - - - name: Create and push single-arch native manifests - if: matrix.kind == 'native-' - 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 - 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 - docker manifest push ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.ADDITIONAL_TAG }} - - create-ui-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.ref == 'refs/heads/main')) - needs: push-ui-images - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Setup Java - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: temurin - cache: maven - - - name: Create env vars - working-directory: ui-super-heroes - run: echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Login to quay - uses: docker/login-action@v2 - with: - registry: quay.io - username: ${{ secrets.QUAY_REPO_USERNAME }} - password: ${{ secrets.QUAY_REPO_TOKEN }} - - - name: Create and push multi-arch manifests - shell: bash - run: | - docker manifest create ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.LATEST_IMAGE_TAG }} \ - -a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.LATEST_IMAGE_TAG }}-amd64 \ - -a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.LATEST_IMAGE_TAG }}-arm64 - docker manifest push ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.LATEST_IMAGE_TAG }} - docker manifest create ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }}-multiarch \ - -a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }}-multiarch-amd64 \ - -a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }}-multiarch-arm64 - docker manifest push ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }}-multiarch - - cleanup-artifacts: - needs: - - create-app-multiarch-manifests - - create-ui-multiarch-manifests - if: always() - runs-on: ubuntu-latest - steps: - - name: Delete artifacts - env: - WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} - run: | - echo "::add-mask::$WEBHOOK_SECRET" - curl --verbose --fail --show-error --location --request POST "https://api.github.com/repos/$GITHUB_REPOSITORY/dispatches" --header "Authorization: token $WEBHOOK_SECRET" --header 'Content-Type: application/json' --header 'Accept: application/vnd.github.everest-preview+json' --data-raw "{ \"event_type\": \"delete_all_artifacts\", \"client_payload\": {\"parent_runid\": \"$GITHUB_RUN_ID\", \"parent_repo\": \"$GITHUB_REPOSITORY\"} }"