summaryrefslogtreecommitdiffstats
path: root/controlloop/packages/docker-controlloop/pom.xml
diff options
context:
space:
mode:
authorRashmi Pujar <rashmi.pujar@bell.ca>2019-06-03 17:14:45 -0400
committerRashmi Pujar <rashmi.pujar@bell.ca>2019-06-11 13:57:45 -0400
commit19cade1c9284316bf15456002db354c894844c96 (patch)
tree8139327c0e9454ed56684568f6dd2e27d7654383 /controlloop/packages/docker-controlloop/pom.xml
parentcb84d7e3179893b8b0aa920b34cf92fbb6c171f5 (diff)
Use io.fabric8:docker-maven-plugin to build and push docker images
Addressed POLICY-1808 for drools-applications to fix the tag to be major.minor-SNAPSHOT-latest Issue-ID: POLICY-969 Signed-off-by: Rashmi Pujar <rashmi.pujar@bell.ca> Change-Id: I6c9ddec9a2e7a73ba68343eb98e0145ce811868e
Diffstat (limited to 'controlloop/packages/docker-controlloop/pom.xml')
-rw-r--r--controlloop/packages/docker-controlloop/pom.xml140
1 files changed, 93 insertions, 47 deletions
diff --git a/controlloop/packages/docker-controlloop/pom.xml b/controlloop/packages/docker-controlloop/pom.xml
index e7c4b931a..526d3fb4a 100644
--- a/controlloop/packages/docker-controlloop/pom.xml
+++ b/controlloop/packages/docker-controlloop/pom.xml
@@ -3,6 +3,7 @@
ONAP
================================================================================
Copyright (C) 2019 AT&T Intellectual Property. 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.
@@ -22,92 +23,137 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
-
<parent>
<groupId>org.onap.policy.drools-applications.controlloop.packages</groupId>
<artifactId>packages</artifactId>
<version>1.5.0-SNAPSHOT</version>
</parent>
-
<artifactId>docker-controlloop</artifactId>
<packaging>pom</packaging>
<name>docker-controlloop</name>
<description>ONAP Policy Control Loop PDP-D 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>
+ <docker.buildArg.BUILD_VERSION_APP_CL>${project.version}</docker.buildArg.BUILD_VERSION_APP_CL>
+ </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-cl-apps-zip</id>
- <phase>prepare-package</phase>
+ <phase>validate</phase>
<goals>
- <goal>copy</goal>
+ <goal>execute</goal>
</goals>
<configuration>
- <outputDirectory>${project.build.directory}/policy-pdpd-cl</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <artifactItems>
- <artifactItem>
- <groupId>org.onap.policy.drools-applications.controlloop.packages</groupId>
- <artifactId>apps-controlloop</artifactId>
- <version>${project.version}</version>
- <type>zip</type>
- <destFileName>apps-controlloop.zip</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-pdpd-cl</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>
+ <descriptor>${project.basedir}/src/main/assembly/assembly.xml</descriptor>
+ <user>policy:policy:policy</user>
+ </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-pdpd-cl</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-pdpd-cl</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>apps-controlloop</artifactId>
+ <version>${project.version}</version>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
</project>