From 1b6afd2e4b4b73135efc5bd8a4e9730919ece52d Mon Sep 17 00:00:00 2001 From: Jordan Jennings Date: Mon, 25 Sep 2023 11:47:21 -0400 Subject: [PATCH] Align Slack notifications for Jenkins app and webhook (#98) The notification format when using the SlackJenkinsAppNotifyTarget class differs from the SlackWebHookNotifyTarget format. This commit aligns the two message formats to be the same and fixes a slight malformatting issue present only in SlackJenkinsAppNotifyTarget which mangles URLs at the end of the message. --- .../library/notify/SlackJenkinsAppNotifyTarget.groovy | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/com/boxboat/jenkins/library/notify/SlackJenkinsAppNotifyTarget.groovy b/src/com/boxboat/jenkins/library/notify/SlackJenkinsAppNotifyTarget.groovy index 707c0f3..a22f043 100644 --- a/src/com/boxboat/jenkins/library/notify/SlackJenkinsAppNotifyTarget.groovy +++ b/src/com/boxboat/jenkins/library/notify/SlackJenkinsAppNotifyTarget.groovy @@ -18,10 +18,14 @@ class SlackJenkinsAppNotifyTarget extends BaseConfig)\n" + message def slackSendOptions = [ - color : color, - message: message, + message: "*${URLDecoder.decode(Config.pipeline.env.JOB_NAME, "UTF-8")}* (<${Config.pipeline.env.BUILD_URL}|build #${Config.pipeline.env.BUILD_NUMBER}>)", + attachments: [ + [ + color: color, + text : message, + ] + ] ] if (channel) { slackSendOptions["channel"] = channel