forked from ultimate-pa/ultimate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
86 lines (82 loc) · 2.7 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
def scmVars
mmMessage = ''
def prepare_post(def scmResult) {
switch(currentBuild.currentResult) {
case 'SUCCESS':
env.mm_color = 'good'
break
case 'UNSTABLE':
env.mm_color = '#ebc934'
break
default:
env.mm_color = 'danger'
break
}
def changeLogSets = currentBuild.changeSets
def changeMessage = ""
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]
changeMessage +=" * ${entry.commitId} by ${entry.author} on ${new Date(entry.timestamp)}: ${entry.msg}\n"
}
}
mmMessage = """Build ${currentBuild.id} of **${java.net.URLDecoder.decode env.JOB_NAME, 'UTF-8'}** finished with **${currentBuild.currentResult}**.
#### Links
* <${env.BUILD_URL}display/redirect|Open Jenkins log>
* <${env.RUN_CHANGES_DISPLAY_URL}|Open changes in Jenkins>
"""
if(scmResult){
mmMessage += """
* <${scmResult.GIT_URL}|Open project in GitHub>
"""
}
mmMessage += """
#### Changes
${changeMessage}
"""
}
pipeline {
agent { label 'linux && java' }
options {
skipDefaultCheckout()
timeout(time: 12, unit: 'HOURS')
}
environment {
PATH = "${env.WORKSPACE}/releaseScripts/default/adds:${env.PATH}"
}
stages {
stage('Checkout') {
steps {
script {
scmVars = checkout scm
}
sh 'git clean -f -x -d'
}
}
stage('Check environment') {
steps {
sh(label: 'check solvers', script: 'releaseScripts/default/check_solvers.sh')
}
}
stage('Build and run basic tests') {
steps {
withMaven(options: [artifactsPublisher(disabled: true)]) {
sh 'cd trunk/source/BA_MavenParentUltimate && mvn -T 1C clean install'
}
}
}
}
post {
unsuccessful {
script { prepare_post(scmVars) }
emailext(body: '$DEFAULT_CONTENT', mimeType: 'text/plain', recipientProviders: [culprits(), developers(), requestor()], replyTo: '[email protected]', subject: '$DEFAULT_SUBJECT')
mattermostSend(color: "${env.mm_color}", message: "${mmMessage}", text: '', channel: '#ultimate', icon: "https://jenkins.sopranium.de/static/0e41ff2a/images/jenkins-header-logo-v2.svg")
}
fixed {
script { prepare_post(scmVars) }
emailext(body: '$DEFAULT_CONTENT', mimeType: 'text/plain', recipientProviders: [culprits(), developers(), requestor()], replyTo: '[email protected]', subject: '$DEFAULT_SUBJECT')
mattermostSend(color: "${env.mm_color}", message: "${mmMessage}", text: '', channel: '#ultimate', icon: "https://jenkins.sopranium.de/static/0e41ff2a/images/jenkins-header-logo-v2.svg")
}
}
}