Merge "Enhance gRPC Simulator:"
[policy/models.git] / models-sim / packages / models-simulator-docker / pom.xml
1 <!--
2   ============LICENSE_START=======================================================
3    Copyright (C) 2020 Bell Canada.
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     <modelVersion>4.0.0</modelVersion>
24     <parent>
25         <groupId>org.onap.policy.models.sim</groupId>
26         <artifactId>policy-models-sim</artifactId>
27         <version>2.3.2-SNAPSHOT</version>
28     </parent>
29
30     <artifactId>models-simulator-docker</artifactId>
31     <packaging>pom</packaging>
32
33     <name>${project.artifactId}</name>
34     <description>The module for creating docker images of Simulators component.</description>
35
36     <properties>
37         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
38         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
39         <dist.project.version>${project.version}</dist.project.version>
40         <docker.skip>false</docker.skip>
41         <docker.skip.build>false</docker.skip.build>
42         <docker.skip.push>false</docker.skip.push>
43         <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
44         <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
45         <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
46     </properties>
47
48     <build>
49         <finalName>${project.artifactId}-${project.version}</finalName>
50         <plugins>
51             <plugin>
52                 <groupId>org.codehaus.groovy.maven</groupId>
53                 <artifactId>gmaven-plugin</artifactId>
54                 <version>1.0</version>
55                 <executions>
56                     <execution>
57                         <phase>validate</phase>
58                         <goals>
59                             <goal>execute</goal>
60                         </goals>
61                         <configuration>
62                             <source>
63                                 println 'Project version: ' + project.properties['dist.project.version']
64                                 if (project.properties['dist.project.version'] != null) {
65                                     def versionArray = project.properties['dist.project.version'].split('-')
66                                     def minMaxVersionArray = versionArray[0].tokenize('.')
67                                     if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) {
68                                         project.properties['project.docker.latest.minmax.tag.version'] =
69                                           minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest"
70                                     } else {
71                                         project.properties['project.docker.latest.minmax.tag.version'] =
72                                           minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest"
73                                     }
74                                     println 'New tag for docker: ' + project.properties['project.docker.latest.minmax.tag.version']
75                                 }
76                             </source>
77                         </configuration>
78                     </execution>
79                 </executions>
80             </plugin>
81
82             <plugin>
83                 <groupId>io.fabric8</groupId>
84                 <artifactId>docker-maven-plugin</artifactId>
85
86                 <configuration>
87                     <verbose>true</verbose>
88                     <apiVersion>1.23</apiVersion>
89                     <pullRegistry>${docker.pull.registry}</pullRegistry>
90                     <pushRegistry>${docker.push.registry}</pushRegistry>
91
92                     <images>
93                         <image>
94                             <name>onap/policy-models-simulator</name>
95                             <build>
96                                 <cleanup>try</cleanup>
97                                 <dockerFile>Dockerfile</dockerFile>
98                                 <tags>
99                                     <tag>${project.version}</tag>
100                                     <tag>${project.version}-${maven.build.timestamp}</tag>
101                                     <tag>${project.docker.latest.minmax.tag.version}</tag>
102                                 </tags>
103                                 <assembly>
104                                     <inline>
105                                         <dependencySets>
106                                             <dependencySet>
107                                                 <includes>
108                                                     <include>org.onap.policy.models.sim:models-simulator-tarball</include>
109                                                 </includes>
110                                                 <outputDirectory>/lib</outputDirectory>
111                                                 <outputFileNameMapping>models-simulator.tar.gz</outputFileNameMapping>
112                                             </dependencySet>
113                                         </dependencySets>
114                                     </inline>
115                                 </assembly>
116                             </build>
117                         </image>
118                     </images>
119                 </configuration>
120
121                 <executions>
122                     <execution>
123                         <id>clean-images</id>
124                         <phase>pre-clean</phase>
125                         <goals>
126                             <goal>remove</goal>
127                         </goals>
128                         <configuration>
129                             <removeAll>true</removeAll>
130                         </configuration>
131                     </execution>
132
133                     <execution>
134                         <id>generate-images</id>
135                         <phase>generate-sources</phase>
136                         <goals>
137                             <goal>build</goal>
138                         </goals>
139                     </execution>
140
141                     <execution>
142                         <id>push-images</id>
143                         <phase>deploy</phase>
144                         <goals>
145                             <goal>build</goal>
146                             <goal>push</goal>
147                         </goals>
148                         <configuration>
149                             <image>onap/policy-models-simulator</image>
150                         </configuration>
151                     </execution>
152                 </executions>
153             </plugin>
154
155             <plugin>
156                 <groupId>org.apache.maven.plugins</groupId>
157                 <artifactId>maven-deploy-plugin</artifactId>
158                 <configuration>
159                     <skip>true</skip>
160                 </configuration>
161             </plugin>
162         </plugins>
163     </build>
164
165     <dependencies>
166         <dependency>
167             <groupId>org.onap.policy.models.sim</groupId>
168             <artifactId>models-simulator-tarball</artifactId>
169             <version>2.3.2-SNAPSHOT</version>
170             <classifier>tarball</classifier>
171             <type>tar.gz</type>
172         </dependency>
173     </dependencies>
174 </project>