Skip to content

Commit

Permalink
Multi Arch images test
Browse files Browse the repository at this point in the history
push images to ghcr.io
  • Loading branch information
ozangunalp committed Feb 28, 2024
1 parent 8990e50 commit 5aa11aa
Showing 1 changed file with 48 additions and 9 deletions.
57 changes: 48 additions & 9 deletions .github/workflows/multi-arch-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,71 @@ jobs:
install: true
- name: Build with Maven
run: |
mvn -s .github/ci-maven-settings.xml -B clean package ${{ matrix.arch == 'arm64' && '-Dnative -Dquarkus.native.additional-build-args=-H:PageSize=65536' || '-Dnative' }} \
mvn -s .github/ci-maven-settings.xml -B clean package \
${{ matrix.arch == 'arm64' && '-Dnative -Dquarkus.native.additional-build-args=-H:PageSize=65536' || '-Dnative' }} \
-Dquarkus.container-image.registry=${{ env.CONTAINER_REGISTRY }} \
-Dquarkus.container-image.group=${{ env.CONTAINER_GROUP }} \
-Dquarkus.native.container-build=true \
-Dquarkus.native.container-runtime-options=--platform=linux/${{ matrix.arch }} \
-Dquarkus.docker.buildx.platform=linux/${{ matrix.arch }} \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=false \
-Dquarkus.container-image.tag=${{ env.BUILD_IMAGE_TAG }} \
-Dquarkus.container-image.additional-tags=latest-snapshot
-Dquarkus.container-image.tag=${{ env.BUILD_IMAGE_TAG }}-${{ matrix.arch }} \
-Dquarkus.container-image.additional-tags=latest-snapshot-${{ matrix.arch }}
- name: Inspect Image
run: docker inspect ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/kafka-native:${{ env.BUILD_IMAGE_TAG }}
- name: Integration Tests with Maven
run: |
mvn -s .github/ci-maven-settings.xml -B \
clean verify -Dtest-container \
mvn -s .github/ci-maven-settings.xml -B clean verify -Dtest-container \
-Dkafka-native-container-image=${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/kafka-native \
-Dkafka-native-container-version=${{ env.BUILD_IMAGE_TAG }} \
-Dkafka-native-container-version=${{ env.BUILD_IMAGE_TAG }}-${{ matrix.arch }} \
-Dzookeeper-native-container-image=${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/zookeeper-native \
-Dzookeeper-native-container-version=${{ env.BUILD_IMAGE_TAG }}
- name: Save kafka-native native image ${{ matrix.arch }}
-Dzookeeper-native-container-version=${{ env.BUILD_IMAGE_TAG }}-${{ matrix.arch }}
- name: Save kafka-native image ${{ matrix.arch }}
uses: ishworkh/[email protected]
with:
image: "${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/kafka-native:${{ env.BUILD_IMAGE_TAG }}-${{ matrix.arch }}"
- name: Save zookeeper-native native image ${{ matrix.arch }}
- name: Save zookeeper-native image ${{ matrix.arch }}
uses: ishworkh/[email protected]
with:
image: "${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/zookeeper-native:${{ env.BUILD_IMAGE_TAG }}-${{ matrix.arch }}"
- name: Push kafka-native images
working-directory: ${{ matrix.project.name }}
run: "docker push -a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/kafka-native"
- name: Push zookeeper-native images
working-directory: ${{ matrix.project.name }}
run: "docker push -a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/zookeeper-native"

create-multiarch-manifest:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
container:
- kafka-native
- zookeeper-native
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: maven
- name: Set Image Tag
run: |
echo "BUILD_IMAGE_TAG=${GITHUB_REF_NAME}-${GITHUB_SHA}" >> $GITHUB_ENV
echo "CONTAINER_REGISTRY=ghcr.io" >> $GITHUB_ENV
echo "CONTAINER_GROUP=ozangunalp" >> $GITHUB_ENV
echo "ADDITIONAL_TAG=latest-snapshot" >> $GITHUB_ENV
- name: Create and push multi-arch manifests ${{ matrix.container }}
shell: bash
run: |
docker manifest create ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.BUILD_IMAGE_TAG }} \
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.BUILD_IMAGE_TAG }}-amd64 \
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.BUILD_IMAGE_TAG }}-arm64
docker manifest push ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.BUILD_IMAGE_TAG }}
docker manifest create ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.ADDITIONAL_TAG }} \
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.ADDITIONAL_TAG }}-amd64 \
-a ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.ADDITIONAL_TAG }}-arm64
docker manifest push ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_GROUP }}/${{ matrix.container }}:${{ env.ADDITIONAL_TAG }}

0 comments on commit 5aa11aa

Please sign in to comment.