From 836c38e50e7d730d482d4ff6989fef4861205f8d Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Mon, 31 Dec 2018 00:13:39 +0000 Subject: [PATCH] [Jenkinsfile] Post comment on Differential revision when build finishes. --- Jenkinsfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1e587adb4..880b54c3c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -334,6 +334,18 @@ def notifyHarbormaster() { def type = currentBuild.resultIsBetterOrEqualTo('SUCCESS') ? 'pass' : 'fail' def json = """{ "buildTargetPHID": "${params.PHID}", "type": "${type}" }""" sh "echo '${json}' | ${arcCmd} harbormaster.sendmessage" + + def icon = '{icon question-circle color=orange}' + if (currentBuild.result == 'SUCCESS') { + icon = '{icon check color=green}' + } else if (currentBuild.result == 'FAILURE') { + icon = '{icon times color=red}' + } else if (currentBuild.result == 'UNSTABLE') { + icon = '{icon exclamation-triangle color=orange}' + } + def comment = "${icon} {${params.PHID}} ${currentBuild.currentResult}: ${env.BUILD_URL}" + json = """{ "objectIdentifier": "D${params.REVISION_ID}", "transactions": [{ "type": "comment", "value": "${comment}" }] }""" + sh "echo '${json}' | ${arcCmd} differential.revision.edit" } }