Skip to content

Commit 892003f

Browse files
authored
Merge pull request #2 from ExplorViz/multi-arch-seminar
Multi arch seminar
2 parents a18a085 + e538dee commit 892003f

File tree

7 files changed

+336
-0
lines changed

7 files changed

+336
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build and Deploy Quarkus JVM Image
2+
description: Build and deploy Quarkus JVM image to DockerHub
3+
inputs:
4+
platforms:
5+
description: Architectures for image, e.g. linux/amd64,linux/arm64/v8
6+
required: true
7+
docker-username:
8+
description: User name to log into registry
9+
required: true
10+
docker-password:
11+
description: Password to log into registry
12+
required: true
13+
image-name:
14+
description: Docker image name
15+
required: true
16+
image-tag:
17+
description: Docker image tag
18+
required: true
19+
outputs: {}
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Set up Java
24+
uses: actions/setup-java@v3
25+
with:
26+
distribution: "temurin"
27+
java-version: "21"
28+
- name: Build Quarkus JVM Image
29+
shell: sh
30+
run: |
31+
./gradlew clean assemble \
32+
-Dquarkus.container-image.build=true \
33+
-Dquarkus.container-image.push=true \
34+
-Dquarkus.jib.platforms=${{ inputs.platforms }} \
35+
-Dquarkus.container-image.name=${{ inputs.image-name }} \
36+
-Dquarkus.container-image.tag=${{ inputs.image-tag }} \
37+
-Dquarkus.container-image.username=${{ inputs.docker-username }} \
38+
-Dquarkus.container-image.password=${{ inputs.docker-password }}
39+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build and Deploy Quarkus Native Image
2+
description: Build and deploy Quarkus native image to DockerHub
3+
inputs:
4+
platforms:
5+
description: Architectures for image, e.g. linux/amd64,linux/arm64/v8
6+
required: true
7+
docker-username:
8+
description: User name to log into registry
9+
required: true
10+
docker-password:
11+
description: Password to log into registry
12+
required: true
13+
image-name:
14+
description: Docker image name
15+
required: true
16+
image-tag:
17+
description: Docker image tag
18+
required: true
19+
outputs: {}
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Set up graalvm
24+
uses: actions/setup-java@v4
25+
with:
26+
distribution: "graalvm"
27+
java-version: "21"
28+
- name: Build Quarkus Native Image
29+
shell: sh
30+
run: |
31+
./gradlew clean assemble \
32+
-Dquarkus.package.type=native \
33+
-Dquarkus.container-image.push=true \
34+
-Dquarkus.jib.platforms=${{ inputs.platforms }} \
35+
-Dquarkus.container-image.name=${{ inputs.image-name }} \
36+
-Dquarkus.container-image.tag=${{ inputs.image-tag }} \
37+
-Dquarkus.native.additional-build-args="--initialize-at-run-time=org.apache.kafka.common.security.authenticator.SaslClientAuthenticator\,org.apache.kafka.common.security.oauthbearer.internals.expiring.ExpiringCredentialRefreshingLogin" \
38+
-Dquarkus.container-image.username=${{ inputs.docker-username }} \
39+
-Dquarkus.container-image.password=${{ inputs.docker-password }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish Multi-Arch Manifest
2+
description: Publish a multi-architecture Docker manifest
3+
inputs:
4+
image-name:
5+
description: Docker image name
6+
required: true
7+
target-tag:
8+
description: Target image tag
9+
required: true
10+
outputs: {}
11+
runs:
12+
using: 'composite'
13+
steps:
14+
- name: Install Manifest Tool
15+
shell: sh
16+
run: |
17+
curl -L https://github.com/estesp/manifest-tool/releases/download/v1.0.3/manifest-tool-linux-amd64 -o /usr/local/bin/manifest-tool
18+
chmod +x /usr/local/bin/manifest-tool
19+
- name: Publish Multi-Arch Manifest
20+
shell: sh
21+
run: |
22+
manifest-tool push from-args \
23+
--platforms linux/amd64,linux/arm64/v8 \
24+
--template ${{ secrets.DOCKERHUB_ORGANIZATION }}/${{ inputs.image-name }}:ARCH \
25+
--target ${{ secrets.DOCKERHUB_ORGANIZATION }}/${{ inputs.image-name }}:${{ inputs.target-tag }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Retag DockerHub Image
2+
description: Retag a Docker image on DockerHub
3+
inputs:
4+
source-tag:
5+
description: Source image tag
6+
required: true
7+
target-tag:
8+
description: Target image tag
9+
required: true
10+
image-name:
11+
description: Docker image name
12+
required: true
13+
outputs: {}
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Install Crane
18+
shell: sh
19+
run: |
20+
curl -sSL https://github.com/google/go-containerregistry/releases/download/v0.9.0/go-containerregistry_Linux_x86_64.tar.gz | tar xz -C /usr/local/bin crane
21+
- name: Retag Image
22+
shell: sh
23+
run: |
24+
crane auth login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} index.docker.io
25+
crane cp ${{ inputs.image-name }}:${{ inputs.source-tag }} ${{ inputs.image-name }}:${{ inputs.target-tag }}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: install the quarkus-cli
2+
description: installs java and quarkus via jbang
3+
inputs:
4+
image-name:
5+
description: Docker image name
6+
required: true
7+
image-tag:
8+
description: Docker image tag
9+
required: true
10+
outputs: {}
11+
runs:
12+
using: 'composite'
13+
steps:
14+
- name: Set up graalvm
15+
uses: actions/setup-java@v4
16+
with:
17+
distribution: 'graalvm'
18+
java-version: '21'
19+
20+
- name: install quarkus-cli tool
21+
shell: sh
22+
run: |
23+
curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
24+
curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio
25+
26+
echo "$HOME/.jbang/bin:$PATH" >> $GITHUB_PATH
27+
- run: quarkus extension add container-image-docker
28+
shell: sh
29+
- run: quarkus extension add container-image-jib
30+
shell: sh

.github/workflows/ci.yaml

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- "**"
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Code
17+
uses: actions/checkout@v3
18+
- name: Set up Java
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: "graalvm"
22+
java-version: "21"
23+
- name: Cache Gradle Packages
24+
uses: actions/cache@v4
25+
with:
26+
path: ~/.gradle/caches
27+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
28+
- name: Build Project
29+
run: ./gradlew assemble
30+
env:
31+
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
32+
33+
pmd:
34+
name: PMD Analysis
35+
runs-on: ubuntu-latest
36+
needs: build
37+
steps:
38+
- name: Checkout Code
39+
uses: actions/checkout@v3
40+
- name: Set up Java
41+
uses: actions/setup-java@v4
42+
with:
43+
distribution: "graalvm"
44+
java-version: "21"
45+
- name: Cache Gradle Packages
46+
uses: actions/cache@v4
47+
with:
48+
path: ~/.gradle/caches
49+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
50+
- name: Run PMD Analysis
51+
run: ./gradlew pmdMain
52+
53+
checkstyle:
54+
name: Checkstyle Analysis
55+
runs-on: ubuntu-latest
56+
needs: build
57+
steps:
58+
- name: Checkout Code
59+
uses: actions/checkout@v3
60+
- name: Set up Java
61+
uses: actions/setup-java@v4
62+
with:
63+
distribution: "graalvm"
64+
java-version: "21"
65+
- name: Cache Gradle Packages
66+
uses: actions/cache@v4
67+
with:
68+
path: ~/.gradle/caches
69+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
70+
- name: Run Checkstyle
71+
run: ./gradlew checkstyleMain
72+
73+
unit-test:
74+
name: Unit Tests
75+
runs-on: ubuntu-latest
76+
needs: build
77+
steps:
78+
- name: Checkout Code
79+
uses: actions/checkout@v3
80+
- name: Set up Java
81+
uses: actions/setup-java@v4
82+
with:
83+
distribution: "graalvm"
84+
java-version: "21"
85+
- name: Cache Gradle Packages
86+
uses: actions/cache@v4
87+
with:
88+
path: ~/.gradle/caches
89+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
90+
- name: Run Unit Tests
91+
run: ./gradlew test
92+
93+
integration-test:
94+
name: Integration Tests
95+
runs-on: ubuntu-latest
96+
needs: build
97+
# Do not run since integration tests are not working
98+
if: false
99+
steps:
100+
- name: Checkout Code
101+
uses: actions/checkout@v3
102+
- name: Set up Java
103+
uses: actions/setup-java@v4
104+
with:
105+
distribution: "graalvm"
106+
java-version: "21"
107+
- name: Cache Gradle Packages
108+
uses: actions/cache@v4
109+
with:
110+
path: ~/.gradle/caches
111+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
112+
- name: Run Integration Tests
113+
run: ./gradlew integrationTest
114+
- uses: actions/upload-artifact@v4 # upload test results
115+
if: success() || failure() # run this step even if previous step failed
116+
with:
117+
name: test-results-integration
118+
path: build/reports/tests/integrationTest/index.html
119+
120+
# Combine test reports if needed
121+
test-report:
122+
name: Test Report
123+
runs-on: ubuntu-latest
124+
# Do not run since integration tests are not working
125+
if: false
126+
needs: [unit-test, integration-test]
127+
steps:
128+
- uses: dorny/test-reporter@v1
129+
with:
130+
artifact: /test-results-(.*)/ # artifact name
131+
name: java-junit # Name of the check run which will be created
132+
path: "*.html" # Path to test results (inside artifact .zip)
133+
reporter: jest-junit # Format of test results
134+
135+
test:
136+
name: test end node
137+
runs-on: ubuntu-latest
138+
needs: [build, pmd, checkstyle, unit-test]
139+
steps:
140+
- run: echo "finished test stage" # this is a indirection to the previous test steps
141+
142+
docker-image-native:
143+
name: Docker image native
144+
if: github.event_name == 'push' && github.ref_name == 'main'
145+
needs: [test]
146+
runs-on: ubuntu-latest
147+
steps:
148+
- name: Checkout Code
149+
uses: actions/checkout@v3
150+
- name: Build and Push Image
151+
uses: ./.github/actions/build-and-deploy-quarkus-native
152+
with:
153+
platforms: "linux/amd64,linux/arm64/v8"
154+
docker-username: ${{ secrets.DOCKER_USERNAME }}
155+
docker-password: ${{ secrets.DOCKER_PASSWORD }}
156+
image-name: ${{ vars.DOCKER_NATIVE_IMAGE_NAME }}
157+
image-tag: "latest"
158+
159+
docker-image-jvm:
160+
name: Docker image JVM
161+
if: github.event_name == 'push' && github.ref_name == 'main'
162+
needs: [test]
163+
runs-on: ubuntu-latest
164+
steps:
165+
- name: Checkout Code
166+
uses: actions/checkout@v3
167+
- name: Build and Push Image
168+
uses: ./.github/actions/build-and-deploy-quarkus-jvm
169+
with:
170+
platforms: "linux/amd64,linux/arm64/v8"
171+
docker-username: ${{ secrets.DOCKER_USERNAME }}
172+
docker-password: ${{ secrets.DOCKER_PASSWORD }}
173+
image-name: ${{ vars.DOCKER_JVM_IMAGE_NAME }}
174+
image-tag: "latest"

build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ tasks.named('imageBuild') {
106106
dependsOn 'jandex'
107107
}
108108

109+
tasks.named('imagePush') {
110+
dependsOn 'jandex'
111+
}
112+
109113
tasks.named('checkstyleMain') {
110114
dependsOn 'jandex'
111115
}

0 commit comments

Comments
 (0)