catch exception in slack notification to avoid any build failure due to this (#3794)
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
parent
e19cc68a38
commit
01a02cc15b
|
@ -92,7 +92,6 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
post {
|
||||
failure {
|
||||
slackNotif()
|
||||
|
@ -104,24 +103,29 @@ pipeline {
|
|||
slackNotif()
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
def slackNotif() {
|
||||
script {
|
||||
if (env.BRANCH_NAME=='jetty-10.0.x' ||
|
||||
env.BRANCH_NAME=='jetty-9.4.x') {
|
||||
try
|
||||
{
|
||||
if ( env.BRANCH_NAME == 'jetty-10.0.x' || env.BRANCH_NAME == 'jetty-9.4.x' )
|
||||
{
|
||||
//BUILD_USER = currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserId()
|
||||
// by ${BUILD_USER}
|
||||
COLOR_MAP = ['SUCCESS': 'good', 'FAILURE': 'danger', 'UNSTABLE': 'danger', 'ABORTED': 'danger']
|
||||
slackSend channel: '#jenkins',
|
||||
color: COLOR_MAP[currentBuild.currentResult],
|
||||
message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} - ${env.BUILD_URL}"
|
||||
color: COLOR_MAP[currentBuild.currentResult],
|
||||
message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} - ${env.BUILD_URL}"
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
echo "skip failure slack notification: " + e.getMessage()
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* To other developers, if you are using this method above, please use the following syntax.
|
||||
|
|
Loading…
Reference in New Issue