Much appreciated for the debugging and answers. Although I've found the current pipeline might be a bit too complicated, but that's likely another story. I was able to narrow down the issue a bit more based on your feedback, for some reason the PATH environment variable get corrupted, so the below snippet produces
def forLinux() (
return {
node('linux'){
try {
sh label: 'Pre-Environment', script: 'env | sort' // only for debugging purposes
deleteDir()
unstash 'source'
retry(2){
sleep 23
sh(label: "Run Tests"...
}
sh label: 'Post-Environment', script: 'env | sort' // only for debugging purposes
} catch(e){
error(e.toString())
} finally {
sh label: 'Environment', script: 'env | sort' // only for debugging purposes
...
}
}
}
}
I just managed to add the withEnv to ensure the PATH is defined, although not sure how it gets corrupted though, as that particular behaviour does not happen when the above snippet in a parallel step without any other references but calls to the forLinux For instance, the below snippet shows how the parallel is configured for the issue with the nohup and a similar one which does not fail with the nohup.
stage('FailedWithNoHup') {
environment {
HOME = "${env.WORKSPACE}"
}
steps {
def parallelTasks = [:]
parallelTasks["Linux-1"] = forLinux(version: 1)
parallelTasks["Linux-2"] = forLinux(version: 2)
parallelTasks["Windows-1"] = forWindows(version: 1)
}
}
stage('Works') {
environment {
HOME = "${env.WORKSPACE}"
}
steps {
def parallelTasks = [:]
parallelTasks["Linux-1"] = forLinux(version: 1)
parallelTasks["Linux-2"] = forLinux(version: 2)
parallel(parallelTasks)
}
}
def forLinux(Map params = [:]){
def version = params?.version
return {
node('linux'){
try {
sh label: 'Pre-Environment', script: 'env | sort' // only for debugging purposes
deleteDir()
unstash 'source'
retry(2){
sleep 23
sh(label: "Run Tests"...
}
sh label: 'Post-Environment', script: 'env | sort' // only for debugging purposes
} catch(e){
error(e.toString())
} finally {
sh label: 'Environment', script: 'env | sort' // only for debugging purposes
...
}
}
}
}
def forWindows(Map params = [:]){
return {
node('windows'){
...
}
}
}
|