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

11
Jenkinsfile vendored
View File

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