Skip to content
Snippets Groups Projects
Commit 637edc9a authored by Jan Zickermann's avatar Jan Zickermann
Browse files

Merge remote-tracking branch 'origin/master' into OZG-4717-BasicAnwendungsSetup

# Conflicts:
#	pom.xml
parents 8b7d1ed5 e1657270
Branches
Tags
No related merge requests found
......@@ -12,6 +12,7 @@ pipeline {
SH_SUCCESS_STATUS_CODE = 0
IMAGE_TAG = generateImageTag()
HELM_CHART_VERSION = generateHelmChartVersion()
BUILD_PROFILE = getBuildProfile()
}
options {
......@@ -77,7 +78,7 @@ pipeline {
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 $BUILD_PROFILE -Ddocker.publishRegistry.username=${USER} -Ddocker.publishRegistry.password=${PASSWORD}'
}
}
}
......@@ -154,13 +155,6 @@ pipeline {
}
String generateImageTag() {
if (isMasterBranch()) {
return "snapshot-latest"
}
else if (isReleaseBranch()) {
return "latest"
}
return "${env.BRANCH_NAME}-${getPomVersion()}"
}
......@@ -170,6 +164,16 @@ String getPomVersion() {
return pom.version
}
String getBuildProfile() {
if (isMasterBranch()) {
return "-P dev"
} else if (isReleaseBranch()) {
return "-P release"
} else {
return ""
}
}
Void sendFailureMessage() {
def room = getRoom()
......
......@@ -16,6 +16,7 @@
<description>Administration Backend Project</description>
<properties>
<imageName>docker.ozg-sh.de/administration</imageName>
<build.number>SET_BY_JENKINS</build.number>
</properties>
......@@ -54,7 +55,25 @@
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>dev</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<tags>${imageName}:snapshot-latest</tags>
</image>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
......@@ -62,13 +81,32 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>docker.ozg-sh.de/administration:${buildtag}</name>
<tags>${imageName}:latest</tags>
</image>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>${imageName}:${env.BRANCH_NAME}-${project.version}</name>
<publish>true</publish>
</image>
<docker>
<publishRegistry>
<username>${user}</username>
<password>${password}</password>
<username>${docker.publishRegistry.username}</username>
<password>${docker.publishRegistry.password}</password>
</publishRegistry>
</docker>
<excludes>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment