Commit f911895b authored by Raphael Defosseux's avatar Raphael Defosseux

CI: added abstraction layer to social messaging

  -- a boolean parameter should be added to master eNB job
  -- for slack: pipelineUsesSlack
     if not present or false, no message will be sent
Signed-off-by: Raphael Defosseux's avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 2e609df3
#!/bin/groovy
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
......@@ -19,6 +20,16 @@
* contact@openairinterface.org
*/
// Abstraction function to send social media messages:
// like on Slack or Mattermost
def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) {
if (params.pipelineUsesSlack != null) {
if (params.pipelineUsesSlack) {
slackSend channel: pipeChannel, color: pipeColor, message: pipeMessage
}
}
}
pipeline {
agent {
label 'bellatrix'
......@@ -229,9 +240,9 @@ pipeline {
echo "This is a MERGE event"
addGitLabMRComment comment: message
def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
slackSend channel: 'ci-enb', color: 'good', message: message2
sendSocialMediaMessage('ci-enb', 'good', message2)
} else {
slackSend channel: 'ci-enb', color: 'good', message: message
sendSocialMediaMessage('ci-enb', 'good', message)
}
}
}
......@@ -242,9 +253,9 @@ pipeline {
echo "This is a MERGE event"
addGitLabMRComment comment: message
def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
slackSend channel: 'ci-enb', color: 'danger', message: message2
sendSocialMediaMessage('ci-enb', 'danger', message2)
} else {
slackSend channel: 'ci-enb', color: 'danger', message: message
sendSocialMediaMessage('ci-enb', 'danger', message)
}
}
}
......
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