Update Jenkinsfile

This commit is contained in:
surtexx 2023-11-13 16:59:26 +02:00 committed by GitHub
parent 7e46224ad9
commit 604af1c2c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

29
Jenkinsfile vendored
View file

@ -1,12 +1,12 @@
pipeline{
agent any
when {
expression {
return env.CHANGE_ID != null
}
}
stages {
stage ("build") {
when {
expression {
return env.CHANGE_ID != null
}
}
steps {
echo "Running build automation..."
sh './mvnw checkstyle:checkstyle'
@ -15,6 +15,11 @@ 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 .")
@ -22,6 +27,11 @@ pipeline{
}
}
stage ("Push Docker Image") {
when {
expression {
return env.CHANGE_ID != null
}
}
steps {
script{
docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') {
@ -36,11 +46,11 @@ pipeline{
pipeline{
agent any
when{
branch: 'main'
}
stages{
stage ("Build Docker Image") {
when{
branch: 'main'
}
steps {
script{
app = docker.build("surtexx/main", "-f Dockerfile1 .")
@ -48,6 +58,9 @@ pipeline{
}
}
stage ("Push Docker Image") {
when{
branch: 'main'
}
steps {
script{
docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') {