[Jenkinsfile] Using scm.branches for Slack as BRANCH_NAME is only available in multi-branch jobs.

This commit is contained in:
Mat Sutcliffe
2018-12-31 18:12:05 +00:00
parent cec893cc27
commit ac91c8fa09

2
Jenkinsfile vendored
View File

@@ -362,7 +362,7 @@ def notifySlack(nodeName, buildStatus = 'STARTED') {
def colorCode = '#FF0000'
def emoji = ':question:'
def duration = currentBuild.durationString.replace(' and counting', '')
def title = "${java.net.URLDecoder.decode(JOB_NAME)} (`${BRANCH_NAME}`)"
def title = "${java.net.URLDecoder.decode(JOB_NAME)}: `${scm.branches.first().name}`"
if (params.REVISION_ID != null) {
title += " - D${params.REVISION_ID} (Build ${params.BUILD_ID})"
}