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 { ...@@ -12,7 +12,7 @@ pipeline {
SH_SUCCESS_STATUS_CODE = 0 SH_SUCCESS_STATUS_CODE = 0
IMAGE_TAG = generateImageTag() IMAGE_TAG = generateImageTag()
HELM_CHART_VERSION = generateHelmChartVersion() HELM_CHART_VERSION = generateHelmChartVersion()
BUILD_PROFILE = setBuildProfile() BUILD_PROFILE = getBuildProfile()
} }
options { options {
...@@ -78,7 +78,7 @@ pipeline { ...@@ -78,7 +78,7 @@ pipeline {
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) { 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() { ...@@ -164,7 +164,7 @@ String getPomVersion() {
return pom.version return pom.version
} }
String setBuildProfile() { String getBuildProfile() {
if (isMasterBranch()) { if (isMasterBranch()) {
return "dev" return "dev"
} else if (isReleaseBranch()) { } else if (isReleaseBranch()) {
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</dependencies> </dependencies>
<profiles> <profiles>
<profile> <profile>
<id>feature</id> <id>dev</id>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
...@@ -62,28 +62,15 @@ ...@@ -62,28 +62,15 @@
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration> <configuration>
<image> <image>
<name>${imageName}:${env.BRANCH_NAME}-${project.version}</name> <tags>${imageName}:snapshot-latest</tags>
<publish>true</publish>
</image> </image>
<docker>
<publishRegistry>
<username>${user}</username>
<password>${password}</password>
</publishRegistry>
</docker>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile> <profile>
<id>dev</id> <id>release</id>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
...@@ -91,46 +78,28 @@ ...@@ -91,46 +78,28 @@
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration> <configuration>
<image> <image>
<name>${imageName}:${env.BRANCH_NAME}-${project.version}</name> <tags>${imageName}:latest</tags>
<tags>${imageName}:snapshot-latest</tags>
<publish>true</publish>
</image> </image>
<docker>
<publishRegistry>
<username>${user}</username>
<password>${password}</password>
</publishRegistry>
</docker>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile> </profiles>
<id>release</id>
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration> <configuration>
<image> <image>
<name>${imageName}:${env.BRANCH_NAME}-${project.version}</name> <name>${imageName}:${env.BRANCH_NAME}-${project.version}</name>
<tags>${imageName}:latest</tags>
<publish>true</publish> <publish>true</publish>
</image> </image>
<docker>
<publishRegistry>
<username>${user}</username>
<password>${password}</password>
</publishRegistry>
</docker>
<excludes> <excludes>
<exclude> <exclude>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
...@@ -141,15 +110,5 @@ ...@@ -141,15 +110,5 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project> </project>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment