Merge "Do not hardcode io.fabric8 plugin"
[policy/drools-applications.git] / controlloop / packages / docker-controlloop / pom.xml
1 <!--
2   ============LICENSE_START=======================================================
3   ONAP
4   ================================================================================
5   Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6   Modifications Copyright (C) 2019 Bell Canada.
7   ================================================================================
8   Licensed under the Apache License, Version 2.0 (the "License");
9   you may not use this file except in compliance with the License.
10   You may obtain a copy of the License at
11
12          http://www.apache.org/licenses/LICENSE-2.0
13
14   Unless required by applicable law or agreed to in writing, software
15   distributed under the License is distributed on an "AS IS" BASIS,
16   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   See the License for the specific language governing permissions and
18   limitations under the License.
19   ============LICENSE_END=========================================================
20   -->
21
22 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24
25     <modelVersion>4.0.0</modelVersion>
26     <parent>
27         <groupId>org.onap.policy.drools-applications.controlloop.packages</groupId>
28         <artifactId>packages</artifactId>
29         <version>1.6.0-SNAPSHOT</version>
30     </parent>
31     <artifactId>docker-controlloop</artifactId>
32     <packaging>pom</packaging>
33
34     <name>docker-controlloop</name>
35     <description>ONAP Policy Control Loop PDP-D Docker Build</description>
36
37     <properties>
38         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
39         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
40         <dist.project.version>${project.version}</dist.project.version>
41         <docker.skip>false</docker.skip>
42         <docker.skip.build>false</docker.skip.build>
43         <docker.skip.push>false</docker.skip.push>
44         <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
45         <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
46         <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
47         <docker.buildArg.BUILD_VERSION_APP_CL>${project.version}</docker.buildArg.BUILD_VERSION_APP_CL>
48     </properties>
49
50     <build>
51         <finalName>${project.artifactId}-${project.version}</finalName>
52         <plugins>
53             <plugin>
54                 <groupId>org.codehaus.groovy.maven</groupId>
55                 <artifactId>gmaven-plugin</artifactId>
56                 <version>1.0</version>
57                 <executions>
58                     <execution>
59                         <phase>validate</phase>
60                         <goals>
61                             <goal>execute</goal>
62                         </goals>
63                         <configuration>
64                             <source>
65                                 println 'Project version: ' + project.properties['dist.project.version']
66                                 if (project.properties['dist.project.version'] != null) {
67                                     def versionArray = project.properties['dist.project.version'].split('-')
68                                     def minMaxVersionArray = versionArray[0].tokenize('.')
69                                     if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) {
70                                         project.properties['project.docker.latest.minmax.tag.version'] =
71                                             minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest"
72                                     } else {
73                                         project.properties['project.docker.latest.minmax.tag.version'] =
74                                             minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest"
75                                     }
76                                     println 'New tag for docker: ' + properties['project.docker.latest.minmax.tag.version']
77                                 }
78                             </source>
79                         </configuration>
80                     </execution>
81                 </executions>
82             </plugin>
83             <plugin>
84                 <groupId>io.fabric8</groupId>
85                 <artifactId>docker-maven-plugin</artifactId>
86                 <configuration>
87                     <verbose>true</verbose>
88                     <apiVersion>1.23</apiVersion>
89                     <pullRegistry>${docker.pull.registry}</pullRegistry>
90                     <pushRegistry>${docker.push.registry}</pushRegistry>
91                     <images>
92                         <image>
93                             <name>onap/policy-pdpd-cl</name>
94                             <build>
95                                 <cleanup>try</cleanup>
96                                 <dockerFile>Dockerfile</dockerFile>
97                                 <tags>
98                                     <tag>${project.version}</tag>
99                                     <tag>${project.version}-${maven.build.timestamp}</tag>
100                                     <tag>${project.docker.latest.minmax.tag.version}</tag>
101                                 </tags>
102                                 <assembly>
103                                     <descriptor>${project.basedir}/src/main/assembly/assembly.xml</descriptor>
104                                     <user>policy:policy:policy</user>
105                                 </assembly>
106                             </build>
107                         </image>
108                     </images>
109                 </configuration>
110                 <executions>
111                     <execution>
112                         <id>clean-images</id>
113                         <phase>pre-clean</phase>
114                         <goals>
115                             <goal>remove</goal>
116                         </goals>
117                         <configuration>
118                             <removeAll>true</removeAll>
119                         </configuration>
120                     </execution>
121                     <execution>
122                         <id>generate-images</id>
123                         <phase>generate-sources</phase>
124                         <goals>
125                             <goal>build</goal>
126                         </goals>
127                     </execution>
128                     <execution>
129                         <id>push-images</id>
130                         <phase>deploy</phase>
131                         <goals>
132                             <goal>build</goal>
133                             <goal>push</goal>
134                         </goals>
135                         <configuration>
136                             <image>onap/policy-pdpd-cl</image>
137                         </configuration>
138                     </execution>
139                 </executions>
140             </plugin>
141             <plugin>
142                 <groupId>org.apache.maven.plugins</groupId>
143                 <artifactId>maven-deploy-plugin</artifactId>
144                 <configuration>
145                     <skip>true</skip>
146                 </configuration>
147             </plugin>
148         </plugins>
149     </build>
150     <dependencies>
151         <dependency>
152             <groupId>${project.groupId}</groupId>
153             <artifactId>apps-controlloop</artifactId>
154             <version>${project.version}</version>
155             <type>zip</type>
156         </dependency>
157     </dependencies>
158 </project>