This is an automated email from the ASF dual-hosted git repository. rfscholte pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-jenkins-lib.git
commit 1a157bb911d8086d6d754b0c59aa8ec0d3c32a65 Author: rfscholte <[email protected]> AuthorDate: Sat Sep 26 12:45:21 2020 +0200 introduce optional tmpWs --- vars/asfMavenTlpStdBuild.groovy | 123 +++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 58 deletions(-) diff --git a/vars/asfMavenTlpStdBuild.groovy b/vars/asfMavenTlpStdBuild.groovy index 2fd3354..e7e30be 100644 --- a/vars/asfMavenTlpStdBuild.groovy +++ b/vars/asfMavenTlpStdBuild.groovy @@ -36,6 +36,7 @@ def call(Map params = [:]) { // minimum, LTS, current and next ea def jdks = params.containsKey('jdks') ? params.jdks : params.containsKey('jdk') ? params.jdk : ['7','8','11'] //['7','8','11','14','15'] def maven = params.containsKey('maven') ? params.maven : '3.x.x' + def tmpWs = params.containsKey('tmpWs') ? params.tmpWs : false // def failFast = params.containsKey('failFast') ? params.failFast : true // Just temporarily def failFast = false; @@ -75,68 +76,74 @@ def call(Map params = [:]) { String stageId = "${os}-jdk${jdk}" tasks[stageId] = { node("${label}") { - stage("Checkout ${stageId}") { - echo "NODE_NAME = ${env.NODE_NAME}" - try { - dir('m') { - checkout scm - } - } catch (Throwable e) { - // First step to keep the workspace clean and safe disk space - cleanWs() - if (!failFast) { - throw e - } else if (failingFast == null) { - failingFast = stageId - echo "[FAIL FAST] This is the first failure and likely root cause" - throw e - } else { - echo "[FAIL FAST] ${failingFast} had first failure, ignoring ${e.message}" - } - } + def wsDir = pwd() + if (os == 'windows' && tmpWs) { + wsDir = 'F:\\short\\' + "$BUILD_TAG".replaceAll(/(.+)_maven-box_maven-(.+)/) { "m-${it[2]}" } } - stage("Build ${stageId}") { - if (failingFast != null) { - cleanWs() - echo "[FAIL FAST] ${failingFast} has failed. Skipping ${stageId}." - } else try { - // mavenSettingsConfig: 'simple-deploy-settings-no-mirror', - withMaven(jdk:jdkName, maven:mvnName, mavenLocalRepo:'.repository', - options: [ - artifactsPublisher(disabled: disablePublishers), - junitPublisher(ignoreAttachments: false), - findbugsPublisher(disabled: disablePublishers), - openTasksPublisher(disabled: disablePublishers), - dependenciesFingerprintPublisher(disabled: disablePublishers), -// DISABLED DUE TO INFRA-17514 invokerPublisher(), - pipelineGraphPublisher(disabled: disablePublishers) - ], publisherStrategy: 'EXPLICIT') { - dir ('m') { - if (isUnix()) { - sh cmd.join(' ') - } else { - bat cmd.join(' ') + ws( dir : "$wsDir" ) { + stage("Checkout ${stageId}") { + echo "NODE_NAME = ${env.NODE_NAME}" + try { + dir('m') { + checkout scm + } + } catch (Throwable e) { + // First step to keep the workspace clean and safe disk space + cleanWs() + if (!failFast) { + throw e + } else if (failingFast == null) { + failingFast = stageId + echo "[FAIL FAST] This is the first failure and likely root cause" + throw e + } else { + echo "[FAIL FAST] ${failingFast} had first failure, ignoring ${e.message}" + } + } + } + stage("Build ${stageId}") { + if (failingFast != null) { + cleanWs() + echo "[FAIL FAST] ${failingFast} has failed. Skipping ${stageId}." + } else try { + // mavenSettingsConfig: 'simple-deploy-settings-no-mirror', + withMaven(jdk:jdkName, maven:mvnName, mavenLocalRepo:'.repository', + options: [ + artifactsPublisher(disabled: disablePublishers), + junitPublisher(ignoreAttachments: false), + findbugsPublisher(disabled: disablePublishers), + openTasksPublisher(disabled: disablePublishers), + dependenciesFingerprintPublisher(disabled: disablePublishers), + // DISAED DUE TO INFRA-17514 invokerPublisher(), + pipelineGraphPublisher(disabled: disablePublishers) + ], publisherStrategy: 'EXPLICIT') { + dir ('m') { + if (isUnix()) { + sh cmd.join(' ') + } else { + bat cmd.join(' ') + } } } - } - } catch (Throwable e) { - echo "[FAILURE-004] ${e}" - // First step to keep the workspace clean and safe disk space - cleanWs() - if (!failFast) { - throw e - } else if (failingFast == null) { - failingFast = stageId - echo "[FAIL FAST] This is the first failure and likely root cause" - throw e - } else { - echo "[FAIL FAST] ${failingFast} had first failure, ignoring ${e.message}" - } - } finally { - try { + } catch (Throwable e) { + echo "[FAILURE-004] ${e}" + // First step to keep the workspace clean and safe disk space cleanWs() - } catch(IOException e) { - echo "Failed to clean up workspace: ${e}" + if (!failFast) { + throw e + } else if (failingFast == null) { + failingFast = stageId + echo "[FAIL FAST] This is the first failure and likely root cause" + throw e + } else { + echo "[FAIL FAST] ${failingFast} had first failure, ignoring ${e.message}" + } + } finally { + try { + cleanWs() + } catch(IOException e) { + echo "Failed to clean up workspace: ${e}" + } } } }
