feat(ci): transition the Slack notification from old pipeline to container-based pipeline.
* Also added a parameter for the registry push pipeline. Valid mainly when triggering manually the pipeline when run on develop fails. * Nicer message2 construction Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
@@ -449,6 +449,10 @@ pipeline {
|
|||||||
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")"
|
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ")"
|
||||||
if ("MERGE".equals(env.gitlabActionType)) {
|
if ("MERGE".equals(env.gitlabActionType)) {
|
||||||
addGitLabMRComment comment: message
|
addGitLabMRComment comment: message
|
||||||
|
def message2 = message + " -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
||||||
|
sendSocialMediaMessage('ci-enb', 'good', message2)
|
||||||
|
} else {
|
||||||
|
sendSocialMediaMessage('ci-enb', 'good', message)
|
||||||
}
|
}
|
||||||
echo "Pipeline is SUCCESSFUL"
|
echo "Pipeline is SUCCESSFUL"
|
||||||
}
|
}
|
||||||
@@ -458,6 +462,10 @@ pipeline {
|
|||||||
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")"
|
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")"
|
||||||
if ("MERGE".equals(env.gitlabActionType)) {
|
if ("MERGE".equals(env.gitlabActionType)) {
|
||||||
addGitLabMRComment comment: message
|
addGitLabMRComment comment: message
|
||||||
|
def message2 = message + " -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
||||||
|
sendSocialMediaMessage('ci-enb', 'danger', message2)
|
||||||
|
} else {
|
||||||
|
sendSocialMediaMessage('ci-enb', 'danger', message)
|
||||||
}
|
}
|
||||||
echo "Pipeline FAILED"
|
echo "Pipeline FAILED"
|
||||||
}
|
}
|
||||||
@@ -541,3 +549,9 @@ def finalizeSlaveJob(jobName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abstraction function to send social media messages:
|
||||||
|
// like on Slack or Mattermost
|
||||||
|
def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) {
|
||||||
|
slackSend channel: pipeChannel, color: pipeColor, message: pipeMessage
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,16 +20,6 @@
|
|||||||
* contact@openairinterface.org
|
* 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Location of the executor node
|
// Location of the executor node
|
||||||
def nodeExecutor = params.nodeExecutor
|
def nodeExecutor = params.nodeExecutor
|
||||||
|
|
||||||
@@ -389,10 +379,6 @@ OAI CI Team''',
|
|||||||
if ("MERGE".equals(env.gitlabActionType)) {
|
if ("MERGE".equals(env.gitlabActionType)) {
|
||||||
echo "This is a MERGE event"
|
echo "This is a MERGE event"
|
||||||
addGitLabMRComment comment: message
|
addGitLabMRComment comment: message
|
||||||
def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): passed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
|
||||||
sendSocialMediaMessage('ci-enb', 'good', message2)
|
|
||||||
} else {
|
|
||||||
sendSocialMediaMessage('ci-enb', 'good', message)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -402,10 +388,6 @@ OAI CI Team''',
|
|||||||
if ("MERGE".equals(env.gitlabActionType)) {
|
if ("MERGE".equals(env.gitlabActionType)) {
|
||||||
echo "This is a MERGE event"
|
echo "This is a MERGE event"
|
||||||
addGitLabMRComment comment: message
|
addGitLabMRComment comment: message
|
||||||
def message2 = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ") -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
|
|
||||||
sendSocialMediaMessage('ci-enb', 'danger', message2)
|
|
||||||
} else {
|
|
||||||
sendSocialMediaMessage('ci-enb', 'danger', message)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,12 @@ pipeline {
|
|||||||
WEEK_REF = WEEK_REF.trim()
|
WEEK_REF = WEEK_REF.trim()
|
||||||
WEEK_TAG = sh returnStdout: true, script: 'python3 ./ci-scripts/provideUniqueImageTag.py --start_tag ' + WEEK_REF
|
WEEK_TAG = sh returnStdout: true, script: 'python3 ./ci-scripts/provideUniqueImageTag.py --start_tag ' + WEEK_REF
|
||||||
WEEK_TAG = WEEK_TAG.trim()
|
WEEK_TAG = WEEK_TAG.trim()
|
||||||
|
if ((params.forceTag != null) && (params.tagToUse != null)) {
|
||||||
|
if (params.forceTag) {
|
||||||
|
WEEK_TAG = params.tagToUse
|
||||||
|
echo "Forced Tag is ${WEEK_TAG}"
|
||||||
|
}
|
||||||
|
}
|
||||||
WEEK_SHA = sh returnStdout: true, script: 'git log -n1 --pretty=format:"%h" origin/develop | cut -c 1-8'
|
WEEK_SHA = sh returnStdout: true, script: 'git log -n1 --pretty=format:"%h" origin/develop | cut -c 1-8'
|
||||||
WEEK_SHA = WEEK_SHA.trim()
|
WEEK_SHA = WEEK_SHA.trim()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user