This repository has been archived by the owner on May 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Jenkinsfile
44 lines (44 loc) · 2.67 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
pipeline {
agent any
options {
timeout(time: 30, unit: 'MINUTES')
}
tools {
jdk 'jdk_8u144'
gradle 'gradle_4.7'
}
stages {
stage('Test') {
steps {
sh 'gradle clean test'
}
post {
always {
junit 'build/test-results/test/TEST-*.xml'
}
}
}
}
post {
success {
withCredentials([string(credentialsId: 'discord.webhook.channel', variable: 'WEBHOOK_CHANNEL'), string(credentialsId: 'discord.webhook.token', variable: 'WEBHOOK_TOKEN')]) {
sh "curl -X POST --data '{ \"embeds\": [{\"title\":\"DiscordIntegrationCore\",\"type\":\"link\",\"description\":\"Build $BRANCH_NAME $BUILD_DISPLAY_NAME\",\"url\":\"$BUILD_URL\",\"color\":709124,\"fields\":[{\"name\":\"Status\",\"value\":\"$currentBuild.currentResult\"}]}] }' -H \"Content-Type: application/json\" https://discordapp.com/api/webhooks/$WEBHOOK_CHANNEL/$WEBHOOK_TOKEN"
}
}
unstable {
withCredentials([string(credentialsId: 'discord.webhook.channel', variable: 'WEBHOOK_CHANNEL'), string(credentialsId: 'discord.webhook.token', variable: 'WEBHOOK_TOKEN')]) {
sh "curl -X POST --data '{ \"embeds\": [{\"title\":\"DiscordIntegrationCore\",\"type\":\"link\",\"description\":\"Build $BRANCH_NAME $BUILD_DISPLAY_NAME\",\"url\":\"$BUILD_URL\",\"color\":15989262,\"fields\":[{\"name\":\"Status\",\"value\":\"$currentBuild.currentResult\"}]}] }' -H \"Content-Type: application/json\" https://discordapp.com/api/webhooks/$WEBHOOK_CHANNEL/$WEBHOOK_TOKEN"
}
}
failure {
withCredentials([string(credentialsId: 'discord.webhook.channel', variable: 'WEBHOOK_CHANNEL'), string(credentialsId: 'discord.webhook.token', variable: 'WEBHOOK_TOKEN')]) {
sh "curl -X POST --data '{ \"embeds\": [{\"title\":\"DiscordIntegrationCore\",\"type\":\"link\",\"description\":\"Build $BRANCH_NAME $BUILD_DISPLAY_NAME\",\"url\":\"$BUILD_URL\",\"color\":13698309,\"fields\":[{\"name\":\"Status\",\"value\":\"$currentBuild.currentResult\"}]}] }' -H \"Content-Type: application/json\" https://discordapp.com/api/webhooks/$WEBHOOK_CHANNEL/$WEBHOOK_TOKEN"
}
}
aborted {
withCredentials([string(credentialsId: 'discord.webhook.channel', variable: 'WEBHOOK_CHANNEL'), string(credentialsId: 'discord.webhook.token', variable: 'WEBHOOK_TOKEN')]) {
sh "curl -X POST --data '{ \"embeds\": [{\"title\":\"DiscordIntegrationCore\",\"type\":\"link\",\"description\":\"Build $BRANCH_NAME $BUILD_DISPLAY_NAME\",\"url\":\"$BUILD_URL\",\"fields\":[{\"name\":\"Status\",\"value\":\"$currentBuild.currentResult\"}]}] }' -H \"Content-Type: application/json\" https://discordapp.com/api/webhooks/$WEBHOOK_CHANNEL/$WEBHOOK_TOKEN"
}
}
}
}