|
| 1 | +@Library('hibernate-jenkins-pipeline-helpers') _ |
| 2 | + |
| 3 | +// Avoid running the pipeline on branch indexing |
| 4 | +if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) { |
| 5 | + print "INFO: Build skipped due to trigger being Branch Indexing" |
| 6 | + currentBuild.result = 'NOT_BUILT' |
| 7 | + return |
| 8 | +} |
| 9 | +// This is a limited maintenance branch, so don't run this on pushes to the branch, only on PRs |
| 10 | +if ( !env.CHANGE_ID ) { |
| 11 | + print "INFO: Build skipped because this job should only run for pull request, not for branch pushes" |
| 12 | + currentBuild.result = 'NOT_BUILT' |
| 13 | + return |
| 14 | +} |
| 15 | + |
| 16 | +pipeline { |
| 17 | + agent none |
| 18 | + tools { |
| 19 | + jdk 'OpenJDK 17 Latest' |
| 20 | + } |
| 21 | + options { |
| 22 | + buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '3')) |
| 23 | + disableConcurrentBuilds(abortPrevious: true) |
| 24 | + skipDefaultCheckout() |
| 25 | + } |
| 26 | + stages { |
| 27 | + stage('Checks') { |
| 28 | + steps { |
| 29 | + requireApprovalForPullRequest 'hibernate' |
| 30 | + } |
| 31 | + } |
| 32 | + stage('Build') { |
| 33 | + agent { |
| 34 | + label 'LongDuration' |
| 35 | + } |
| 36 | + steps { |
| 37 | + script { |
| 38 | + dir('hibernate') { |
| 39 | + checkout scm |
| 40 | + 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" |
| 41 | + script { |
| 42 | + env.HIBERNATE_VERSION = sh ( |
| 43 | + script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2", |
| 44 | + returnStdout: true |
| 45 | + ).trim() |
| 46 | + } |
| 47 | + } |
| 48 | + dir('quarkus') { |
| 49 | + def latestQuarkusVersion = sh (script: "git ls-remote --heads https://github.com/quarkusio/quarkus.git | grep -oP 'refs/heads/\\K[0-9]+\\.[0-9]+?\$' | sort -V -r | head -n 1").trim() |
| 50 | + sh "git clone -b ${latestQuarkusVersion} --single-branch https://github.com/quarkusio/quarkus.git . || git reset --hard && git clean -fx && git pull" |
| 51 | + script { |
| 52 | + 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) |
| 53 | + if ( sedStatus != 0 ) { |
| 54 | + throw new IllegalArgumentException( "Unable to replace hibernate version in Quarkus pom. Got exit code $sedStatus" ) |
| 55 | + } |
| 56 | + } |
| 57 | + // Need to override the default maven configuration this way, because there is no other way to do it |
| 58 | + sh "sed -i 's/-Xmx5g/-Xmx2048m/' ./.mvn/jvm.config" |
| 59 | + sh "echo -e '\\n-XX:MaxMetaspaceSize=1024m'>>./.mvn/jvm.config" |
| 60 | + withMaven(mavenLocalRepo: env.WORKSPACE + '/.m2repository', publisherStrategy:'EXPLICIT') { |
| 61 | + sh "./mvnw -pl !docs -Dquickly install" |
| 62 | + // Need to kill the gradle daemons started during the Maven install run |
| 63 | + sh "sudo pkill -f '.*GradleDaemon.*' || true" |
| 64 | + // Need to override the default maven configuration this way, because there is no other way to do it |
| 65 | + sh "sed -i 's/-Xmx2048m/-Xmx1340m/' ./.mvn/jvm.config" |
| 66 | + sh "sed -i 's/MaxMetaspaceSize=1024m/MaxMetaspaceSize=512m/' ./.mvn/jvm.config" |
| 67 | + def excludes = "'!integration-tests/kafka-oauth-keycloak,!integration-tests/kafka-sasl-elytron,!integration-tests/hibernate-search-orm-opensearch,!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'" |
| 68 | + 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" |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + post { |
| 76 | + always { |
| 77 | + |
| 78 | + } |
| 79 | + } |
| 80 | +} |
0 commit comments