Added changes

This commit is contained in:
Nanditha54 2023-03-08 15:06:05 +05:30
parent 88608d28f9
commit 10bce99a32

37
Jenkinsfile vendored
View file

@ -0,0 +1,37 @@
pipeline {
agent { label 'JDK_17' }
triggers { pollSCM ('* * * * *') }
parameters {
choice(name: 'MAVEN_GOAL', choices: ['package', 'install', 'clean'], description: 'Maven Goal')
}
stages {
stage('vcs') {
steps {
git url: 'https://github.com/khajadevopsmarch23/spring-petclinic.git',
branch: 'declarative'
}
}
stage('package') {
tools {
jdk 'JDK_17'
}
sh "mvn ${params.MAVEN_GOAL}"
}
}
stage('sonar analysis') {
steps {
// performing sonarqube analysis with "withSonarQubeENV(<Name of Server configured in Jenkins>)"
withSonarQubeEnv('SONAR_CLOUD') {
sh 'mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=nan_sonarcube'
}
}
}
stage('post build') {
steps {
archiveArtifacts artifacts: '**/target/spring-petclinic-3.0.0-SNAPSHOT.jar',
onlyIfSuccessful: true
junit testResults: '**/surefire-reports/TEST-*.xml'
}
}
}