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

46
Jenkinsfile vendored
View file

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