From d380df2e4dc6aad37ad2b8b6c060453a208edded Mon Sep 17 00:00:00 2001
From: Greg Fodor <gfodor@gmail.com>
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 = (
+            "*<http://localhost:8080/job/${env.JOB_NAME}/${env.BUILD_NUMBER}|#${env.BUILD_NUMBER}>* *${env.JOB_NAME}* " +
+            "<https://github.com/mozilla/hubs/commit/$gitSha|$gitSha> " +
+            "Hubs: ```${gitSha} ${gitMessage}```\n" +
+            "<https://smoke-hubs.mozilla.com/0zuesf6c6mf/smoke-test?pollForSha=${gitSha}|Smoke Test> - 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}"
         }
       }
     }
-- 
GitLab