Add Develocity build scan + build cache to Jenkins build

This commit is contained in:
Yoann Rodière 2024-03-21 15:09:46 +01:00 committed by Christian Beikov
parent 65911ae995
commit 96fc18f4e8
1 changed files with 24 additions and 18 deletions

42
Jenkinsfile vendored
View File

@ -155,29 +155,35 @@ stage('Build') {
stage('Test') { stage('Test') {
String cmd = "./ci/build.sh ${buildEnv.additionalOptions ?: ''} ${state[buildEnv.tag]['additionalOptions'] ?: ''}" String cmd = "./ci/build.sh ${buildEnv.additionalOptions ?: ''} ${state[buildEnv.tag]['additionalOptions'] ?: ''}"
withEnv(["RDBMS=${buildEnv.dbName}"]) { withEnv(["RDBMS=${buildEnv.dbName}"]) {
try { withCredentials([string(credentialsId: helper.scmSource.pullRequest ?
if (buildEnv.dbLockableResource == null) { 'ge.hibernate.org-access-key-pr' : 'ge.hibernate.org-access-key',
withCredentials([file(credentialsId: 'sybase-jconnect-driver', variable: 'jconnect_driver')]) { variable: 'GRADLE_ENTERPRISE_ACCESS_KEY')]) {
sh 'cp -f $jconnect_driver ./drivers/jconn4.jar' withGradle { // withDevelocity, actually: https://plugins.jenkins.io/gradle/#plugin-content-capturing-build-scans-from-jenkins-pipeline
timeout( [time: buildEnv.longRunning ? 480 : 120, unit: 'MINUTES'] ) { try {
sh cmd if (buildEnv.dbLockableResource == null) {
withCredentials([file(credentialsId: 'sybase-jconnect-driver', variable: 'jconnect_driver')]) {
sh 'cp -f $jconnect_driver ./drivers/jconn4.jar'
timeout( [time: buildEnv.longRunning ? 480 : 120, unit: 'MINUTES'] ) {
sh cmd
}
}
}
else {
lock(label: buildEnv.dbLockableResource, quantity: 1, variable: 'LOCKED_RESOURCE') {
if ( buildEnv.dbLockResourceAsHost ) {
cmd += " -DdbHost=${LOCKED_RESOURCE}"
}
timeout( [time: buildEnv.longRunning ? 480 : 120, unit: 'MINUTES'] ) {
sh cmd
}
}
} }
} }
} finally {
else { junit '**/target/test-results/test/*.xml,**/target/test-results/testKitTest/*.xml'
lock(label: buildEnv.dbLockableResource, quantity: 1, variable: 'LOCKED_RESOURCE') {
if ( buildEnv.dbLockResourceAsHost ) {
cmd += " -DdbHost=${LOCKED_RESOURCE}"
}
timeout( [time: buildEnv.longRunning ? 480 : 120, unit: 'MINUTES'] ) {
sh cmd
}
} }
} }
} }
finally {
junit '**/target/test-results/test/*.xml,**/target/test-results/testKitTest/*.xml'
}
} }
} }
} }