build: Fix Jenkinsfile syntax

Turns out that "when" blocks are permitted but not effectual in "post"
sections so instead use a script behaviour to make the message
conditional on build change.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-08-05 13:29:52 +01:00
parent b5d64be479
commit 44cf97e2fd

15
Jenkinsfile vendored
View File

@ -128,15 +128,20 @@ pipeline{
}
post {
regression {
when { branch 'master' }
slackSend (color: '#ff0000', message: '"master" branch build is now failing')
script {
if (env.BRANCH_NAME == 'master') {
slackSend (color: '#ff0000', message: '"master" branch build is now failing')
}
}
}
fixed {
when { branch 'master' }
slackSend (color: '#00ff00', message: '"master" branch build is now fixed')
script {
if (env.BRANCH_NAME == 'master') {
slackSend (color: '#00ff00', message: '"master" branch build is now fixed')
}
}
}
}
}
def cancelPreviousBuilds() {