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