Skip to content

Commit 0695ab3

Browse files
authored
Create Jenkinsfile-sonar.groovy (#10)
* Create Jenkinsfile-sonar.groovy * Update Jenkinsfile-sonar.groovy * Update Jenkinsfile-sonar.groovy * Update Jenkinsfile-sonar.groovy * Update Jenkinsfile-sonar.groovy
1 parent c0fd833 commit 0695ab3

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Jenkinsfile-sonar.groovy

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// this demo runs in a k8s pod which has a docker container named 'java'
2+
// also, maven is needed in this case.
3+
pipeline {
4+
agent {
5+
label 'maven'
6+
}
7+
8+
stages{
9+
stage('build'){
10+
steps{
11+
container('java'){
12+
sh 'mvn clean package'
13+
}
14+
}
15+
}
16+
17+
stage('sonar scan') {
18+
steps {
19+
container('java'){
20+
sh '''
21+
mvn sonar:sonar \
22+
-Dsonar.projectKey=test \
23+
-Dsonar.host.url=${SONAR_HOST_URL} \
24+
-Dsonar.login=${SONAR_LOGIN}
25+
'''
26+
}
27+
}
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)