mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 13:55: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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
pom.xml
7
pom.xml
|
@ -38,6 +38,7 @@
|
||||||
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
|
<nohttp-checkstyle.version>0.0.11</nohttp-checkstyle.version>
|
||||||
<spring-format.version>0.0.43</spring-format.version>
|
<spring-format.version>0.0.43</spring-format.version>
|
||||||
|
|
||||||
|
<sonar.projectKey>spring-petclinic</sonar.projectKey>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -287,6 +288,12 @@
|
||||||
<artifactId>cyclonedx-maven-plugin</artifactId>
|
<artifactId>cyclonedx-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||||
|
<artifactId>sonar-maven-plugin</artifactId>
|
||||||
|
<version>3.9.1.2184</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<licenses>
|
<licenses>
|
||||||
|
|
Loading…
Reference in a new issue