run in parallel

Signed-off-by: olivier lamy <olamy@webtide.com>
This commit is contained in:
olivier lamy 2018-02-01 14:29:08 +10:00
parent 5fbea380bf
commit 99fc4ab471
1 changed files with 101 additions and 96 deletions

197
Jenkinsfile vendored
View File

@ -1,125 +1,130 @@
#!groovy #!groovy
def jdks = ["jdk8", "jdk9"] def jdks = ["jdk8", "jdk9"]
def builds = [:]
for (def jdk in jdks) { for (def jdk in jdks) {
builds[jdk] = getFullBuild( jdk )
parallel builds
}
node { def getFullBuild(jdk) {
// System Dependent Locations return {
def mvntool = tool name: 'maven3', type: 'hudson.tasks.Maven$MavenInstallation' node {
def jdktool = tool name: "$jdk", type: 'hudson.model.JDK' // System Dependent Locations
def mvntool = tool name: 'maven3', type: 'hudson.tasks.Maven$MavenInstallation'
def jdktool = tool name: "$jdk", type: 'hudson.model.JDK'
// Environment // Environment
List mvnEnv = ["PATH+MVN=${mvntool}/bin", "PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}/", "MAVEN_HOME=${mvntool}"] List mvnEnv = ["PATH+MVN=${mvntool}/bin", "PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}/", "MAVEN_HOME=${mvntool}"]
mvnEnv.add("MAVEN_OPTS=-Xms256m -Xmx1024m -Djava.awt.headless=true") mvnEnv.add("MAVEN_OPTS=-Xms256m -Xmx1024m -Djava.awt.headless=true")
try try
{ {
stage('Checkout') { stage('Checkout') {
checkout scm checkout scm
}
} catch (Exception e) {
notifyBuild("Checkout Failure", jdk)
throw e
} }
} catch (Exception e) {
notifyBuild("Checkout Failure", jdk)
throw e
}
try try
{ {
stage('Compile') { stage('Compile') {
withEnv(mvnEnv) { withEnv(mvnEnv) {
timeout(time: 15, unit: 'MINUTES') { timeout(time: 15, unit: 'MINUTES') {
sh "mvn -V -B clean install -Dtest=None" sh "mvn -V -B clean install -Dtest=None"
}
} }
} }
} catch(Exception e) {
notifyBuild("Compile Failure", jdk)
throw e
} }
} catch(Exception e) {
notifyBuild("Compile Failure", jdk)
throw e
}
try try
{ {
stage('Javadoc') { stage('Javadoc') {
withEnv(mvnEnv) { withEnv(mvnEnv) {
timeout(time: 20, unit: 'MINUTES') { timeout(time: 20, unit: 'MINUTES') {
sh "mvn -V -B javadoc:javadoc" sh "mvn -V -B javadoc:javadoc"
}
} }
} }
} catch(Exception e) {
notifyBuild("Javadoc Failure", jdk)
throw e
} }
} catch(Exception e) {
notifyBuild("Javadoc Failure", jdk)
throw e
}
try try
{ {
stage('Test') { stage('Test') {
withEnv(mvnEnv) { withEnv(mvnEnv) {
timeout(time: 90, unit: 'MINUTES') { timeout(time: 90, unit: 'MINUTES') {
// Run test phase / ignore test failures // Run test phase / ignore test failures
sh "mvn -V -B install -Dmaven.test.failure.ignore=true -Prun-its" sh "mvn -V -B install -Dmaven.test.failure.ignore=true -Prun-its"
// Report failures in the jenkins UI // Report failures in the jenkins UI
step([$class: 'JUnitResultArchiver', step([$class: 'JUnitResultArchiver',
testResults: '**/target/surefire-reports/TEST-*.xml']) testResults: '**/target/surefire-reports/TEST-*.xml'])
// Collect up the jacoco execution results // Collect up the jacoco execution results
def jacocoExcludes = def jacocoExcludes =
// build tools // build tools
"**/org/eclipse/jetty/ant/**" + "**/org/eclipse/jetty/ant/**" +
",**/org/eclipse/jetty/maven/**" + ",**/org/eclipse/jetty/maven/**" +
",**/org/eclipse/jetty/jspc/**" + ",**/org/eclipse/jetty/jspc/**" +
// example code / documentation // example code / documentation
",**/org/eclipse/jetty/embedded/**" + ",**/org/eclipse/jetty/embedded/**" +
",**/org/eclipse/jetty/asyncrest/**" + ",**/org/eclipse/jetty/asyncrest/**" +
",**/org/eclipse/jetty/demo/**" + ",**/org/eclipse/jetty/demo/**" +
// special environments / late integrations // special environments / late integrations
",**/org/eclipse/jetty/gcloud/**" + ",**/org/eclipse/jetty/gcloud/**" +
",**/org/eclipse/jetty/infinispan/**" + ",**/org/eclipse/jetty/infinispan/**" +
",**/org/eclipse/jetty/osgi/**" + ",**/org/eclipse/jetty/osgi/**" +
",**/org/eclipse/jetty/spring/**" + ",**/org/eclipse/jetty/spring/**" +
",**/org/eclipse/jetty/http/spi/**" + ",**/org/eclipse/jetty/http/spi/**" +
// test classes // test classes
",**/org/eclipse/jetty/tests/**" + ",**/org/eclipse/jetty/tests/**" +
",**/org/eclipse/jetty/test/**"; ",**/org/eclipse/jetty/test/**";
step([$class: 'JacocoPublisher', step([$class: 'JacocoPublisher',
inclusionPattern: '**/org/eclipse/jetty/**/*.class', inclusionPattern: '**/org/eclipse/jetty/**/*.class',
exclusionPattern: jacocoExcludes, exclusionPattern: jacocoExcludes,
execPattern: '**/target/jacoco.exec', execPattern: '**/target/jacoco.exec',
classPattern: '**/target/classes', classPattern: '**/target/classes',
sourcePattern: '**/src/main/java']) sourcePattern: '**/src/main/java'])
// Report on Maven and Javadoc warnings // Report on Maven and Javadoc warnings
step([$class: 'WarningsPublisher', step([$class: 'WarningsPublisher',
consoleParsers: [ consoleParsers: [
[parserName: 'Maven'], [parserName: 'Maven'],
[parserName: 'JavaDoc'], [parserName: 'JavaDoc'],
[parserName: 'JavaC'] [parserName: 'JavaC']
]]) ]])
} }
if(isUnstable()) if(isUnstable())
{ {
notifyBuild("Unstable / Test Errors", jdk) notifyBuild("Unstable / Test Errors", jdk)
}
} }
} }
} catch(Exception e) {
notifyBuild("Test Failure", jdk)
throw e
} }
} catch(Exception e) {
notifyBuild("Test Failure", jdk)
throw e
}
try try
{ {
stage 'Compact3' stage 'Compact3'
dir("aggregates/jetty-all-compact3") { dir("aggregates/jetty-all-compact3") {
withEnv(mvnEnv) { withEnv(mvnEnv) {
sh "mvn -V -B -Pcompact3 clean install" sh "mvn -V -B -Pcompact3 clean install"
}
} }
} catch(Exception e) {
notifyBuild("Compact3 Failure", jdk)
throw e
} }
} catch(Exception e) {
notifyBuild("Compact3 Failure", jdk)
throw e
} }
} }
} }