Update Jenkinsfile

This commit is contained in:
nagarjuna33 2023-04-06 17:06:55 +05:30 committed by GitHub
parent ddc636a943
commit f78e0cba20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

48
Jenkinsfile vendored
View file

@ -1,27 +1,33 @@
pipeline{ pipeline{
agent{ agent { label 'node' }
label 'springpet' // triggers { pollSCM ('H * * * 1-5') }
} parameters {
stages { choice (name: 'BRANCH_TO_BUILD', choices: ['main'], description: 'Branch to build')
stage ('scm'){ string (name: 'MAVEN_GOAL', defaultValue: 'clean install', description: 'maven goal')
steps { }
stages {
git url: "https://github.com/nagarjuna33/spring-petclinicnew.git", stage('scm') {
branch: 'main' steps {
git: "url: https://github.com/nagarjuna33/spring-petclinicnew.git",
branch:"${params.BRANCH_TO_BUILD}"
}
}
stage ('sonarqube') {
steps{
withSonarQubeEnv('sonarqube') {
sh 'mvn clean package sonar:sonar'
}
} }
} }
stage ('build package') { stage('Quality Gate') {
steps { steps {
sh 'mvn package' timeout(time: 20, unit: 'MINUTES'){
} waitForQualityGate abortPipeline: true
} }
stage ('deployment') { }
}
steps {
sh 'ansible-playbook -i /home/ansible/inventory.yml springpet.yml '
}
}
} }
} }