Skip to content

Commit

Permalink
Notification mechanism for realm-core nightly builds (#5661)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola-cab authored Jul 18, 2022
1 parent 90fbde9 commit fb5efcb
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion nightly.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
def run = build '/realm/realm-core/master'

import groovy.json.JsonOutput
def run = build job:'/realm/realm-core/master', propagate: false
node {
withCredentials([[$class: 'StringBinding', credentialsId: 'slack-realm-core-ci-alerts-url', variable: 'SLACK_URL']]) {
def payload = null
if (run.getResult() == "SUCCESS") {
payload = JsonOutput.toJson([
username: "Realm CI",
icon_emoji: ":jenkins:",
text: "*The current realm-core nightly build was ok!*\n<${run.absoluteUrl}|Click here> to check the build."
])
currentBuild.result = "SUCCESS"
} else if(run.getResult() == "FAILURE"){
payload = JsonOutput.toJson([
username: "Realm CI",
icon_emoji: ":jenkins:",
text: "@realm-core-engineers *The current realm-core nightly build is broken!*\n<${run.absoluteUrl}|Click here> to check the build.",
link_names: 1
])
currentBuild.result = "FAILURE"
}
// otherwise the build was aborted, because no nightly build was needed, but in this case we don't need to signal anything
if (payload != null) {
sh "curl -X POST --data-urlencode \'payload=${payload}\' ${env.SLACK_URL}"
}
}
}

0 comments on commit fb5efcb

Please sign in to comment.