Update Jenkinsfile

This commit is contained in:
surtexx 2023-11-13 17:17:31 +02:00 committed by GitHub
parent 604af1c2c2
commit 9157d18f89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

30
Jenkinsfile vendored
View file

@ -1,12 +1,8 @@
pipeline{
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') {
@ -42,15 +28,13 @@ pipeline{
}
}
}
}
}
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') {
@ -70,4 +51,5 @@ pipeline{
}
}
}
}
}