Added Sonar Environment

This commit is contained in:
Aseerwadham 2023-03-16 15:41:47 +05:30
parent 7311adfe9e
commit c24789efbd

18
Jenkinsfile vendored
View file

@ -1,10 +1,13 @@
pipeline { pipeline {
agent { label 'JDK_17' } agent { label 'JDK_17' }
triggers { pollSCM ('* * * * *') } triggers { pollSCM ('* * * * *') }
parameters {
choice(name: 'MAVEN_GOAL', choices: ['package', 'install', 'clean'], description: 'Maven Goal')
}
stages { stages {
stage('vcs') { stage('vcs') {
steps { steps {
git url: 'https://github.com/Aseerwadham/spring-petclinic.git', git url: 'https://github.com/khajadevopsmarch23/spring-petclinic.git',
branch: 'main' branch: 'main'
} }
} }
@ -13,7 +16,14 @@ pipeline {
jdk 'JDK_17' jdk 'JDK_17'
} }
steps { steps {
sh "./mvnw package" sh "mvn ${params.MAVEN_GOAL}"
}
}
stage('sonar analysis') {
steps {
withSonarQubeEnv('SONAR_CLOUD') {
sh 'mvn clean package sonar:sonar -Dsonar.organization=springpetclinic143'
}
} }
} }
stage('post build') { stage('post build') {
@ -24,6 +34,4 @@ pipeline {
} }
} }
} }
} }