Skip to content

Commit 6fd6c95

Browse files
committed
Maintenance
1 parent 298e6da commit 6fd6c95

File tree

22 files changed

+170
-111
lines changed

22 files changed

+170
-111
lines changed

.github/workflows/publish.yml renamed to .github/workflows/.publish.yml.deactivated

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
QUARKUS_NATIVE_ENABLED: false
7575
QUARKUS_PACKAGE_JAR_TYPE: mutable-jar
7676
QUARKUS_DOCKER_BUILDX_PLATFORM: linux/amd64,linux/arm64
77-
run: ./gradlew clean build -PimageTagSuffix=jvm
77+
run: ./gradlew build
7878

7979
- name: Update Docker Hub description
8080
if: ${{ github.event.action == 'released' }}

.github/workflows/check.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,48 @@ on:
1111
- feature/**
1212

1313
jobs:
14-
check:
14+
build:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919

2020
- name: Set up JDK
21-
uses: actions/setup-java@v4
21+
uses: actions/setup-java@v5
2222
with:
2323
distribution: 'temurin'
24-
java-version: '21'
24+
java-version: '25'
2525

2626
- name: Setup Gradle
27-
uses: gradle/actions/setup-gradle@v4
27+
uses: gradle/actions/setup-gradle@v5
2828

2929
- name: Run Gradle 'build' Task
3030
run: ./gradlew build
31+
32+
check:
33+
name: "e2e tests ${{ matrix.type.name }}"
34+
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
type:
38+
- name: jvm
39+
native: false
40+
- name: native
41+
native: true
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v6
45+
46+
- name: Set up JDK
47+
uses: actions/setup-java@v5
48+
with:
49+
distribution: 'temurin'
50+
java-version: '25'
51+
52+
- name: Setup Gradle
53+
uses: gradle/actions/setup-gradle@v5
54+
55+
- name: execute e2e tests
56+
env:
57+
ORG_GRADLE_PROJECT_nativeImage: ${{ matrix.type.native }}
58+
run: ./gradlew testNative

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Gradle
22
.gradle/
33
build/
4+
.kotlin/
45

56
# Eclipse
67
.project

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,28 @@ openssl pkcs12 -export -CAfile cacert.pem -chain -in tsacert.pem -inkey tsa.priv
146146

147147
## Development
148148

149+
### Building an OCI image with a GraalVM native executable
150+
151+
Due to restrictions of the [Quarkus Gradle Plugin](https://github.com/quarkusio/quarkus/discussions/40679)
152+
you can either build an OCI image with a GraalVM native executable or a JVM based OCI image.
153+
154+
The name of the `testNative` Gradle task is therefore extremely misleading, because it can either use the JVM based
155+
image or the GraalVM native executable image.
156+
157+
By default, a JVM based OCI image is built and used in the `testNative` task. To build a GraalVM native executable
158+
image, set the `nativeImage` Gradle property to `true` when executing Gradle tasks:
159+
160+
```bash
161+
# build the native image without executing end-to-end-tests (just execute the regular JUnit tests)
162+
./gradlew build -PnativeImage=true
163+
164+
# build the native image and execute the end-to-end-tests (without the regular JUnit tests)
165+
./gradlew testNative -PnativeImage=true
166+
```
167+
168+
This Gradle property will properly configure the `quarkus.package.jar.enabled`, `quarkus.native.enabled` and
169+
`quarkus.container-image.tag` configuration parameters.
170+
149171
### Running in development mode
150172

151173
In normal operation, no signing certificate is configured by default since you probably want to use your own/your

app/build.gradle.kts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies {
2929

3030
implementation("jakarta.validation:jakarta.validation-api")
3131
implementation("jakarta.ws.rs:jakarta.ws.rs-api")
32-
implementation(libs.bouncycastle)
32+
implementation("org.bouncycastle:bcpkix-jdk18on")
3333
implementation(libs.mapstruct.runtime)
3434

3535
runtimeOnly("io.quarkus:quarkus-jdbc-h2")
@@ -42,13 +42,13 @@ dependencies {
4242
testImplementation("org.mockito:mockito-junit-jupiter")
4343
testImplementation("io.quarkus:quarkus-junit5-mockito")
4444
testImplementation("io.rest-assured:rest-assured")
45-
testImplementation(testLibs.assertj)
46-
testImplementation(testLibs.archunit)
45+
testImplementation(libs.assertj)
46+
testImplementation(libs.archunit)
4747
}
4848

4949
java {
5050
toolchain {
51-
languageVersion = JavaLanguageVersion.of(21)
51+
languageVersion = JavaLanguageVersion.of(25)
5252
}
5353
}
5454

@@ -61,6 +61,11 @@ tasks.withType<JavaCompile>().configureEach {
6161
options.compilerArgs.add("-parameters")
6262
}
6363

64+
val compileAll by tasks.registering {
65+
description = "Lifecycle Task to compile all source sets"
66+
dependsOn(tasks.withType<JavaCompile>())
67+
}
68+
6469
// this file is used in the publish-workflow as well
6570
val openApiSpecificationFile = layout.buildDirectory.file("openapi-specification.json")
6671

@@ -84,25 +89,28 @@ spotless {
8489
}
8590
}
8691

92+
// setting "quarkus.native.enabled" is not enough when using Gradle, you also have to disable jar packaging
93+
// see https://github.com/quarkusio/quarkus/discussions/40679
94+
val buildNativeImage = providers.gradleProperty("nativeImage")
95+
.map { it.toBoolean() }
96+
.orElse(false)
97+
8798
quarkus {
99+
set("package.jar.enabled", buildNativeImage.map { !it }.map(Boolean::toString))
100+
set("native.enabled", buildNativeImage.map(Boolean::toString))
88101
set("native.container-build", "true")
89102
set("container-image.build", "true")
90103
set("container-image.group", "dnl50")
91104
set("container-image.name", "tsa-server")
92-
set("container-image.tag", provider {
93-
if (project.hasProperty("imageTagSuffix")) {
94-
"${project.version}-${project.property("imageTagSuffix")}"
95-
} else {
96-
project.version.toString()
105+
set(
106+
"container-image.tag",
107+
buildNativeImage.map { native ->
108+
"${project.version}${if (native) "" else "-jvm"}"
97109
}
98-
})
110+
)
99111
finalName.set("tsa-${project.version}")
100112
}
101113

102-
tasks.check {
103-
dependsOn(tasks.testNative)
104-
}
105-
106114
// for some reason quarkus does recognize that the JDBC URL is set in the prod profile. therefore it
107115
// creates a h2 db in server mode (using the H2DevServicesProcessor) which runs on the host machine and sets the JDBC URL
108116
// to something like "jdbc:h2:tcp://localhost:53233/mem:test" which obviously does not work inside the docker container

app/src/main/docker/Dockerfile.jvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Based on Quarkus' Dockerfile.jvm template for Gradle
2-
FROM registry.access.redhat.com/ubi8/openjdk-21-runtime:1.20
2+
FROM registry.access.redhat.com/ubi9/openjdk-25:1.24
33

44
ENV LANGUAGE='en_US:en'
55

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.10
1+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7
22
WORKDIR /work/
33
RUN chown 1001 /work \
44
&& mkdir /work/data \
55
&& chmod -R "g+rwX" /work \
66
&& chown -R 1001:root /work
7-
COPY --chown=1001:root build/*-runner /work/application
7+
COPY --chown=1001:root --chmod=0755 build/*-runner /work/application
88

99
EXPOSE 8080
1010
USER 1001
1111

1212
VOLUME ["/work/data"]
1313

14-
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
14+
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]

app/src/native-test/java/dev/mieser/tsa/nativetest/KeystoreResourceLifecycleManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
/**
1515
* {@link QuarkusTestResourceLifecycleManager} which copies a PKCS#12 keystore to a temporary directory on the host
16-
* system and adds an argument to the {@code docker run} command executed by Quarkus so that the temporary file on the
17-
* host system is mounted in the container.
16+
* system and mounts the temporary file inside the container.
1817
*/
1918
@Slf4j
2019
public class KeystoreResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {
@@ -25,7 +24,9 @@ public class KeystoreResourceLifecycleManager implements QuarkusTestResourceLife
2524
public Map<String, String> start() {
2625
temporaryFile = copyKeystoreToTemporaryFile();
2726

28-
return Map.of("quarkus.test.arg-line", String.format("-v %s:/work/keystore.p12", temporaryFile.toAbsolutePath()));
27+
return Map.of(
28+
"quarkus.test.container.volume-mounts.\"%s\"".formatted(temporaryFile.toAbsolutePath()),
29+
"/work/keystore.p12");
2930
}
3031

3132
@Override

build-logic/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.gradle.configuration-cache=true
2+
org.gradle.parallel=true

build-logic/settings.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rootProject.name = "build-logic"
2+
3+
include("versioning")

0 commit comments

Comments
 (0)