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

OZG-4792 Cleaned pom.xml and Jenkinsfile as suggested in PR#9

parent 1a972a3c
Branches
Tags
No related merge requests found
......@@ -12,7 +12,7 @@ pipeline {
SH_SUCCESS_STATUS_CODE = 0
IMAGE_TAG = generateImageTag()
HELM_CHART_VERSION = generateHelmChartVersion()
BUILD_PROFILE = setBuildProfile()
BUILD_PROFILE = getBuildProfile()
}
options {
......@@ -78,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 -P $BUILD_PROFILE -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 -P $BUILD_PROFILE -Ddocker.publishRegistry.username=${USER} -Ddocker.publishRegistry.password=${PASSWORD}'
}
}
}
......@@ -164,7 +164,7 @@ String getPomVersion() {
return pom.version
}
String setBuildProfile() {
String getBuildProfile() {
if (isMasterBranch()) {
return "dev"
} else if (isReleaseBranch()) {
......
......@@ -54,7 +54,7 @@
</dependencies>
<profiles>
<profile>
<id>feature</id>
<id>dev</id>
<build>
<plugins>
<plugin>
......@@ -62,28 +62,15 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>${imageName}:${env.BRANCH_NAME}-${project.version}</name>
<publish>true</publish>
<tags>${imageName}:snapshot-latest</tags>
</image>
<docker>
<publishRegistry>
<username>${user}</username>
<password>${password}</password>
</publishRegistry>
</docker>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dev</id>
<id>release</id>
<build>
<plugins>
<plugin>
......@@ -91,46 +78,28 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>${imageName}:${env.BRANCH_NAME}-${project.version}</name>
<tags>${imageName}:snapshot-latest</tags>
<publish>true</publish>
<tags>${imageName}:latest</tags>
</image>
<docker>
<publishRegistry>
<username>${user}</username>
<password>${password}</password>
</publishRegistry>
</docker>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
</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>
<tags>${imageName}:latest</tags>
<publish>true</publish>
</image>
<docker>
<publishRegistry>
<username>${user}</username>
<password>${password}</password>
</publishRegistry>
</docker>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
......@@ -141,15 +110,5 @@
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment