-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
68 lines (67 loc) · 2.54 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
pipeline {
agent {
dockerfile {
args '-v $HOME/.m2:/root/.m2'
}
}
stages {
stage('Test') {
steps {
configFileProvider([configFile(fileId: 'maven_settings', variable: 'SETTINGS')]) {
sh 'mvn -s $SETTINGS clean test -B'
}
stash name: 'test-reports', includes: '**/target/surefire-reports/**,**/target/jacoco.exec,**/coverage/lcov.info'
}
post {
always {
junit '**/target/surefire-reports/*.xml'
jacoco(execPattern: '**/target/jacoco.exec')
cobertura coberturaReportFile: '**/coverage/cobertura-coverage.xml'
}
}
}
stage('Embedded Test') {
steps {
configFileProvider([configFile(fileId: 'maven_settings', variable: 'SETTINGS')]) {
sh 'mvn -s $SETTINGS clean test -P arquillian-glassfish-embedded,!default -B'
}
stash name: 'embedded-test-reports', includes: '**/target/surefire-reports/**,**/target/jacoco-it.exec'
}
post {
always {
cucumber '**/target/cucumber-report/*.json'
junit '**/target/surefire-reports/*.xml'
jacoco(execPattern: '**/target/jacoco-it.exec')
}
}
}
stage('SonarQube') {
when {
branch 'develop'
}
steps {
configFileProvider([configFile(fileId: 'maven_settings', variable: 'SETTINGS')]) {
sh 'mvn -s $SETTINGS clean compile -B'
unstash 'test-reports'
unstash 'embedded-test-reports'
sh 'mvn -s $SETTINGS sonar:sonar -B'
}
}
}
stage('Deploy') {
when {
anyOf {
branch 'master'
branch 'develop'
branch 'feature/jenkins'
}
}
steps {
configFileProvider([configFile(fileId: 'maven_settings', variable: 'SETTINGS')]) {
sh 'mvn -s $SETTINGS clean deploy -DskipTests -B'
}
sshPublisher(publishers: [sshPublisherDesc(configName: '192.168.25.98', transfers: [sshTransfer(excludes: '**', execCommand: 'docker stack deploy kwetter_sven -c /home/dockeruser/sven/stack.yml')])])
}
}
}
}