mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 07:45:49 +00:00
Update Jenkinsfile
This commit is contained in:
parent
604af1c2c2
commit
9157d18f89
1 changed files with 37 additions and 55 deletions
26
Jenkinsfile
vendored
26
Jenkinsfile
vendored
|
@ -1,12 +1,8 @@
|
|||
if(env.CHANGE_ID != null){
|
||||
pipeline{
|
||||
agent any
|
||||
stages {
|
||||
stage ("build") {
|
||||
when {
|
||||
expression {
|
||||
return env.CHANGE_ID != null
|
||||
}
|
||||
}
|
||||
steps {
|
||||
echo "Running build automation..."
|
||||
sh './mvnw checkstyle:checkstyle'
|
||||
|
@ -15,11 +11,6 @@ pipeline{
|
|||
}
|
||||
}
|
||||
stage ("Build Docker Image") {
|
||||
when {
|
||||
expression {
|
||||
return env.CHANGE_ID != null
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script{
|
||||
app = docker.build("surtexx/mr:${GIT_COMMIT[0..7]}", "-f Dockerfile1 .")
|
||||
|
@ -27,11 +18,6 @@ pipeline{
|
|||
}
|
||||
}
|
||||
stage ("Push Docker Image") {
|
||||
when {
|
||||
expression {
|
||||
return env.CHANGE_ID != null
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script{
|
||||
docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') {
|
||||
|
@ -43,14 +29,12 @@ pipeline{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(env.BRANCH_NAME == "main"){
|
||||
pipeline{
|
||||
agent any
|
||||
stages{
|
||||
stage ("Build Docker Image") {
|
||||
when{
|
||||
branch: 'main'
|
||||
}
|
||||
steps {
|
||||
script{
|
||||
app = docker.build("surtexx/main", "-f Dockerfile1 .")
|
||||
|
@ -58,9 +42,6 @@ pipeline{
|
|||
}
|
||||
}
|
||||
stage ("Push Docker Image") {
|
||||
when{
|
||||
branch: 'main'
|
||||
}
|
||||
steps {
|
||||
script{
|
||||
docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') {
|
||||
|
@ -71,3 +52,4 @@ pipeline{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue