[Jenkinsfile] Slack notification: use STAGING_REF if available, instead of branch name.

This commit is contained in:
Mat Sutcliffe
2019-01-12 21:43:00 +00:00
parent b213a90741
commit 86b236e366

4
Jenkinsfile vendored
View File

@@ -350,7 +350,9 @@ 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)}: `${scm.branches.first().name}`"
def branch = params.STAGING_REF ?: scm.branches.first().name
branch = branch.replaceFirst(/^refs\/tags\//, '')
def title = "${java.net.URLDecoder.decode(JOB_NAME)}: `${branch}`"
if (params.REVISION_ID != null) {
title += " - D${params.REVISION_ID} (Build ${params.BUILD_ID})"
}