forked from kieler/KLighD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
118 lines (106 loc) · 3.63 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2019 TypeFox and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// SPDX-License-Identifier: EPL-2.0
//
///////////////////////////////////////////////////////////////////////////////
pipeline {
agent any
tools {
maven 'M3'
}
triggers {
// every fifteen minutes (perhaps at :07, :22, :37, :52)
pollSCM """TZ=Europe/Berlin
H/15 * * * *"""
}
options {
// Keep at most 15 builds
buildDiscarder logRotator(numToKeepStr: '15')
}
stages {
stage('Clear m2 snapshots') {
steps {
sh 'rm -rf klighd-snapshots'
}
}
stage('Build') {
steps {
echo "Using JDK at $JAVA_HOME"
wrap([$class: 'Xvfb']) {
sh "mvn clean deploy -B -fae" +
" --define maven.repo.local=${env.WORKSPACE}/.repository" +
" --define maven.test.failure.ignore=true"
}
}
}
stage('RevealArtifacts') {
steps {
sh 'rm -rf updatesite'
sh 'mv build/de.cau.cs.kieler.klighd.repository/target/repository updatesite'
}
}
}
post {
always {
// Publish JUnit test result reports for them to show up in Jenkins
junit 'test/**/surefire-reports/*.xml'
}
success {
archiveArtifacts 'updatesite/**/*.*'
archiveArtifacts 'klighd-snapshots/**/*.*'
}
failure {
// cs: wrapped the emailext call in a try catch block in order to prevent execution errors
// if the plugin 'email-ext' is unavailable; 'try-catch' blocks in turn are only available within 'script' blocks
script {
try {
emailext (
subject: "KLighD build for branch ${env.BRANCH_NAME}: ${currentBuild.currentResult}'",
body: """
<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
} catch (Error e) {
echo 'Sending eMail notifications failed.'
}
}
}
regression {
// cs: wrapped the emailext call in a try catch block in order to prevent execution errors
// if the plugin 'email-ext' is unavailable; 'try-catch' blocks in turn are only available within 'script' blocks
script {
try {
emailext (
subject: "KLighD build for branch ${env.BRANCH_NAME}: ${currentBuild.currentResult}'",
body: """
<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
} catch (Error e) {
echo 'Sending eMail notifications failed.'
}
}
}
fixed {
// cs: wrapped the emailext call in a try catch block in order to prevent execution errors
// if the plugin 'email-ext' is unavailable; 'try-catch' blocks in turn are only available within 'script' blocks
script {
try {
emailext (
subject: "KLighD build for branch ${env.BRANCH_NAME} is back to normal'",
body: """
<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
} catch (Error e) {
echo 'Sending eMail notifications failed.'
}
}
}
}
}