Update Jenkinsfile

This commit is contained in:
Mihai Georgescu 2023-12-04 15:55:28 +02:00 committed by GitHub
parent 5e2ae023e8
commit 73f9c65d76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

16
Jenkinsfile vendored
View file

@ -4,6 +4,7 @@ pipeline {
DOCKERHUB_CREDENTIALS = credentials('mihaivalentingeorgescu-dockerhub')
}
stages {
stage('Checkstyle') {
steps {
sh 'export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64'
@ -45,8 +46,7 @@ pipeline {
}
stage('Tag the docker image') {
when {
// Condition to execute the stage when the branch is mai
changeRequest()
expression { currentBuild.changeSets == null }
}
steps {
echo "now we will tag the docker image "
@ -75,8 +75,7 @@ pipeline {
}
stage('Push to DockerHub') {
when {
// Condition to execute the stage when the branch is main
changeRequest()
expression { currentBuild.changeSets == null }
}
steps {
echo "now we will push to the docker file"
@ -97,10 +96,7 @@ pipeline {
}
stage('Tag docker image again for the main repo') {
when {
// Condition to execute the stage when the branch is 'main'
not {
changeRequest()
}
expression { currentBuild.changeSets != null }
}
steps {
echo "now we will tag the docker image for the main branch"
@ -117,9 +113,7 @@ pipeline {
stage('Push docker image to main repository') {
when {
// Condition to execute the stage when the branch is 'main'
not {
changeRequest()
}
expression { currentBuild.changeSets != null }
}
steps {
echo "now we will push the image to the docker main repository"