-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
55 lines (46 loc) · 1.32 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
pipeline {
agent none
options {
skipDefaultCheckout()
buildDiscarder(logRotator(numToKeepStr: '5'))
timestamps()
}
environment {
build_dir = 'jenkins-shared-libraries'
}
stages {
stage('Checkout and stash source') {
agent { label 'linux' }
steps {
dir(env.build_dir) {
deleteDir()
script {
env.GIT_COMMIT = checkout(scm)
}
}
stash includes: '**', name: 'source', useDefaultExcludes: false
}
post { cleanup { deleteDir() } }
}
stage('Unit-test the Jenkins shared pipeline') {
agent {
docker {
image 'swails/maven:latest'
alwaysPull true
}
}
steps {
unstash 'source'
dir(env.build_dir) {
sh(label: 'Run maven', script: 'mvn -B clean test')
}
}
post {
always {
junit(keepLongStdio: true, testResults: "${env.build_dir}/target/surefire-reports/TEST-*.xml")
}
cleanup { deleteDir() }
}
}
}
}