Bump pap to 2.2.1-SNAPSHOT
[policy/pap.git] / packages / policy-pap-docker / pom.xml
1 <!--
2   ============LICENSE_START=======================================================
3    Copyright (C) 2019 Nordix Foundation.
4    Modifications Copyright (C) 2020 Bell Canada.
5   ================================================================================
6   Licensed under the Apache License, Version 2.0 (the "License");
7   you may not use this file except in compliance with the License.
8   You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12   Unless required by applicable law or agreed to in writing, software
13   distributed under the License is distributed on an "AS IS" BASIS,
14   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   See the License for the specific language governing permissions and
16   limitations under the License.
17
18   SPDX-License-Identifier: Apache-2.0
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     <modelVersion>4.0.0</modelVersion>
25     <parent>
26         <groupId>org.onap.policy.pap</groupId>
27         <artifactId>pap-packages</artifactId>
28         <version>2.2.1-SNAPSHOT</version>
29     </parent>
30
31     <artifactId>policy-pap-docker</artifactId>
32     <packaging>pom</packaging>
33
34     <name>${project.artifactId}</name>
35     <description>The module for creating docker images of PAP component.</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     </properties>
48
49     <build>
50         <finalName>${project.artifactId}-${project.version}</finalName>
51         <plugins>
52             <plugin>
53                 <groupId>org.codehaus.groovy.maven</groupId>
54                 <artifactId>gmaven-plugin</artifactId>
55                 <version>1.0</version>
56                 <executions>
57                     <execution>
58                         <phase>validate</phase>
59                         <goals>
60                             <goal>execute</goal>
61                         </goals>
62                         <configuration>
63                             <source>
64                                 println 'Project version: ' + project.properties['dist.project.version']
65                                 if (project.properties['dist.project.version'] != null) {
66                                     def versionArray = project.properties['dist.project.version'].split('-')
67                                     def minMaxVersionArray = versionArray[0].tokenize('.')
68                                     if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) {
69                                         project.properties['project.docker.latest.minmax.tag.version'] =
70                                             minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest"
71                                     } else {
72                                         project.properties['project.docker.latest.minmax.tag.version'] =
73                                             minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest"
74                                     }
75                                     println 'New tag for docker: ' + project.properties['project.docker.latest.minmax.tag.version']
76                                 }
77                             </source>
78                         </configuration>
79                     </execution>
80                 </executions>
81             </plugin>
82
83             <plugin>
84                 <groupId>io.fabric8</groupId>
85                 <artifactId>docker-maven-plugin</artifactId>
86
87                 <configuration>
88                     <verbose>true</verbose>
89                     <apiVersion>1.23</apiVersion>
90                     <pullRegistry>${docker.pull.registry}</pullRegistry>
91                     <pushRegistry>${docker.push.registry}</pushRegistry>
92
93                     <images>
94                         <image>
95                             <name>onap/policy-pap</name>
96                             <build>
97                                 <cleanup>try</cleanup>
98                                 <dockerFile>Dockerfile</dockerFile>
99                                 <tags>
100                                     <tag>${project.version}</tag>
101                                     <tag>${project.version}-${maven.build.timestamp}</tag>
102                                     <tag>${project.docker.latest.minmax.tag.version}</tag>
103                                 </tags>
104                                 <assembly>
105                                     <inline>
106                                         <dependencySets>
107                                             <dependencySet>
108                                                 <includes>
109                                                     <include>org.onap.policy.pap:policy-pap-tarball</include>
110                                                 </includes>
111                                                 <outputDirectory>/lib</outputDirectory>
112                                                 <outputFileNameMapping>policy-pap.tar.gz</outputFileNameMapping>
113                                             </dependencySet>
114                                         </dependencySets>
115                                     </inline>
116                                 </assembly>
117                             </build>
118                         </image>
119                     </images>
120                 </configuration>
121
122                 <executions>
123                     <execution>
124                         <id>clean-images</id>
125                         <phase>pre-clean</phase>
126                         <goals>
127                             <goal>remove</goal>
128                         </goals>
129                         <configuration>
130                             <removeAll>true</removeAll>
131                         </configuration>
132                     </execution>
133
134                     <execution>
135                         <id>generate-images</id>
136                         <phase>generate-sources</phase>
137                         <goals>
138                             <goal>build</goal>
139                         </goals>
140                     </execution>
141
142                     <execution>
143                         <id>push-images</id>
144                         <phase>deploy</phase>
145                         <goals>
146                             <goal>build</goal>
147                             <goal>push</goal>
148                         </goals>
149                         <configuration>
150                             <image>onap/policy-pap</image>
151                         </configuration>
152                     </execution>
153                 </executions>
154             </plugin>
155
156             <plugin>
157                 <groupId>org.apache.maven.plugins</groupId>
158                 <artifactId>maven-deploy-plugin</artifactId>
159                 <configuration>
160                     <skip>true</skip>
161                 </configuration>
162             </plugin>
163         </plugins>
164     </build>
165
166     <dependencies>
167         <dependency>
168             <groupId>org.onap.policy.pap</groupId>
169             <artifactId>policy-pap-tarball</artifactId>
170             <version>${project.version}</version>
171             <classifier>tarball</classifier>
172             <type>tar.gz</type>
173         </dependency>
174     </dependencies>
175 </project>