From 86b236e366a541104fd52539525c5399a2fee367 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Sat, 12 Jan 2019 21:43:00 +0000 Subject: [PATCH] [Jenkinsfile] Slack notification: use STAGING_REF if available, instead of branch name. --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c5fe8831c..5cea15d92 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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})" }