From 0381bac5845db1eeaa830e85229093f18d7e3db3 Mon Sep 17 00:00:00 2001 From: Sean Flanigan Date: Thu, 20 Oct 2016 22:27:53 +1000 Subject: [PATCH] Improve HipChat message --- Jenkinsfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9fa3a898153..416ffb21d49 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,26 +25,30 @@ void printNode() { println "running on node ${env.NODE_NAME}" } +def jobLink() { + "${env.JOB_NAME} #${env.BUILD_NUMBER}" +} + def notifyStarted() { - hipchatSend color: "GRAY", notify: true, message: "STARTED: Job ${env.JOB_NAME} #${env.BUILD_NUMBER}" + hipchatSend color: "GRAY", notify: true, message: "STARTED: Job " + jobLink() } def notifyTestResults(def testType) { // if tests have failed currentBuild.result will be 'UNSTABLE' if (currentBuild.result != null) { - hipchatSend color: "YELLOW", notify: true, message: "TESTS FAILED ($testType): Job ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL})" + hipchatSend color: "YELLOW", notify: true, message: "TESTS FAILED ($testType): Job " + jobLink() } else { - hipchatSend color: "GREEN", notify: true, message: "TESTS PASSED ($testType): Job ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL})" + hipchatSend color: "GREEN", notify: true, message: "TESTS PASSED ($testType): Job " + jobLink() } } def notifySuccessful() { - hipchatSend color: "GRAY", notify: true, message: "SUCCESSFUL: Job ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL})" + hipchatSend color: "GRAY", notify: true, message: "SUCCESSFUL: Job " + jobLink() } // TODO try-catch build exception and call this: def notifyFailed() { - hipchatSend color: "RED", notify: true, message: "FAILED: Job ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL})" + hipchatSend color: "RED", notify: true, message: "FAILED: Job " + jobLink() } timestamps {