3d592a0993e58d13fa5b49e3757828ef404b297c
[appc/deployment.git] / cdt / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 ============LICENSE_START==========================================
4 ONAP : APPC
5 ===================================================================
6 Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
7 ===================================================================
8
9 Unless otherwise specified, all software contained herein is licensed
10 under the Apache License, Version 2.0 (the License);
11 you may not use this software except in compliance with the License.
12 You may obtain a copy of the License at
13
14     http://www.apache.org/licenses/LICENSE-2.0
15
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
21
22 ============LICENSE_END============================================
23 -->
24 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
25     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
26
27     <parent>
28         <groupId>org.onap.appc.deployment</groupId>
29         <artifactId>appc-docker-project</artifactId>
30         <version>1.5.0-SNAPSHOT</version>
31     </parent>
32
33     <modelVersion>4.0.0</modelVersion>
34     <packaging>pom</packaging>
35     <groupId>org.onap.appc.deployment</groupId>
36     <artifactId>installation-cdt</artifactId>
37     <version>1.5.0-SNAPSHOT</version>
38
39     <name>Installation - CDT Docker</name>
40     <description>Creates APPC CDT Docker container</description>
41
42     <properties>
43         <image.name>onap/appc-cdt-image</image.name>
44         <appc.release.version>1.4.0</appc.release.version>
45         <appc.snapshot.version>1.5.0-SNAPSHOT</appc.snapshot.version>
46                 <!--This version will be over-ridden by jenkins 
47                     injecting the version.properties variable file during docker build-->
48         <appc.docker.staging.version>1.0.0</appc.docker.staging.version>
49         <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
50     </properties>
51
52
53     <build>
54         <plugins>
55             
56             <!-- This is to add any extra scripts, sql dump files, properties files APPC may need even after inheriting from the sdnc base image -->
57             <plugin>
58                 <artifactId>maven-resources-plugin</artifactId>
59                 <version>2.6</version>
60                 <executions>
61                     <execution>
62                         <id>copy-dockerfile</id>
63                         <goals>
64                             <goal>copy-resources</goal>
65                         </goals><!-- here the phase you need -->
66                         <phase>validate</phase>
67                         <configuration>
68                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
69                             <resources>
70                                 <resource>
71                                     <directory>src/main/docker</directory>
72                                     <includes>
73                                         <include>Dockerfile</include>
74                                     </includes>
75                                     <filtering>true</filtering>
76                                 </resource>
77                             </resources>
78                         </configuration>
79                     </execution>
80                     <execution>
81                         <id>copy-scripts</id>
82                         <goals>
83                             <goal>copy-resources</goal>
84                         </goals>
85                         <phase>validate</phase>
86                         <configuration>
87                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
88                             <resources>
89                                 <resource>
90                                     <directory>src/main/scripts</directory>
91                                     <includes>
92                                         <include>*.sh</include>
93                                     </includes>
94                                     <filtering>false</filtering>
95                                 </resource>
96                             </resources>
97                         </configuration>
98                     </execution>
99                 </executions>
100             </plugin>
101             <plugin>
102                 <artifactId>exec-maven-plugin</artifactId>
103                 <groupId>org.codehaus.mojo</groupId>
104                 <version>1.5.0</version>
105                 <executions>
106                     <execution>
107                         <id>Get features</id>
108                         <phase>generate-sources</phase>
109                         <goals>
110                             <goal>exec</goal>
111                         </goals>
112                         <configuration>
113                             <executable>bash</executable>
114                             <environmentVariables>
115                                 <APPC_VERSION>${appc.version}</APPC_VERSION>
116                                 <APPC_OAM_VERSION>${project.version}</APPC_OAM_VERSION>
117                                 <SDNC_OAM_VERSION>${project.version}</SDNC_OAM_VERSION>
118                             </environmentVariables>
119                             <arguments>
120                                 <argument>${basedir}/src/main/scripts/installZips.sh</argument>
121                                 <argument>${basedir}/target/docker-stage</argument>
122                             </arguments>
123                         </configuration>
124                     </execution>
125
126                 </executions>
127             </plugin>
128         </plugins>
129     </build>
130
131     <profiles>
132         <profile>
133             <id>docker</id>
134             <build>
135                 <plugins>
136                     <plugin>
137                         <groupId>org.codehaus.groovy.maven</groupId>
138                         <artifactId>gmaven-plugin</artifactId>
139                         <executions>
140                             <execution>
141                                 <phase>validate</phase>
142                                 <goals>
143                                     <goal>execute</goal>
144                                 </goals>
145                                 <configuration>
146                                     <properties>
147                                         <ver>${project.version}</ver>
148                                         <timestamp>${maven.build.timestamp}</timestamp>
149                                     </properties>
150                                     <source>
151                                         println project.properties['ver'];
152                                         def versionArray;
153                                         if ( project.properties['ver'] != null ) {
154                                         versionArray = project.properties['ver'].split('\\.');
155                                         }
156                                         if ( project.properties['ver'].endsWith("-SNAPSHOT") ) {
157                                         project.properties['dockertag1']=project.properties['ver'] + "-latest";
158                                         project.properties['dockertag2']=project.properties['ver'] + "-" + project.properties['timestamp'];
159                                         project.properties['appc.version']=project.properties['appc.snapshot.version'];
160                                         } else {
161                                         project.properties['dockertag1']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
162                                         project.properties['dockertag2']=project.properties['ver'] + "-STAGING-" + project.properties['timestamp'];
163                                         project.properties['appc.version']=project.properties['appc.release.version'];
164                                         }
165                                         println 'docker tag 1: ' + project.properties['dockertag1'];
166                                         println 'docker tag 2: ' + project.properties['dockertag2'];
167                                     </source>
168                                 </configuration>
169                             </execution>
170                         </executions>
171                     </plugin>
172                     <plugin>
173                         <groupId>io.fabric8</groupId>
174                         <artifactId>docker-maven-plugin</artifactId>
175                         <version>0.16.5</version>
176                         <inherited>false</inherited>
177                         <configuration>
178                             <images>
179                                 <image>
180                                     <name>${image.name}</name>
181                                     <build>
182                                         <cleanup>try</cleanup>
183                                         <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
184                                         <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
185                                         <tags>
186                                             <tag>${dockertag1}</tag>
187                                             <tag>${dockertag2}</tag>
188                                         </tags>
189                                     </build>
190                                 </image>
191                             </images>
192                         </configuration>
193                         <executions>
194                             <execution>
195                                 <id>generate-images</id>
196                                 <phase>package</phase>
197                                 <goals>
198                                     <goal>build</goal>
199                                 </goals>
200                             </execution>
201
202                             <execution>
203                                 <id>push-images</id>
204                                 <phase>deploy</phase>
205                                 <goals>
206                                     <goal>build</goal>
207                                     <goal>push</goal>
208                                 </goals>
209                             </execution>
210                         </executions>
211                     </plugin>
212
213                     <!-- This is to add any extra scripts, sql dump files, properties files 
214                         APPC may need even after inheriting from the sdnc base image -->
215                     <plugin>
216                         <artifactId>maven-resources-plugin</artifactId>
217                         <version>2.6</version>
218                         <executions>
219                             <execution>
220                                 <id>copy-dockerfile</id>
221                                 <goals>
222                                     <goal>copy-resources</goal>
223                                 </goals><!-- here the phase you need -->
224                                 <phase>validate</phase>
225                                 <configuration>
226                                     <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
227                                     <resources>
228                                         <resource>
229                                             <directory>src/main/docker</directory>
230                                             <includes>
231                                                 <include>Dockerfile</include>
232                                             </includes>
233                                             <filtering>true</filtering>
234                                         </resource>
235                                     </resources>
236                                 </configuration>
237                             </execution>
238                             <execution>
239                                 <id>copy-scripts</id>
240                                 <goals>
241                                     <goal>copy-resources</goal>
242                                 </goals>
243                                 <phase>validate</phase>
244                                 <configuration>
245                                     <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
246                                     <resources>
247                                         <resource>
248                                             <directory>src/main/scripts</directory>
249                                             <includes>
250                                                 <include>*.sh</include>
251                                             </includes>
252                                             <filtering>false</filtering>
253                                         </resource>
254                                     </resources>
255                                 </configuration>
256                             </execution>
257                         </executions>
258                     </plugin>
259                     <plugin>
260                         <artifactId>exec-maven-plugin</artifactId>
261                         <groupId>org.codehaus.mojo</groupId>
262                         <version>1.5.0</version>
263                         <executions>
264                             <execution>
265                                 <id>Get features</id>
266                                 <phase>generate-sources</phase>
267                                 <goals>
268                                     <goal>exec</goal>
269                                 </goals>
270                                 <configuration>
271                                     <executable>bash</executable>
272                                     <environmentVariables>
273                                         <APPC_VERSION>${appc.version}</APPC_VERSION>
274                                         <APPC_OAM_VERSION>${project.version}</APPC_OAM_VERSION>
275                                         <SDNC_OAM_VERSION>${project.version}</SDNC_OAM_VERSION>
276                                     </environmentVariables>
277                                     <arguments>
278                                         <argument>${basedir}/src/main/scripts/installZips.sh</argument>
279                                         <argument>${basedir}/target/docker-stage</argument>
280                                         <argument>${basedir}/target/docker-stage</argument>
281                                     </arguments>
282                                 </configuration>
283                             </execution>
284
285
286                         </executions>
287                     </plugin>
288                 </plugins>
289             </build>
290
291         </profile>
292     </profiles>
293     
294     <organization>
295         <name>ONAP</name>
296     </organization>
297     
298 </project>