709f8176222cfc9f50d236acad678486cc5d3947
[policy/docker.git] / policy-db-migrator / pom.xml
1 <!--
2   ============LICENSE_START=======================================================
3    Copyright (C) 2021 Nordix Foundation
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.docker</groupId>
26         <artifactId>docker</artifactId>
27         <version>2.3.0-SNAPSHOT</version>
28     </parent>
29
30     <artifactId>policy-db-migrator</artifactId>
31     <packaging>pom</packaging>
32
33     <name>Policy db-migrator docker image</name>
34     <description>Policy db-migrator docker image.</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         <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
44         <docker.dbm.imagename>onap/policy-db-migrator</docker.dbm.imagename>
45     </properties>
46
47     <build>
48         <finalName>${project.artifactId}-${project.version}</finalName>
49         <plugins>
50             <plugin>
51                 <groupId>org.codehaus.groovy.maven</groupId>
52                 <artifactId>gmaven-plugin</artifactId>
53                 <version>1.0</version>
54                 <executions>
55                     <execution>
56                         <phase>validate</phase>
57                         <goals>
58                             <goal>execute</goal>
59                         </goals>
60                         <configuration>
61                             <source>
62                                 println 'Project version: ' + project.properties['dist.project.version'];
63                                 def versionArray;
64                                 if ( project.properties['dist.project.version'] != null ) {
65                                     versionArray = project.properties['dist.project.version'].split('-');
66                                 }
67
68                                 if ( project.properties['dist.project.version'].endsWith("-SNAPSHOT") ) {
69                                     project.properties['project.docker.latesttag.version']=versionArray[0] + "-SNAPSHOT-latest";
70                                 } else {
71                                     project.properties['project.docker.latesttag.version']=versionArray[0] + "-STAGING-latest";
72                                 }
73
74                                 println 'New tag for docker: ' + project.properties['project.docker.latesttag.version'];
75                             </source>
76                         </configuration>
77                     </execution>
78                 </executions>
79             </plugin>
80             <plugin>
81                 <groupId>io.fabric8</groupId>
82                 <artifactId>docker-maven-plugin</artifactId>
83
84                 <configuration>
85                     <verbose>true</verbose>
86                     <apiVersion>1.23</apiVersion>
87                     <pullRegistry>${docker.pull.registry}</pullRegistry>
88                     <pushRegistry>${docker.push.registry}</pushRegistry>
89                     <images>
90                         <image>
91                             <name>${docker.dbm.imagename}</name>
92                             <build>
93                                 <cleanup>try</cleanup>
94                                 <dockerFile>Dockerfile</dockerFile>
95                                 <tags>
96                                     <tag>${project.version}</tag>
97                                     <tag>${project.version}-${maven.build.timestamp}</tag>
98                                     <tag>${project.docker.latesttag.version}</tag>
99                                 </tags>
100                             </build>
101                         </image>
102                     </images>
103                 </configuration>
104
105                 <executions>
106                     <execution>
107                         <id>clean-images</id>
108                         <phase>pre-clean</phase>
109                         <goals>
110                             <goal>remove</goal>
111                         </goals>
112                         <configuration>
113                             <removeAll>true</removeAll>
114                         </configuration>
115                     </execution>
116
117                     <execution>
118                         <id>generate-images</id>
119                         <phase>generate-sources</phase>
120                         <goals>
121                             <goal>build</goal>
122                         </goals>
123                     </execution>
124
125                     <execution>
126                         <id>push-images</id>
127                         <phase>deploy</phase>
128                         <goals>
129                             <goal>build</goal>
130                             <goal>push</goal>
131                         </goals>
132                         <configuration>
133                             <image>${docker.dbm.imagename}</image>
134                         </configuration>
135                     </execution>
136                 </executions>
137             </plugin>
138             <plugin>
139                 <groupId>org.apache.maven.plugins</groupId>
140                 <artifactId>maven-deploy-plugin</artifactId>
141                 <configuration>
142                     <skip>true</skip>
143                 </configuration>
144             </plugin>
145             <plugin>
146                 <groupId>org.apache.maven.plugins</groupId>
147                 <artifactId>maven-install-plugin</artifactId>
148                 <configuration>
149                     <skip>true</skip>
150                 </configuration>
151             </plugin>
152         </plugins>
153     </build>
154 </project>