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