mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 08:15:49 +00:00
Update Jenkinsfile
This commit is contained in:
parent
456e9f760b
commit
3dcb7deb22
1 changed files with 27 additions and 45 deletions
72
Jenkinsfile
vendored
72
Jenkinsfile
vendored
|
@ -1,46 +1,28 @@
|
||||||
pipeline{
|
node {
|
||||||
agent any
|
def WORKSPACE = "/var/lib/jenkins/workspace/petclinic"
|
||||||
|
def dockerImageTag = "petclinic${env.BUILD_NUMBER}"
|
||||||
tools{
|
|
||||||
maven "maven3"
|
try{
|
||||||
}
|
notifyBuild('STARTED')
|
||||||
/*
|
stage('Clone Repo') {
|
||||||
triggers{
|
// for display purposes
|
||||||
cron("* * * * *")
|
// Get some code from a GitHub repository
|
||||||
}
|
git url:"https://github.com/A-hash-bit/spring-petclinic.git", branch:"main"
|
||||||
*/
|
}
|
||||||
stages{
|
stage('Build docker') {
|
||||||
stage("Checkout"){
|
dockerImage = docker.build("petclinic:${env.BUILD_NUMBER}")
|
||||||
steps{
|
}
|
||||||
echo "========executing checkout========"
|
|
||||||
git url:"https://github.com/A-hash-bit/spring-petclinic.git", branch:"main"
|
stage('Deploy docker'){
|
||||||
}
|
echo "Docker Image Tag Name: ${dockerImageTag}"
|
||||||
|
sh "docker stop petclinic || true && docker rm petclinic || true"
|
||||||
}
|
sh "docker run --name petclinic -d -p 8081:8081 petclinic:${env.BUILD_NUMBER}"
|
||||||
|
}
|
||||||
stage("Build"){
|
}catch(e){
|
||||||
steps{
|
currentBuild.result = "FAILED"
|
||||||
sh "mvn clean package"
|
throw e
|
||||||
}
|
}finally{
|
||||||
}
|
notifyBuild(currentBuild.result)
|
||||||
stage('Docker Build') {
|
}
|
||||||
agent any
|
|
||||||
steps {
|
|
||||||
echo "========executing docker build========"
|
|
||||||
sh 'docker build -t amar/petclinic:latest .'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
post{
|
|
||||||
always{
|
|
||||||
echo "========always========"
|
|
||||||
}
|
|
||||||
success{
|
|
||||||
echo "========pipeline executed successfully ========"
|
|
||||||
}
|
|
||||||
failure{
|
|
||||||
echo "========pipeline execution failed========"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue