mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 21:35:50 +00:00
Update Jenkinsfile
Signed-off-by: prankumargrid <prankumar@griddynamics.com>
This commit is contained in:
parent
86268d9daf
commit
77c31d5b04
1 changed files with 23 additions and 3 deletions
26
Jenkinsfile
vendored
26
Jenkinsfile
vendored
|
@ -3,7 +3,7 @@ pipeline {
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
IMAGE_TAG = '' // Will be set in 'Initialize'
|
IMAGE_TAG = '' // Will be set in 'Initialize'
|
||||||
REGISTRY = "prankumar313" // Replace with actual DockerHub or Nexus repo
|
REGISTRY = "your-dockerhub-username" // Replace with actual DockerHub or Nexus repo
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
@ -23,8 +23,28 @@ pipeline {
|
||||||
currentBuild.description = "Main branch build"
|
currentBuild.description = "Main branch build"
|
||||||
|
|
||||||
// Main branch: Just build and push image
|
// Main branch: Just build and push image
|
||||||
docker.withRegistry('
|
docker.withRegistry('https://index.docker.io/v1/', 'docker-hub-credentials-id') {
|
||||||
|
def app = docker.build("${env.REGISTRY}/main:${env.IMAGE_TAG}")
|
||||||
|
app.push()
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
currentBuild.description = "Merge request build"
|
||||||
|
|
||||||
|
// MR branch: Full build
|
||||||
|
sh 'gradle checkstyleMain checkstyleTest'
|
||||||
|
archiveArtifacts artifacts: '**/build/reports/checkstyle/*.xml', allowEmptyArchive: true
|
||||||
|
|
||||||
|
sh 'gradle test'
|
||||||
|
sh 'gradle build -x test'
|
||||||
|
|
||||||
|
docker.withRegistry('https://index.docker.io/v1/', 'docker-hub-credentials-id') {
|
||||||
|
def app = docker.build("${env.REGISTRY}/mr:${env.IMAGE_TAG}")
|
||||||
|
app.push()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue