47252e2634741235b0c0a7b14b11b84cac56c662
[policy/xacml-pdp.git] / packages / policy-xacmlpdp-docker / pom.xml
1 <!--
2   ============LICENSE_START=======================================================
3    Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
4   ================================================================================
5   Licensed under the Apache License, Version 2.0 (the "License");
6   you may not use this file except in compliance with the License.
7   You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11   Unless required by applicable law or agreed to in writing, software
12   distributed under the License is distributed on an "AS IS" BASIS,
13   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   See the License for the specific language governing permissions and
15   limitations under the License.
16
17   SPDX-License-Identifier: Apache-2.0
18   ============LICENSE_END=========================================================
19 -->
20
21 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23
24     <modelVersion>4.0.0</modelVersion>
25     <parent>
26         <groupId>org.onap.policy.xacml-pdp</groupId>
27         <artifactId>packages</artifactId>
28         <version>2.1.3-SNAPSHOT</version>
29     </parent>
30
31     <packaging>pom</packaging>
32     <artifactId>policy-xacmlpdp-docker</artifactId>
33     
34     <name>${project.artifactId}</name>
35     <description>Creates Policy Xacml PDP docker images</description>
36
37     <properties>
38         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
39         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
40         <pdpx.project.version>${project.version}</pdpx.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['pdpx.project.version'];
65                                 if (project.properties['pdpx.project.version'] != null) {
66                                     def versionArray = project.properties['pdpx.project.version'].split('-')
67                                     def minMaxVersionArray = versionArray[0].tokenize('.')
68                                     if (project.properties['pdpx.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                 <version>0.28.0</version>
87
88                 <configuration>
89                     <verbose>true</verbose>
90                     <apiVersion>1.23</apiVersion>
91                     <pullRegistry>${docker.pull.registry}</pullRegistry>
92                     <pushRegistry>${docker.push.registry}</pushRegistry>
93
94                     <images>
95                         <image>
96                             <name>onap/policy-xacml-pdp</name>
97                             <build>
98                                 <cleanup>try</cleanup>
99                                 <dockerFile>Dockerfile</dockerFile>
100                                 <tags>
101                                     <tag>${project.version}</tag>
102                                     <tag>${project.version}-${maven.build.timestamp}</tag>
103                                     <tag>${project.docker.latest.minmax.tag.version}</tag>
104                                 </tags>
105                                 <assembly>
106                                     <inline>
107                                         <dependencySets>
108                                             <dependencySet>
109                                                 <includes>
110                                                     <include>org.onap.policy.xacml-pdp:policy-xacmlpdp-tarball</include>
111                                                 </includes>
112                                                 <outputDirectory>/lib</outputDirectory>
113                                                 <outputFileNameMapping>policy-xacmlpdp.tar.gz</outputFileNameMapping>
114                                             </dependencySet>
115                                         </dependencySets>
116                                     </inline>
117                                 </assembly>
118                             </build>
119                         </image>
120                     </images>
121                 </configuration>
122
123                 <executions>
124                     <execution>
125                         <id>clean-images</id>
126                         <phase>pre-clean</phase>
127                         <goals>
128                             <goal>remove</goal>
129                         </goals>
130                         <configuration>
131                             <removeAll>true</removeAll>
132                         </configuration>
133                     </execution>
134
135                     <execution>
136                         <id>generate-images</id>
137                         <phase>generate-sources</phase>
138                         <goals>
139                             <goal>build</goal>
140                         </goals>
141                     </execution>
142
143                     <execution>
144                         <id>push-images</id>
145                         <phase>deploy</phase>
146                         <goals>
147                             <goal>build</goal>
148                             <goal>push</goal>
149                         </goals>
150                         <configuration>
151                             <image>onap/policy-xacml-pdp</image>
152                         </configuration>
153                     </execution>
154                 </executions>
155             </plugin>
156
157             <plugin>
158                 <groupId>org.apache.maven.plugins</groupId>
159                 <artifactId>maven-deploy-plugin</artifactId>
160                 <configuration>
161                     <skip>true</skip>
162                 </configuration>
163             </plugin>
164         </plugins>
165     </build>
166
167     <dependencies>
168         <dependency>
169             <groupId>org.onap.policy.xacml-pdp</groupId>
170             <artifactId>policy-xacmlpdp-tarball</artifactId>
171             <version>${project.version}</version>
172             <classifier>tarball</classifier>
173             <type>tar.gz</type>
174         </dependency>
175     </dependencies>
176 </project>