-
Notifications
You must be signed in to change notification settings - Fork 817
/
Jenkinsfile
45 lines (43 loc) · 1.27 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
pipeline {
agent any
stages {
stage('Build') {
steps {
withMaven(maven : 'apache-maven-3.6.0'){
sh "mvn clean compile"
}
}
}
stage('Test'){
steps {
withMaven(maven : 'apache-maven-3.6.0'){
sh "mvn test"
}
}
}
stage('build && SonarQube analysis') {
steps {
withSonarQubeEnv('sonar.tools.devops.****') {
sh 'sonar-scanner -Dsonar.projectKey=myProject -Dsonar.sources=./src'
}
}
}
stage("Quality Gate") {
steps {
timeout(time: 1, unit: 'HOURS') {
// Parameter indicates whether to set pipeline to UNSTABLE if Quality Gate fails
// true = set pipeline to UNSTABLE, false = don't
// Requires SonarScanner for Jenkins 2.7+
waitForQualityGate abortPipeline: true
}
}
}
stage('Deploy') {
steps {
withMaven(maven : 'apache-maven-3.6.0'){
sh "mvn deploy"
}
}
}
}
}