summaryrefslogtreecommitdiffstats
path: root/packages/apex-pdp-docker/pom.xml
diff options
context:
space:
mode:
authorRashmi Pujar <rashmi.pujar@bell.ca>2019-06-17 10:34:49 -0400
committerRashmi Pujar <rashmi.pujar@bell.ca>2019-06-19 06:22:16 -0400
commit7b945416da394a3ae3e53a1a9ae8d21f6a4e761e (patch)
treea86f73cbc96ff35e6f3863f454be6b464fa59aa7 /packages/apex-pdp-docker/pom.xml
parentdc2ca16a6d7d8cc13be5716e058add8190ea4479 (diff)
Use io.fabric8:docker-maven-plugin to build and push docker images
Issue-ID: POLICY-969 Signed-off-by: Rashmi Pujar <rashmi.pujar@bell.ca> Change-Id: Ia3c7c2d6b77d87848c344f212f4a0266db90426e
Diffstat (limited to 'packages/apex-pdp-docker/pom.xml')
-rw-r--r--packages/apex-pdp-docker/pom.xml148
1 files changed, 102 insertions, 46 deletions
diff --git a/packages/apex-pdp-docker/pom.xml b/packages/apex-pdp-docker/pom.xml
index 272cc1b66..dbba47a3d 100644
--- a/packages/apex-pdp-docker/pom.xml
+++ b/packages/apex-pdp-docker/pom.xml
@@ -1,6 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
+ Modifications Copyright (C) 2019 Bell Canada.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -30,81 +31,136 @@
<name>Policy APEX PDP - Docker build</name>
<description>ONAP Policy APEX PDP Docker Build</description>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <dist.project.version>${project.version}</dist.project.version>
+ <docker.skip>false</docker.skip>
+ <docker.skip.build>false</docker.skip.build>
+ <docker.skip.push>false</docker.skip.push>
+ <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
+ <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
+ </properties>
+
<build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
<executions>
<execution>
- <id>copy-apex-tarball</id>
- <phase>prepare-package</phase>
+ <phase>validate</phase>
<goals>
- <goal>copy</goal>
+ <goal>execute</goal>
</goals>
<configuration>
- <outputDirectory>${project.build.directory}/policy-apex-pdp</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <artifactItems>
- <artifactItem>
- <groupId>org.onap.policy.apex-pdp.packages</groupId>
- <artifactId>apex-pdp-package-full</artifactId>
- <version>${project.version}</version>
- <classifier>tarball</classifier>
- <type>tar.gz</type>
- <destFileName>apex-pdp-package-full.tar.gz</destFileName>
- </artifactItem>
- </artifactItems>
+ <source>
+ println 'Project version: ' + project.properties['dist.project.version']
+ if (project.properties['dist.project.version'] != null) {
+ def versionArray = project.properties['dist.project.version'].split('-')
+ def minMaxVersionArray = versionArray[0].tokenize('.')
+ if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) {
+ project.properties['project.docker.latest.minmax.tag.version'] =
+ minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest"
+ } else {
+ project.properties['project.docker.latest.minmax.tag.version'] =
+ minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest"
+ }
+ println 'New tag for docker: ' + properties['project.docker.latest.minmax.tag.version']
+ }
+ </source>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
- <artifactId>maven-resources-plugin</artifactId>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.30.0</version> <!-- Extract this as a property from the policy-parent -->
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.23</apiVersion>
+ <pullRegistry>${docker.pull.registry}</pullRegistry>
+ <pushRegistry>${docker.push.registry}</pushRegistry>
+ <images>
+ <image>
+ <name>onap/policy-apex-pdp</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFile>Dockerfile</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latest.minmax.tag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.policy.apex-pdp.packages:apex-pdp-package-full</include>
+ </includes>
+ <outputDirectory>.</outputDirectory>
+ <outputFileNameMapping>apex-pdp-package-full.tar.gz</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ </images>
+ </configuration>
<executions>
<execution>
- <id>copy-resources</id>
- <phase>prepare-package</phase>
+ <id>clean-images</id>
+ <phase>pre-clean</phase>
<goals>
- <goal>copy-resources</goal>
+ <goal>remove</goal>
</goals>
<configuration>
- <outputDirectory>${project.build.directory}/policy-apex-pdp</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/docker</directory>
- </resource>
- </resources>
+ <removeAll>true</removeAll>
</configuration>
</execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
<execution>
- <id>get-target-version</id>
- <phase>prepare-package</phase>
+ <id>generate-images</id>
+ <phase>generate-sources</phase>
<goals>
- <goal>exec</goal>
+ <goal>build</goal>
</goals>
</execution>
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ <configuration>
+ <image>onap/policy-apex-pdp</image>
+ </configuration>
+ </execution>
</executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
<configuration>
- <executable>echo</executable>
- <workingDirectory>${project.build.directory}</workingDirectory>
- <arguments>
- <argument>${project.version}</argument>
- </arguments>
- <outputFile>${project.build.directory}/version</outputFile>
+ <skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
-
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apex-pdp-package-full</artifactId>
+ <version>${project.version}</version>
+ <type>tar.gz</type>
+ </dependency>
+ </dependencies>
<profiles>
<profile>
<id>apexSite</id>
@@ -124,4 +180,4 @@
</distributionManagement>
</profile>
</profiles>
-</project> \ No newline at end of file
+</project>