This repository has been archived by the owner on May 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
77 lines (72 loc) · 2.26 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
pipeline {
tools {
maven 'Maven 3'
jdk 'OracleJDK 8'
}
agent any
options {
timestamps()
timeout(time: 5, unit: 'MINUTES')
}
triggers {
githubPush()
}
stages {
stage ('check-commit') {
steps {
script {
env.CI_SKIP = "false"
result = sh (script: "git log -1 | grep '(?s).[CI[-\\s]SKIP].*'", returnStatus: true)
if (result == 0) {
env.CI_SKIP = "true"
error "'[CI-SKIP]' found in git commit message. Aborting."
}
}
}
}
stage ('compile') {
steps {
echo 'Compiling...'
withMaven(options: [artifactsPublisher(disabled: true)]) {
sh 'mvn -B clean verify'
}
}
post {
always {
//echo 'Archiving coverage results...'
//jacoco(execPattern: '**/**.exec', classPattern: '**/classes', sourcePattern: '**/src/main/java')
//echo 'Archiving test results...'
//junit '**/target/surefire-reports/*.xml'
echo 'Archiving artifacts...'
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
}
}
}
stage ('deploy') {
when {
branch "master"
}
steps {
echo 'Master branch detected, deploying to maven repository...'
withMaven(globalMavenSettingsConfig: 'e5b005b5-be4d-4709-8657-1981662bcbe3', options: [artifactsPublisher(disabled: true)]) {
sh 'mvn -B -DskipTests deploy'
}
}
}
}
post {
always {
script {
if (env.CI_SKIP == "true") {
currentBuild.result = 'NOT_BUILT'
}
}
}
success {
githubNotify description: 'The jenkins build was successful', status: 'SUCCESS'
}
failure {
githubNotify description: 'The jenkins build failed', status: 'FAILURE'
}
}
}