Skip to content
Snippets Groups Projects
Commit ae0196d4 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4792 Double tag on master and release, and this brnach for testing

parent 8831cb30
No related branches found
No related tags found
No related merge requests found
......@@ -73,11 +73,12 @@ pipeline {
steps {
script {
FAILED_STAGE=env.STAGE_NAME
env.BUILD_TAG = generateBuildTag()
}
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
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 -Duser=${USER} -Dpassword=${PASSWORD}'
sh 'mvn -s $MAVEN_SETTINGS spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -Dimagetag=$IMAGE_TAG -Dbuildtag=${env.BUILD_TAG} -Dspring-boot.build-image.publish=true -Duser=${USER} -Dpassword=${PASSWORD}'
}
}
}
......@@ -154,14 +155,22 @@ pipeline {
}
String generateImageTag() {
return "${env.BRANCH_NAME}-${getPomVersion()}"
}
String generateBuildTag() {
def buildName = "docker.ozg-sh.de/administration"
def buildTag = buildName+":"+IMAGE_TAG
if (isMasterBranch()) {
return "snapshot-latest"
}
else if (isReleaseBranch()) {
return "latest"
buildTag += ","+buildName+":snapshot-latest"
} else if (isReleaseBranch()) {
buildTag += ","+buildName+":latest"
} else if (env.BRANCH_NAME == 'OZG-4792-FixMasterBranchTagging') {
buildTag += ","+buildName+":doubleTagTest"
}
return "${env.BRANCH_NAME}-${getPomVersion()}"
return buildTag
}
String getPomVersion() {
......
......@@ -60,7 +60,8 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>docker.ozg-sh.de/administration:${buildtag}</name>
<name>docker.ozg-sh.de/administration:${imagetag}</name>
<tags>${buildtag}</tags>
<publish>true</publish>
</image>
<docker>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment