Commit 6528f910 authored by Raphael Defosseux's avatar Raphael Defosseux

Social media messaging abstraction

Signed-off-by: Raphael Defosseux's avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 40efcf48
Pipeline #10182 passed with stage
in 0 seconds
......@@ -101,9 +101,9 @@ pipeline {
if ("MERGE".equals(env.gitlabActionType)) {
addGitLabMRComment comment: message
def message2 = "OAI build #" + BUILD_ID + " passed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
slackSend channel: 'sandbox', color: 'good', message: message2
sendSocialMediaMessage('sandbox', 'good', message2)
} else {
slackSend channel: 'sandbox', color: 'good', message: message
sendSocialMediaMessage('sandbox', 'good', message)
}
}
}
......@@ -113,11 +113,21 @@ pipeline {
if ("MERGE".equals(env.gitlabActionType)) {
addGitLabMRComment comment: message
def message2 = "OAI build #" + BUILD_ID + " failed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
slackSend channel: 'sandbox', color: 'danger', message: message2
sendSocialMediaMessage('sandbox', 'danger', message2)
} else {
slackSend channel: 'sandbox', color: 'danger', message: message
sendSocialMediaMessage('sandbox', 'danger', message)
}
}
}
}
}
// Abstraction function to send social media messages:
// like on Slack or Mattermost
def sendSocialMediaMessage(pipeChannel, pipeMessage, pipeColor) {
if (params.pipelineUsesSlack != null) {
if (params.pipelineUsesSlack) {
slackSend channel: ${pipeChannel}, color: ${pipeColor}, message: ${pipeMessage}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment