mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 05:45:50 +00:00
Add sonar analysis
This commit is contained in:
parent
2aa53f929d
commit
3234f1230f
2 changed files with 40 additions and 1 deletions
32
Jenkinsfile
vendored
Normal file
32
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
pipeline {
|
||||
agent {
|
||||
label 'zuvmljenson02'
|
||||
}
|
||||
environment {
|
||||
BUILD_IMAGE = "registry.lksnext.com/devsecops/maven-java-17:2.0"
|
||||
SONAR_TOKEN = credentials('sonar-analysis-token')
|
||||
}
|
||||
stages {
|
||||
stage('Sonar') {
|
||||
when {
|
||||
environment name: 'JOB_ACTION', value: 'sonar'
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
sh '''
|
||||
docker run --rm \
|
||||
-v ./:/app \
|
||||
-v "/home/jenkins/.m2":"/home/jenkins/.m2" \
|
||||
-e MAVEN_CMD="clean verify sonar:sonar -Dsonar.host.url=$SONAR_LKS_HOST_URL -Dsonar.token=$SONAR_TOKEN" \
|
||||
$BUILD_IMAGE
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
}
|
9
pom.xml
9
pom.xml
|
@ -37,7 +37,8 @@
|
|||
<maven-checkstyle.version>3.6.0</maven-checkstyle.version>
|
||||
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
|
||||
<spring-format.version>0.0.43</spring-format.version>
|
||||
|
||||
|
||||
<sonar.projectKey>spring-petclinic</sonar.projectKey>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -287,6 +288,12 @@
|
|||
<artifactId>cyclonedx-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
<artifactId>sonar-maven-plugin</artifactId>
|
||||
<version>3.9.1.2184</version>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
<licenses>
|
||||
|
|
Loading…
Reference in a new issue