Skip to content

Commit 1d609a9

Browse files
committed
Also run Quarkus native image tests in parallel
1 parent 482d095 commit 1d609a9

File tree

1 file changed

+119
-35
lines changed

1 file changed

+119
-35
lines changed

ci/quarkus.Jenkinsfile

Lines changed: 119 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,64 @@ if ( !env.CHANGE_ID ) {
1313
return
1414
}
1515

16+
void runBuildOnNode(String label, Closure body) {
17+
node( label ) {
18+
pruneDockerContainers()
19+
tryFinally(body, {
20+
cleanWs()
21+
pruneDockerContainers()
22+
})
23+
}
24+
}
25+
26+
// try-finally construct that properly suppresses exceptions thrown in the finally block.
27+
def tryFinally(Closure main, Closure ... finallies) {
28+
def mainFailure = null
29+
try {
30+
main()
31+
}
32+
catch (Throwable t) {
33+
mainFailure = t
34+
throw t
35+
}
36+
finally {
37+
finallies.each {it ->
38+
try {
39+
it()
40+
}
41+
catch (Throwable t) {
42+
if ( mainFailure ) {
43+
mainFailure.addSuppressed( t )
44+
}
45+
else {
46+
mainFailure = t
47+
}
48+
}
49+
}
50+
}
51+
if ( mainFailure ) { // We may reach here if only the "finally" failed
52+
throw mainFailure
53+
}
54+
}
55+
56+
class BuildConfiguration {
57+
String name
58+
String projects
59+
boolean nativeProfile = false
60+
}
61+
62+
// See data category from https://github.com/quarkusio/quarkus/blob/main/.github/native-tests.json
63+
def configurations = [
64+
new BuildConfiguration( name: "JVM test", projects: "!integration-tests/kafka-oauth-keycloak,!integration-tests/kafka-sasl-elytron,!integration-tests/hibernate-search-orm-opensearch,!integration-tests/hibernate-search-orm-elasticsearch-outbox-polling,!integration-tests/hibernate-search-orm-elasticsearch-tenancy,!integration-tests/maven,!integration-tests/quartz,!integration-tests/reactive-messaging-kafka,!integration-tests/resteasy-reactive-kotlin/standard,!integration-tests/opentelemetry-reactive-messaging,!integration-tests/virtual-threads/kafka-virtual-threads,!integration-tests/smallrye-jwt-oidc-webapp,!extensions/oidc-db-token-state-manager/deployment,!docs",
65+
new BuildConfiguration( name: "Data1", nativeProfile: true, projects: "jpa-h2, jpa-h2-embedded, jpa-mariadb, jpa-mssql, jpa-without-entity, hibernate-orm-tenancy/datasource, hibernate-orm-tenancy/connection-resolver, hibernate-orm-tenancy/connection-resolver-legacy-qualifiers",
66+
new BuildConfiguration( name: "Data2", nativeProfile: true, projects: "jpa, jpa-mapping-xml/legacy-app, jpa-mapping-xml/modern-app, jpa-mysql, jpa-db2, jpa-oracle",
67+
new BuildConfiguration( name: "Data3", nativeProfile: true, projects: "flyway, hibernate-orm-panache, hibernate-orm-panache-kotlin, hibernate-orm-envers, liquibase, liquibase-mongodb",
68+
new BuildConfiguration( name: "Data4", nativeProfile: true, projects: "mongodb-client, mongodb-devservices, mongodb-panache, mongodb-rest-data-panache, mongodb-panache-kotlin, redis-client, hibernate-orm-rest-data-panache",
69+
new BuildConfiguration( name: "Data5", nativeProfile: true, projects: "jpa-postgresql, jpa-postgresql-withxml, narayana-stm, narayana-jta, reactive-pg-client, hibernate-reactive-postgresql, hibernate-orm-tenancy/schema, hibernate-orm-tenancy/schema-mariadb",
70+
new BuildConfiguration( name: "Data6", nativeProfile: true, projects: "elasticsearch-rest-client, elasticsearch-java-client, hibernate-search-orm-elasticsearch, hibernate-search-orm-elasticsearch-tenancy, hibernate-search-orm-opensearch, hibernate-search-orm-elasticsearch-outbox-polling, hibernate-search-standalone-elasticsearch, hibernate-search-standalone-opensearch",
71+
new BuildConfiguration( name: "Data7", nativeProfile: true, projects: "reactive-oracle-client, reactive-mysql-client, reactive-db2-client, hibernate-reactive-db2, hibernate-reactive-mariadb, hibernate-reactive-mssql, hibernate-reactive-mysql, hibernate-reactive-mysql-agroal-flyway, hibernate-reactive-panache, hibernate-reactive-panache-kotlin, hibernate-reactive-oracle"
72+
]
73+
1674
pipeline {
1775
agent none
1876
tools {
@@ -31,46 +89,72 @@ pipeline {
3189
}
3290
}
3391
stage('Build') {
34-
agent {
35-
label 'LongDuration'
36-
}
3792
steps {
38-
script {
39-
dir('hibernate') {
40-
checkout scm
41-
sh "./gradlew clean publishToMavenLocal -x test --no-scan --no-daemon --no-build-cache --stacktrace -PmavenMirror=nexus-load-balancer-c4cf05fd92f43ef8.elb.us-east-1.amazonaws.com -Dmaven.repo.local=${env.WORKSPACE}/.m2repository"
42-
script {
43-
env.HIBERNATE_VERSION = sh (
44-
script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2",
45-
returnStdout: true
46-
).trim()
47-
}
93+
stage('Build Hibernate ORM') {
94+
agent {
95+
label 'LongDuration'
4896
}
49-
dir('quarkus') {
50-
def quarkusVersionToTest = '3.27'
51-
sh "git clone -b ${quarkusVersionToTest} --single-branch https://github.com/quarkusio/quarkus.git . || git reset --hard && git clean -fx && git pull"
52-
script {
53-
def sedStatus = sh (script: "sed -i 's@<hibernate-orm.version>.*</hibernate-orm.version>@<hibernate-orm.version>${env.HIBERNATE_VERSION}</hibernate-orm.version>@' pom.xml", returnStatus: true)
54-
if ( sedStatus != 0 ) {
55-
throw new IllegalArgumentException( "Unable to replace hibernate version in Quarkus pom. Got exit code $sedStatus" )
97+
script {
98+
dir('hibernate') {
99+
checkout scm
100+
sh "./gradlew clean publishToMavenLocal -x test --no-scan --no-daemon --no-build-cache --stacktrace -PmavenMirror=nexus-load-balancer-c4cf05fd92f43ef8.elb.us-east-1.amazonaws.com -Dmaven.repo.local=${env.WORKSPACE}/.m2repository"
101+
script {
102+
env.HIBERNATE_VERSION = sh (
103+
script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2",
104+
returnStdout: true
105+
).trim()
56106
}
57107
}
58-
// Need to override the default maven configuration this way, because there is no other way to do it
59-
sh "sed -i 's/-Xmx5g/-Xmx2048m/' ./.mvn/jvm.config"
60-
sh "echo -e '\\n-XX:MaxMetaspaceSize=1024m'>>./.mvn/jvm.config"
61-
withMaven(mavenLocalRepo: env.WORKSPACE + '/.m2repository', publisherStrategy: 'EXPLICIT') {
62-
// to account for script-only maven wrapper use in Quarkus:
63-
withEnv(["MAVEN_ARGS=${env.MAVEN_ARGS?:""} ${env.MAVEN_CONFIG}"]) {
64-
sh "./mvnw -pl !docs -Dquickly install"
65-
// Need to kill the gradle daemons started during the Maven install run
66-
sh "sudo pkill -f '.*GradleDaemon.*' || true"
67-
// Need to override the default maven configuration this way, because there is no other way to do it
68-
sh "sed -i 's/-Xmx2048m/-Xmx1340m/' ./.mvn/jvm.config"
69-
sh "sed -i 's/MaxMetaspaceSize=1024m/MaxMetaspaceSize=512m/' ./.mvn/jvm.config"
70-
def excludes = "'!integration-tests/kafka-oauth-keycloak,!integration-tests/kafka-sasl-elytron,!integration-tests/hibernate-search-orm-opensearch,!integration-tests/hibernate-search-orm-elasticsearch-outbox-polling,!integration-tests/hibernate-search-orm-elasticsearch-tenancy,!integration-tests/maven,!integration-tests/quartz,!integration-tests/reactive-messaging-kafka,!integration-tests/resteasy-reactive-kotlin/standard,!integration-tests/opentelemetry-reactive-messaging,!integration-tests/virtual-threads/kafka-virtual-threads,!integration-tests/smallrye-jwt-oidc-webapp,!extensions/oidc-db-token-state-manager/deployment,!docs'"
71-
sh "TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED=true ./mvnw -Dinsecure.repositories=WARN -pl :quarkus-hibernate-orm -amd -pl ${excludes} verify -Dstart-containers -Dtest-containers -Dskip.gradle.build"
72-
}
108+
}
109+
}
110+
stage('Build Quarkus') {
111+
agent {
112+
label 'LongDuration'
113+
}
114+
script {
115+
Map<String, Closure> executions = [:]
116+
117+
configurations.each { BuildConfiguration configuration ->
118+
executions.put(configuration.name, {
119+
dir('quarkus') {
120+
def quarkusVersionToTest = '3.27'
121+
sh "git clone -b ${quarkusVersionToTest} --single-branch https://github.com/quarkusio/quarkus.git . || git reset --hard && git clean -fx && git pull"
122+
script {
123+
def sedStatus = sh (script: "sed -i 's@<hibernate-orm.version>.*</hibernate-orm.version>@<hibernate-orm.version>${env.HIBERNATE_VERSION}</hibernate-orm.version>@' pom.xml", returnStatus: true)
124+
if ( sedStatus != 0 ) {
125+
throw new IllegalArgumentException( "Unable to replace hibernate version in Quarkus pom. Got exit code $sedStatus" )
126+
}
127+
}
128+
// Need to override the default maven configuration this way, because there is no other way to do it
129+
sh "sed -i 's/-Xmx5g/-Xmx2048m/' ./.mvn/jvm.config"
130+
sh "echo -e '\\n-XX:MaxMetaspaceSize=1024m'>>./.mvn/jvm.config"
131+
withMaven(mavenLocalRepo: env.WORKSPACE + '/.m2repository', publisherStrategy: 'EXPLICIT') {
132+
// to account for script-only maven wrapper use in Quarkus:
133+
withEnv(["MAVEN_ARGS=${env.MAVEN_ARGS?:""} ${env.MAVEN_CONFIG}"]) {
134+
sh "./mvnw -pl !docs -Dquickly install"
135+
// Need to kill the gradle daemons started during the Maven install run
136+
sh "sudo pkill -f '.*GradleDaemon.*' || true"
137+
// Need to override the default maven configuration this way, because there is no other way to do it
138+
sh "sed -i 's/-Xmx2048m/-Xmx1340m/' ./.mvn/jvm.config"
139+
sh "sed -i 's/MaxMetaspaceSize=1024m/MaxMetaspaceSize=512m/' ./.mvn/jvm.config"
140+
def projects = configuration.projects.join(", ")
141+
def additionalArguments
142+
def additionalOptions
143+
if ( configuration.nativeProfile ) {
144+
additionalArguments = "-f integration-tests"
145+
additionalOptions = "-Dquarkus.native.native-image-xmx=6g -Dnative -Dnative.surefire.skip -Dno-descriptor-tests"
146+
}
147+
else {
148+
additionalArguments = "-pl :quarkus-hibernate-orm -amd"
149+
additionalOptions = ""
150+
}
151+
sh "TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED=true ./mvnw -Dinsecure.repositories=WARN ${additionalArguments} -pl '${projects}' verify -Dstart-containers -Dtest-containers -Dskip.gradle.build ${additionalOptions}"
152+
}
153+
}
154+
}
155+
})
73156
}
157+
parallel executions
74158
}
75159
}
76160
}

0 commit comments

Comments
 (0)