Merge pull request #7131 from corda/connelm/INFRA-1743/release-email-notification4.8

INFRA-1743 Activate C4 email notifications Open source and Ent
This commit is contained in:
Ronan Browne 2022-05-11 09:50:37 +01:00 committed by GitHub
commit 7f0b425c83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
* Jenkins pipeline to build Corda OS release branches and tags.
* PLEASE NOTE: we DO want to run a build for each commit!!!
*/
@Library('corda-shared-build-pipeline-steps')
/**
* Sense environment
@ -41,17 +42,6 @@ def nexusIqStageChoices = [nexusDefaultIqStage].plus(
'operate'
].minus([nexusDefaultIqStage]))
/**
* define an empty teamsWebHookURL and if it is a Release Branch
* then set it for the Corda 4 Jenkins Connector
*/
def teamsWebHookURL = ""
if (isReleaseBranch || isReleaseTag){
withCredentials([string(credentialsId: 'ms-teams-webhook', variable: 'webhook_url')]) {
teamsWebHookURL = "$webhook_url"
}
}
/**
* Common Gradle arguments for all Gradle executions
*/
@ -74,18 +64,6 @@ pipeline {
parallelsAlwaysFailFast()
timeout(time: 6, unit: 'HOURS')
timestamps()
office365ConnectorWebhooks([[
name : "Corda 4 Jenkins Connector",
notifyBackToNormal : true,
startNotification : false,
notifyFailure : true,
notifySuccess : true,
notifyNotBuilt : false,
notifyAborted : false,
notifyRepeatedFailure: true,
notifyUnstable : true,
url : "${teamsWebHookURL}"
]])
}
parameters {
@ -102,6 +80,7 @@ pipeline {
CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}"
CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}"
DOCKER_URL = "https://index.docker.io/v1/"
EMAIL_RECIPIENTS = credentials('corda4-email-recipient')
}
stages {
@ -407,6 +386,24 @@ pipeline {
}
}
}
success {
script {
sendSlackNotifications("good", "BUILD PASSED", true, "#corda-corda4-open-source-build-notifications")
}
}
unstable {
script {
sendSlackNotifications("warning", "BUILD UNSTABLE - Unstable Builds are likely a result of Nexus Sonar Scanner violations", true, "#corda-corda4-open-source-build-notifications")
}
}
failure {
script {
sendSlackNotifications("danger", "BUILD FAILURE", true, "#corda-corda4-open-source-build-notifications")
if (isReleaseTag || isReleaseBranch || isReleaseCandidate) {
sendEmailNotifications("${env.EMAIL_RECIPIENTS}")
}
}
}
cleanup {
deleteDir() /* clean up our workspace */
}