I ran into the same problem as others did. I am using Durable Task Plugin 1.23 I have a Pipeline which takes a very long time, and looks like this:
#!groovypipeline {
agent {
label 'CRAIG-1'
} options {
disableConcurrentBuilds()
timeout(time: 10, unit: 'HOURS')
} parameters {
booleanParam(name: 'UPDATE_PARAMETERS',
defaultValue: false,
description: 'Update the parameters from this pipeline script') string(defaultValue: 'master',
description: 'branch',
name: 'BRANCH')
} stages {
stage("Display build parameters") {
steps {
script {
/*
* Print out the build parameters
*/
def all_params = "" for ( k in params ) {
all_params = all_params + "${k.key}=${k.value}\n"
} print("These parameters were passed to this build:\n" + all_params)
writeFile(file: "env-vars.txt", text: "$all_params")
}
}
} /*
* Jenkins needs to parse the entire pipeline before it can
* parse the parameters, if the parameters are specified in this file.
*/
stage("Updating Parameters") {
when {
expression {
params.UPDATE_PARAMETERS == true
}
}
steps {
script {
currentBuild.result = 'ABORTED'
error('DRY RUN COMPLETED. JOB PARAMETERIZED.')
}
}
} stage("First") {
steps {
dir("dir1") {
git(url: 'https://github.com/twisted/twisted')
sh("""
echo do some stuff
""")
}
}
} stage("Second") {
steps {
dir("dir2") {
git(url: 'https://github.com/twisted/twisted')
sh("""
echo do more stuff
""")
}
}
} stage("Third: Takes a long time, over 1.5 hours") {
steps {
sh("""
echo this operation takes a long time
""")
}
post {
always {
junit "report.xml"
}
}
}
} post {
failure {
slackSend (channel: '#channel-alerts', color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} started by ${env.CAUSEDBY} [${env.BUILD_NUMBER}]' (${env.RUN_DISPLAY_URL})");
} changed {
script {
/*
* Only send e-mails on failures, or when status changes from failure
* to success, or success to failure.
* This requires currentBuild.result to be set.
*
* See: https://baptiste-wicht.com/posts/2017/06/jenkins-tip-send-notifications-fixed-builds-declarative-pipeline.html
*/
def prevBuild = currentBuild.getPreviousBuild()
/*
* If this pipeline has never run before, then prevBuild will be null.
*/
if (prevBuild == null) {
return
}
def prevResult = prevBuild.getResult()
def result = currentBuild.getResult()
if ("${prevResult}" != "${result}" && "${result}" != "FAILURE") {
if ("${prevResult}" == "FAILURE") {
slackSend(channel: '#smoketest-alerts', color: 'good', message: "SUCCEEDED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.RUN_DISPLAY_URL})")
}
}
}
}
}
}
In Manage Jenkins -> System Log I enabled a logger to log ALL events for org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep After running my pipeline for 2 hours, Jenkins terminated the pipeline, and I saw this in the log:
Post stage
wrapper script does not seem to be touching the log file in /root/workspace/workspace/PX-TEST-STABLE@tmp/durable-502ca4bd
(JENKINS-48300: if on a laggy filesystem, consider -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=300)
|