This commit is contained in:
Venkatesh 2022-11-01 22:06:34 +05:30
parent bd479797a8
commit 1ef20b8248

View file

@ -1,42 +1,27 @@
pipeline {
agent { label 'JAVA-11' }
triggers { pollSCM( '* * * * *' ) }
parameters {
string(name: 'MAVEN_TARGET', defaultValue: 'mvn package', description: 'describe maven targets')
choice(name: 'BRANCH', choices: ['main', 'master', 'three'], description: 'Choose the branch')
}
stages {
agent { label 'TRF' }
stages {
stage('clone') {
steps {
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'
git url: 'https://github.com/GUDAPATIVENKATESH/spring-petclinic.git',
branch : 'main'
}
}
stage('Build') {
stage('build') {
steps {
sh "${params.MAVEN_TARGET}"
sh 'mvn install'
}
}
}
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"
stage('test_results') {
steps {
archiveArtifacts artifacts: '**/target/*.jar',
followSymlinks: false
}
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'
}
stage('JUnit_test_results') {
steps {
junit '**/target/surefire-reports/*.xml'
}
}
}
}