File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ pipeline {
55 DIRS_TO_CLEAN_PER_NODE = '/tmp,/opt/jenkins/workspace'
66 DIRS_TO_CLEAN_SHARED = '/mnt/team/simulation_science/priv/engineering/jenkins/envs'
77 DAYS_OLD = '3'
8+ TIMEOUT = '120' // minutes
89 }
910
1011 options {
1112 skipDefaultCheckout()
12- timeout(time: 60 , unit: 'MINUTES')
13+ timeout(time: env.TIMEOUT.toInteger() , unit: 'MINUTES')
1314 timestamps()
1415 buildDiscarder(logRotator(numToKeepStr: '30'))
1516 }
@@ -107,6 +108,28 @@ pipeline {
107108 success {
108109 echo "All node cleanups completed successfully"
109110 }
111+ aborted {
112+ echo "Node cleanup was aborted (likely due to timeout)"
113+ // Generate a message to send to Slack.
114+ script {
115+ def channelName = "simsci-ci-status"
116+ def slackID = "channel"
117+ def slackMessage = """
118+ Cleanup was aborted (likely due to the ${env.TIMEOUT}-minute timeout).
119+
120+ Job: *${env.JOB_NAME}*
121+ Build number: #${env.BUILD_NUMBER}
122+ Build status: *${currentBuild.result}*
123+ Author: @${slackID}
124+ Build details: <${env.BUILD_URL}/console|See in web console>
125+ """.stripIndent()
126+
127+ slackSend channel: "#${channelName}",
128+ message: slackMessage,
129+ teamDomain: "ihme",
130+ tokenCredentialId: "slack"
131+ }
132+ }
110133 failure {
111134 echo "Node cleanup failed - check the failed stage logs for details"
112135 // Generate a message to send to Slack.
You can’t perform that action at this time.
0 commit comments