introduce optional tmpWs for Windows to prevent long path failures
diff --git a/vars/asfMavenTlpStdBuild.groovy b/vars/asfMavenTlpStdBuild.groovy
index ac3ce61..aed3d8c 100644
--- a/vars/asfMavenTlpStdBuild.groovy
+++ b/vars/asfMavenTlpStdBuild.groovy
@@ -33,12 +33,13 @@
// now determine the matrix of parallel builds
def oses = params.containsKey('os') ? params.os : ['linux', 'windows']
- // minimum, LTS, current and next ea
+ // 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 failFast = params.containsKey('failFast') ? params.failFast : true
// Just temporarily
def failFast = false;
+ def tmpWs = params.containsKey('tmpWs') ? params.tmpWs : false
Map tasks = [failFast: failFast]
boolean first = true
for (String os in oses) {
@@ -75,33 +76,38 @@
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' && taskContext.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',
+ 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),
@@ -111,34 +117,35 @@
// DISABLED DUE TO INFRA-17514 invokerPublisher(),
pipelineGraphPublisher(disabled: disablePublishers)
], publisherStrategy: 'EXPLICIT') {
- dir ('m') {
- if (isUnix()) {
- sh cmd.join(' ')
- } else {
- bat cmd.join(' ')
+ 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}"
+ }
+ }
+ }
}
}
}
@@ -179,7 +186,7 @@
echo "***** FAST FAILURE *****\n\nFast failure triggered by ${failingFast}\n\n***** FAST FAILURE *****"
}
stage("Notifications") {
- jenkinsNotify()
+ jenkinsNotify()
}
}
}