From d380df2e4dc6aad37ad2b8b6c060453a208edded Mon Sep 17 00:00:00 2001 From: Greg Fodor Date: Thu, 12 Jul 2018 23:50:04 +0000 Subject: [PATCH] Add slack message --- Jenkinsfile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 75d94f66e..3a15e7d66 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,24 @@ pipeline { def slackUrl = env.SLACK_URL def habCommand = "sudo /usr/bin/hab-docker-studio -k mozillareality run /bin/bash scripts/hab-build-and-push.sh ${baseAssetsPath} ${assetBundleServer} ${targetS3Url}" - sh "/usr/bin/script --return -c ${shellString(habCommand)} /dev/null" + // sh "/usr/bin/script --return -c ${shellString(habCommand)} /dev/null" + + def gitMessage = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'[%an] %s'").trim() + def gitSha = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim() + def text = ( + "** *${env.JOB_NAME}* " + + " " + + "Hubs: ```${gitSha} ${gitMessage}```\n" + + " - to push:\n" + + "`/mr hubs deploy`" + ) + def payload = 'payload=' + JsonOutput.toJson([ + text : text, + channel : "#mr-builds", + username : "buildbot", + icon_emoji: ":gift:" + ]) + sh "curl -X POST --data-urlencode ${shellString(payload)} ${slackURL}" } } }