-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
43 lines (43 loc) · 1.62 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
pipeline {
agent {
docker 'gradle:latest'
}
stages {
stage('build') {
steps {
gitlabCommitStatus('build') {
withGradle {
sh './gradlew distzip'
}
}
}
}
stage('javadoc') {
steps {
withGradle {
sh './gradlew dokkaJavadoc'
}
step([$class: 'JavadocArchiver', javadocDir: 'build/dokka/javadoc', keepAll: true])
}
}
}
post {
always {
script {
def msg = "**Status:** " + currentBuild.currentResult.toLowerCase() + "\n"
msg += "**Changes:** \n"
if (!currentBuild.changeSets.isEmpty()) {
currentBuild.changeSets.first().getLogs().each {
msg += "- `" + it.getCommitId().substring(0, 8) + "` *" + it.getComment().substring(0, it.getComment().length()-1) + "*\n"
}
} else {
msg += "no changes for this run\n"
}
if (msg.length() > 1024) msg.take(msg.length() - 1024)
withCredentials([string(credentialsId: 'discord-webhook', variable: 'discordWebhook')]) {
discordSend thumbnail: "http://wnuke.dev/radiation-symbol.png", successful: currentBuild.resultIsBetterOrEqualTo('SUCCESS'), description: "${msg}", link: env.BUILD_URL, title: "docker-mc-instance-manager #${BUILD_NUMBER}", webhookURL: "${discordWebhook}"
}
}
}
}
}