-
Notifications
You must be signed in to change notification settings - Fork 152
/
Jenkinsfile-sonarscanner
36 lines (35 loc) · 996 Bytes
/
Jenkinsfile-sonarscanner
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
pipeline{
agent any
tools{
maven 'maven-3.8.6'
}
options {
buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '30'))
}
stages{
stage('get code from github'){
steps{
git branch: "${params.branch}", url: "${params.url}"
}
}
stage('build maven project'){
steps{
sh 'mvn clean package'
}
}
stage('sonarqube analysis'){
steps{
withSonarQubeEnv(installationName: 'sonar-9') {
sh "/tmp/sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner -Dsonar.projectKey=hellospringboot -Dsonar.projectName=hellospringboot -Dsonar.sourceEncoding=UTF-8 -Dsonar.sources=src"
}
}
}
stage("Quality Gate") {
steps {
timeout(time: 1, unit: 'HOURS') {
waitForQualityGate abortPipeline: true
}
}
}
}
}