simplify build and get rid of withMaven (#908)

* simplify build
This commit is contained in:
Olivier Lamy 2022-12-13 08:58:42 +10:00 committed by GitHub
parent 0e82026f2a
commit 3f336e4f6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 18 deletions

36
Jenkinsfile vendored
View File

@ -22,7 +22,7 @@ properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: e
def buildOs = 'linux' def buildOs = 'linux'
def buildJdk = '8' def buildJdk = '8'
def buildMvn = '3.6.3' def buildMvn = '3.6.3'
def runITsOses = ['linux', 'windows'] def runITsOses = ['linux']
def runITsJdks = ['8', '11', '17'] def runITsJdks = ['8', '11', '17']
def runITsMvn = '3.6.3' def runITsMvn = '3.6.3'
def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true
@ -49,23 +49,19 @@ node(jenkinsEnv.nodeSelection(osNode)) {
stage('Build / Unit Test') { stage('Build / Unit Test') {
String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk) String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk)
String mvnName = jenkinsEnv.mvnFromVersion(buildOs, buildMvn) String mvnName = jenkinsEnv.mvnFromVersion(buildOs, buildMvn)
withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/.repository", options:[ try {
artifactsPublisher(disabled: false), withEnv(["JAVA_HOME=${ tool "$jdkName" }",
junitPublisher(ignoreAttachments: false), "PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
findbugsPublisher(disabled: true), "MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
openTasksPublisher(disabled: true), sh "mvn clean ${MAVEN_GOAL} -B -U -e -fae -V -Dmaven.test.failure.ignore -PversionlessMavenDist -Dmaven.repo.local=${WORK_DIR}/.repository"
dependenciesFingerprintPublisher(disabled: false), }
invokerPublisher(disabled: true), } finally {
pipelineGraphPublisher(disabled: false) junit testResults: '**/target/surefire-reports/*.xml', allowEmptyResults: true
], publisherStrategy: 'EXPLICIT') { }
sh "mvn clean ${MAVEN_GOAL} -B -U -e -fae -V -Dmaven.test.failure.ignore -PversionlessMavenDist"
}
dir ('apache-maven/target') { dir ('apache-maven/target') {
stash includes: 'apache-maven-bin.zip', name: 'maven-dist' stash includes: 'apache-maven-bin.zip', name: 'maven-dist'
} }
} }
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']
} }
} }
@ -88,7 +84,10 @@ for (String os in runITsOses) {
// will not trample each other plus workaround for JENKINS-52657 // will not trample each other plus workaround for JENKINS-52657
dir(isUnix() ? 'test' : "c:\\mvn-it-${EXECUTOR_NUMBER}.tmp") { dir(isUnix() ? 'test' : "c:\\mvn-it-${EXECUTOR_NUMBER}.tmp") {
def WORK_DIR=pwd() def WORK_DIR=pwd()
checkout tests checkout([$class: 'GitSCM',
branches: [[name: "*/master"]],
extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]],
userRemoteConfigs: [[url: 'https://github.com/apache/maven-integration-testing.git']]])
if (isUnix()) { if (isUnix()) {
sh "rm -rvf $WORK_DIR/dists $WORK_DIR/it-local-repo" sh "rm -rvf $WORK_DIR/dists $WORK_DIR/it-local-repo"
} else { } else {
@ -99,9 +98,9 @@ for (String os in runITsOses) {
unstash 'maven-dist' unstash 'maven-dist'
} }
try { try {
withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[ withEnv(["JAVA_HOME=${ tool "$jdkName" }",
junitPublisher(ignoreAttachments: false) "PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
]) { "MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
String cmd = "${runITscommand} -DmavenDistro=$WORK_DIR/dists/apache-maven-bin.zip -Dmaven.test.failure.ignore" String cmd = "${runITscommand} -DmavenDistro=$WORK_DIR/dists/apache-maven-bin.zip -Dmaven.test.failure.ignore"
if (isUnix()) { if (isUnix()) {
@ -113,6 +112,7 @@ for (String os in runITsOses) {
} }
} }
} finally { } finally {
//junit testResults: '**/core-it-suite/**/target/surefire-reports/*.xml', allowEmptyResults: true
archiveDirs(stageId, ['core-it-suite-logs':'core-it-suite/target/test-classes', archiveDirs(stageId, ['core-it-suite-logs':'core-it-suite/target/test-classes',
'core-it-suite-reports':'core-it-suite/target/surefire-reports']) 'core-it-suite-reports':'core-it-suite/target/surefire-reports'])
deleteDir() // clean up after ourselves to reduce disk space deleteDir() // clean up after ourselves to reduce disk space