-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notification mechanism for realm-core nightly builds (#5661)
- Loading branch information
1 parent
90fbde9
commit fb5efcb
Showing
1 changed file
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" | ||
} | ||
} | ||
} |