2017-01-09 04:49:16 -05:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: env.BRANCH_NAME=='master'?'10':'5'))])
|
|
|
|
|
2017-12-11 08:42:14 -05:00
|
|
|
def buildOs = 'linux'
|
|
|
|
def buildJdk = '7'
|
|
|
|
def buildMvn = '3.5.0'
|
2017-02-21 12:33:54 -05:00
|
|
|
def tests
|
2017-03-23 22:28:59 -04:00
|
|
|
def CORE_IT_PROFILES='run-its,embedded'
|
2017-01-09 04:49:16 -05:00
|
|
|
|
|
|
|
try {
|
2017-03-23 22:25:17 -04:00
|
|
|
|
2017-12-11 08:42:14 -05:00
|
|
|
node(jenkinsEnv.labelForOS(buildOs)) {
|
2017-01-09 04:49:16 -05:00
|
|
|
dir('build') {
|
2017-03-23 22:25:17 -04:00
|
|
|
stage('Checkout') {
|
|
|
|
checkout scm
|
2017-01-09 04:49:16 -05:00
|
|
|
}
|
2017-03-23 22:25:17 -04:00
|
|
|
|
|
|
|
def WORK_DIR=pwd()
|
|
|
|
|
|
|
|
stage('Build / Unit Test') {
|
2017-12-11 08:42:14 -05:00
|
|
|
String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk)
|
|
|
|
String mvnName = jenkinsEnv.mvnFromVersion(buildOs, buildMvn)
|
|
|
|
withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/.repository", options:[
|
2017-12-11 08:45:00 -05:00
|
|
|
artifactsPublisher(disabled: false),
|
2017-12-11 08:42:14 -05:00
|
|
|
junitPublisher(ignoreAttachments: false),
|
2017-12-11 08:45:00 -05:00
|
|
|
findbugsPublisher(disabled: false),
|
|
|
|
openTasksPublisher(disabled: false),
|
2017-12-11 08:42:14 -05:00
|
|
|
dependenciesFingerprintPublisher(),
|
|
|
|
invokerPublisher(),
|
|
|
|
pipelineGraphPublisher()
|
|
|
|
]) {
|
2017-12-11 08:48:11 -05:00
|
|
|
sh "mvn clean verify -B -U -e -fae -V -Dmaven.test.failure.ignore=true"
|
2017-03-23 22:25:17 -04:00
|
|
|
}
|
|
|
|
dir ('apache-maven/target') {
|
|
|
|
sh "mv apache-maven-*-bin.zip apache-maven-dist.zip"
|
|
|
|
stash includes: 'apache-maven-dist.zip', name: 'dist'
|
|
|
|
}
|
2017-01-09 04:49:16 -05:00
|
|
|
}
|
2017-03-23 22:25:17 -04:00
|
|
|
|
2018-03-19 18:07:44 -04:00
|
|
|
tests = resolveScm source: [$class: 'GitSCMSource', credentialsId: '', id: '_', remote: 'https://gitbox.apache.org/repos/asf/maven-integration-testing.git', traits: [[$class: 'jenkins.plugins.git.traits.BranchDiscoveryTrait'], [$class: 'GitToolSCMSourceTrait', gitTool: 'Default']]], targets: [BRANCH_NAME, 'master']
|
2017-01-09 04:49:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-23 22:25:17 -04:00
|
|
|
|
2017-12-11 08:42:14 -05:00
|
|
|
parallel linuxJava7:{
|
|
|
|
node(jenkinsEnv.labelForOS('linux')) {
|
|
|
|
stage ('Linux Java 7') {
|
|
|
|
String jdkName = jenkinsEnv.jdkFromVersion('linux', '7')
|
|
|
|
String mvnName = jenkinsEnv.mvnFromVersion('linux', buildMvn)
|
|
|
|
dir('test') {
|
|
|
|
def WORK_DIR=pwd()
|
|
|
|
checkout tests
|
|
|
|
sh "rm -rvf $WORK_DIR/apache-maven-dist.zip $WORK_DIR/it-local-repo"
|
|
|
|
unstash 'dist'
|
|
|
|
withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
|
|
|
|
junitPublisher(ignoreAttachments: false)
|
|
|
|
]) {
|
|
|
|
sh "mvn clean install -P$CORE_IT_PROFILES -B -U -V -Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
|
|
|
|
}
|
|
|
|
deleteDir() // clean up after ourselves to reduce disk space
|
2017-01-09 04:49:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},linuxJava8: {
|
2017-12-11 08:42:14 -05:00
|
|
|
node(jenkinsEnv.labelForOS('linux')) {
|
|
|
|
stage ('Linux Java 8') {
|
|
|
|
String jdkName = jenkinsEnv.jdkFromVersion('linux', '8')
|
|
|
|
String mvnName = jenkinsEnv.mvnFromVersion('linux', buildMvn)
|
|
|
|
dir('test') {
|
|
|
|
def WORK_DIR=pwd()
|
|
|
|
checkout tests
|
|
|
|
sh "rm -rvf $WORK_DIR/apache-maven-dist.zip $WORK_DIR/it-local-repo"
|
|
|
|
unstash 'dist'
|
|
|
|
withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
|
|
|
|
junitPublisher(ignoreAttachments: false)
|
|
|
|
]) {
|
|
|
|
sh "mvn clean install -P$CORE_IT_PROFILES -B -U -V -Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
|
|
|
|
}
|
|
|
|
deleteDir() // clean up after ourselves to reduce disk space
|
2017-01-09 04:49:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, winJava7: {
|
2017-12-11 08:42:14 -05:00
|
|
|
node(jenkinsEnv.labelForOS('windows')) {
|
|
|
|
stage ('Windows Java 7') {
|
|
|
|
String jdkName = jenkinsEnv.jdkFromVersion('windows', '7')
|
|
|
|
String mvnName = jenkinsEnv.mvnFromVersion('windows', buildMvn)
|
|
|
|
|
|
|
|
// need a short path or we hit 256 character limit for paths
|
|
|
|
// using EXECUTOR_NUMBER guarantees that concurrent builds on same agent
|
|
|
|
// will not trample each other
|
|
|
|
dir("/mvn-it-${EXECUTOR_NUMBER}.tmp") {
|
|
|
|
def WORK_DIR=pwd()
|
|
|
|
checkout tests
|
|
|
|
bat "if exist it-local-repo rmdir /s /q it-local-repo"
|
|
|
|
bat "if exist apache-maven-dist.zip del /q apache-maven-dist.zip"
|
2017-01-09 04:49:16 -05:00
|
|
|
unstash 'dist'
|
2017-12-11 08:42:14 -05:00
|
|
|
withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
|
|
|
|
junitPublisher(ignoreAttachments: false)
|
|
|
|
]) {
|
|
|
|
bat "mvn clean install -P$CORE_IT_PROFILES -B -U -V -Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
|
|
|
|
}
|
|
|
|
deleteDir() // clean up after ourselves to reduce disk space
|
2017-01-09 04:49:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, winJava8: {
|
2017-12-11 08:42:14 -05:00
|
|
|
node(jenkinsEnv.labelForOS('windows')) {
|
|
|
|
stage ('Windows Java 8') {
|
|
|
|
String jdkName = jenkinsEnv.jdkFromVersion('windows', '8')
|
|
|
|
String mvnName = jenkinsEnv.mvnFromVersion('windows', buildMvn)
|
|
|
|
|
|
|
|
// need a short path or we hit 256 character limit for paths
|
|
|
|
// using EXECUTOR_NUMBER guarantees that concurrent builds on same agent
|
|
|
|
// will not trample each other
|
|
|
|
dir("/mvn-it-${EXECUTOR_NUMBER}.tmp") {
|
|
|
|
def WORK_DIR=pwd()
|
|
|
|
checkout tests
|
|
|
|
bat "if exist it-local-repo rmdir /s /q it-local-repo"
|
|
|
|
bat "if exist apache-maven-dist.zip del /q apache-maven-dist.zip"
|
2017-01-09 04:49:16 -05:00
|
|
|
unstash 'dist'
|
2017-12-11 08:42:14 -05:00
|
|
|
withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
|
|
|
|
junitPublisher(ignoreAttachments: false)
|
|
|
|
]) {
|
|
|
|
bat "mvn clean install -P$CORE_IT_PROFILES -B -U -V -Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
|
|
|
|
}
|
|
|
|
deleteDir() // clean up after ourselves to reduce disk space
|
2017-01-09 04:49:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-03-23 22:25:17 -04:00
|
|
|
|
2017-12-11 08:42:14 -05:00
|
|
|
// 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"
|
2017-01-09 04:49:16 -05:00
|
|
|
}
|
2017-12-11 08:42:14 -05:00
|
|
|
throw e
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
currentBuild.result = "ABORTED"
|
|
|
|
throw e
|
|
|
|
} catch (Throwable e) {
|
|
|
|
currentBuild.result = "FAILURE"
|
|
|
|
throw e
|
|
|
|
} finally {
|
|
|
|
// notify completion
|
|
|
|
stage("Notifications") {
|
|
|
|
jenkinsNotify()
|
|
|
|
}
|
2017-01-09 04:49:16 -05:00
|
|
|
}
|