added jenkins file changes

This commit is contained in:
Venkatesh 2022-10-06 20:31:27 +05:30
parent fe6c6f0f52
commit 08c9ff37c6

View file

@ -1,22 +1,42 @@
pipeline { pipeline {
agent { label 'JAVA-11' } agent { label 'JAVA-11' }
triggers { pollSCM( '* * * * *' ) } triggers { pollSCM( '* * * * *' ) }
parameters { choice(name: 'BRANCH', choices: ['main', 'master', 'three'], description: 'Choose the branch') } parameters {
string(name: 'MAVEN_TARGET', defaultValue: 'mvn package', description: 'describe maven targets')
choice(name: 'BRANCH', choices: ['main', 'master', 'three'], description: 'Choose the branch')
}
stages { stages {
stage('clone') { stage('clone') {
steps { steps {
git branch: '${params.BRANCH}', url: 'https://github.com/GUDAPATIVENKATESH/spring-petclinic.git' mail subject: "Build Started for jenkins job $env.JOB_NAME",
body: "Build Started for jenkins job $env.JOB_NAME",
to: "qtdevops@gmail.com"
git branch: "${params.BRANCH}", url: 'https://github.com/GUDAPATIVENKATESH/spring-petclinic.git'
} }
} }
stage('Build') { stage('Build') {
steps { steps {
sh 'mvn package' sh "${params.MAVEN_TARGET}"
} }
} }
stage('results') {
steps { }
junit '**/surefire-reports/*.xml' post {
always {
mail subject: "build completed for jenkins job $env.JOB_NAME",
body: "build completed for jenkins job $env.JOB_NAME \n click here: $env.JOB_URL",
to: "qtdevops@gmail.com"
}
failure {
mail subject: "build failed for jenkins job $env.JOB_NAME",
body: "build failed for jenkins job $env.JOB_NAME" ,
to: "qtdevops@gmail.com"
}
success {
mail subject: "build success for jenkins job $env.JOB_NAME",
body: "build success for jenkins job $env.JOB_NAME" ,
to: "qtdevops@gmail.com"
junit '**/surefire-reports/*.xml'
} }
}
} }
} }