From 62f727a69bc134620810a9d2bde0f8a616f5ffe6 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 17 Jan 2024 09:32:54 +0100 Subject: [PATCH] OZG-4786 OZG-4792 Push docker file when build with jenkins --- Jenkinsfile | 36 ++++++++++++++++++------------------ pom.xml | 7 +++++++ 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c55ef327..07a5865d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -69,35 +69,35 @@ pipeline { } } - stage('Build Docker image') { + stage('Build and publish Docker image') { steps { script { FAILED_STAGE=env.STAGE_NAME } configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { - sh 'mvn -s $MAVEN_SETTINGS spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -Dbuildtag=$IMAGE_TAG' + sh 'mvn -s $MAVEN_SETTINGS spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -Dbuildtag=$IMAGE_TAG -Dspring-boot.build-image.publish=true' } } } - stage('Tag and Push Docker image') { - steps { - script { - FAILED_STAGE=env.STAGE_NAME + // stage('Tag and Push Docker image') { + // steps { + // script { + // FAILED_STAGE=env.STAGE_NAME - if (env.BRANCH_NAME == 'master') { - reTagAndPushDockerImage('snapshot-latest') - } - else if (env.BRANCH_NAME == 'release') { - reTagAndPushDockerImage('latest') - } - else { - pushDockerImage() - } - } - } - } + // if (env.BRANCH_NAME == 'master') { + // reTagAndPushDockerImage('snapshot-latest') + // } + // else if (env.BRANCH_NAME == 'release') { + // reTagAndPushDockerImage('latest') + // } + // else { + // pushDockerImage() + // } + // } + // } + // } stage('Sonar Checks') { // when { diff --git a/pom.xml b/pom.xml index 977addd0..3d0ccdb6 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,14 @@ <configuration> <image> <name>docker.ozg-sh.de/administration:${buildtag}</name> + <publish>true</publish> </image> + <docker> + <publishRegistry> + <username>USER</username> + <password>PASSWORD</password> + </publishRegistry> + </docker> <excludes> <exclude> <groupId>org.projectlombok</groupId> -- GitLab