-
Notifications
You must be signed in to change notification settings - Fork 30
/
Jenkinsfile
70 lines (70 loc) · 2.39 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
pipeline {
agent any
tools {
maven 'M35'
jdk 'JDK 11'
}
options {
ansiColor('xterm')
timestamps()
timeout(time: 30, unit: 'MINUTES')
}
stages {
stage('Set Version') {
steps {
sh '''
if [[ "$BRANCH_NAME" =~ ^(master|release/).*$ ]]; then
VERSION=$(cat release.txt).${BUILD_ID}
else
VERSION=$(cat release.txt).dev.${BUILD_ID}
fi
mvn versions:set versions:commit -DnewVersion=${VERSION}
'''
}
}
stage('Build') {
steps {
sshagent(['GITHUB_SSH_KEY']) {
sh '''
if [[ "$BRANCH_NAME" =~ ^(master|release/).*$ ]]; then
mvn clean deploy scm:tag -P release
else
mvn clean package -P release
fi
'''
}
}
post {
always {
junit '**/target/surefire-reports/**/*.xml'
}
}
}
}
post {
failure {
emailext(
mimeType: 'text/html',
body: '${JELLY_SCRIPT,template="html"}',
recipientProviders: [
[$class: 'CulpritsRecipientProvider'],
[$class: 'DevelopersRecipientProvider'],
[$class: 'RequesterRecipientProvider']
],
subject: 'Build failed - ${JOB_NAME}'
)
}
unstable {
emailext(
mimeType: 'text/html',
body: '${JELLY_SCRIPT,template="html"}',
recipientProviders: [
[$class: 'CulpritsRecipientProvider'],
[$class: 'DevelopersRecipientProvider'],
[$class: 'RequesterRecipientProvider']
],
subject: 'Build unstable - ${JOB_NAME}'
)
}
}
}