in vars/asfMavenTlpPlgnBuild.groovy [22:115]
def call(Map params = [:]) {
Map taskContext = [:]
def branchesToNotify = params.containsKey("branchesToNotify") ? params.branchesToNotify : ['master', 'main']
try {
def buildProperties = []
if (env.BRANCH_NAME == 'master') {
// set build retention time first
buildProperties.add(buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '15', numToKeepStr: '10')))
// ensure a build is done every month
buildProperties.add(pipelineTriggers([cron('@monthly')]))
} else {
buildProperties.add(buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '2', daysToKeepStr: '7', numToKeepStr: '3')))
}
properties(buildProperties)
// now determine the matrix of parallel builds
def oses = params.containsKey('os') ? params.os : ['linux']
// minimum, LTS, current and next ea
def jdks = params.containsKey('jdks') ? params.jdks : params.containsKey('jdk') ? params.jdk : ['8','11','17']
def jdkMin = jdks[0];
def mavens = params.containsKey('maven') ? params.maven : ['3.6.x', '3.8.x']
// def failFast = params.containsKey('failFast') ? params.failFast : true
// Just temporarily
def failFast = false;
def siteJdks = params.containsKey('siteJdk') ? params.siteJdk : ['11']
def siteMvn = params.containsKey('siteMvn') ? params.siteMvn : '3.8.x'
def tmpWs = params.containsKey('tmpWs') ? params.tmpWs : false
taskContext['failFast'] = failFast;
taskContext['tmpWs'] = tmpWs;
taskContext['archives'] = params.archives
taskContext['siteWithPackage'] = params.containsKey('siteWithPackage') ? params.siteWithPackage : false // workaround for MNG-7289
Map tasks = [failFast: failFast]
boolean first = true
for (String os in oses) {
for (def mvn in mavens) {
def jdk = Math.max( jdkMin as Integer, jenkinsEnv.jdkForMaven( mvn ) as Integer) as String
jdks = jdks.findAll{ it != jdk }
doCreateTask( os, jdk, mvn, tasks, first, 'build', taskContext )
}
for (def jdk in jdks) {
def mvn = jenkinsEnv.mavenForJdk(jdk)
doCreateTask( os, jdk, mvn, tasks, first, 'build', taskContext )
}
for (def jdk in siteJdks) {
// doesn't work for multimodules yet
doCreateTask( os, jdk, siteMvn, tasks, first, 'site', taskContext )
}
// run with apache-release profile, consider it a dryRun with SNAPSHOTs
// doCreateTask( os, siteJdk, siteMvn, tasks, first, 'release', taskContext )
}
// run the parallel builds
parallel(tasks)
// JENKINS-34376 seems to make it hard to detect the aborted builds
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
// this ambiguous condition means a user probably aborted
if (e.causes.size() == 0) {
currentBuild.result = "ABORTED"
} else {
currentBuild.result = "FAILURE"
}
throw e
} catch (hudson.AbortException e) {
// this ambiguous condition means during a shell step, user probably aborted
if (e.getMessage().contains('script returned exit code 143')) {
currentBuild.result = "ABORTED"
} else {
currentBuild.result = "FAILURE"
}
throw e
} catch (InterruptedException e) {
currentBuild.result = "ABORTED"
throw e
} catch (Throwable e) {
currentBuild.result = "FAILURE"
throw e
} finally {
// notify completion
if (taskContext.failingFast != null) {
echo "***** FAST FAILURE *****\n\nFast failure triggered by ${taskContext.failingFast}\n\n***** FAST FAILURE *****"
}
if (branchesToNotify.contains(env.BRANCH_NAME)) {
stage("Notifications") {
jenkinsNotify()
}
}
}
}