Merge "Added new RST files for Microservices"
[ccsdk/apps.git] / ms / controllerblueprints / distribution / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3   ~  Copyright © 2017-2018 AT&T Intellectual Property.
4   ~  Modifications Copyright © 2019 Bell Canada.
5   ~
6   ~  Licensed under the Apache License, Version 2.0 (the "License");
7   ~  you may not use this file except in compliance with the License.
8   ~  You may obtain a copy of the License at
9   ~
10   ~      http://www.apache.org/licenses/LICENSE-2.0
11   ~
12   ~  Unless required by applicable law or agreed to in writing, software
13   ~  distributed under the License is distributed on an "AS IS" BASIS,
14   ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   ~  See the License for the specific language governing permissions and
16   ~  limitations under the License.
17   -->
18 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
19     <modelVersion>4.0.0</modelVersion>
20     <parent>
21         <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
22         <artifactId>parent</artifactId>
23         <version>0.4.1-SNAPSHOT</version>
24         <relativePath>../parent</relativePath>
25     </parent>
26     <artifactId>distribution</artifactId>
27     <packaging>pom</packaging>
28     <name>Controller Blueprints Distribution</name>
29     <properties>
30         <assembly.id>maven</assembly.id>
31         <name.space>org.onap.ccsdk.apps</name.space>     <!-- <name.space>${namespace}</name.space> -->
32         <serviceArtifactName>controllerblueprints</serviceArtifactName>
33         <image.name>onap/ccsdk-controllerblueprints</image.name>
34         <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
35         <docker.push.phase>deploy</docker.push.phase>
36         <docker.verbose>true</docker.verbose>
37     </properties>
38
39     <dependencies>
40         <dependency>
41             <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
42             <artifactId>application</artifactId>
43         </dependency>
44     </dependencies>
45     <build>
46         <plugins>
47             <plugin>
48                 <artifactId>maven-resources-plugin</artifactId>
49                 <version>2.6</version>
50                 <executions>
51                     <execution>
52                         <id>copy-dockerfile</id>
53                         <goals>
54                             <goal>copy-resources</goal>
55                         </goals><!-- here the phase you need -->
56                         <phase>validate</phase>
57                         <configuration>
58                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
59                             <resources>
60                                 <resource>
61                                     <directory>src/main/docker</directory>
62                                     <includes>
63                                         <include>*</include>
64                                     </includes>
65                                     <filtering>true</filtering>
66                                 </resource>
67                             </resources>
68                         </configuration>
69                     </execution>
70                 </executions>
71             </plugin>
72             <plugin>
73                 <groupId>org.apache.maven.plugins</groupId>
74                 <artifactId>maven-antrun-plugin</artifactId>
75                 <executions>
76                     <execution>
77                         <id>ant-test</id>
78                         <phase>package</phase>
79                         <configuration>
80                             <tasks>
81                                 <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/>
82                             </tasks>
83                         </configuration>
84                         <goals>
85                             <goal>run</goal>
86                         </goals>
87                     </execution>
88                 </executions>
89             </plugin>
90             <plugin>
91                 <!--build the final artifact for docker deployment -->
92                 <artifactId>maven-assembly-plugin</artifactId>
93                 <version>3.1.0</version>
94                 <configuration>
95                     <!-- <skipAssembly>${skip.assembly}</skipAssembly>-->
96                     <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
97                     <descriptors>
98                         <descriptor>src/main/docker/distribution.xml</descriptor>
99                     </descriptors>
100                     <tarLongFileMode>posix</tarLongFileMode>
101                 </configuration>
102                 <executions>
103                     <execution>
104                         <id>${assembly.id}</id>
105                         <phase>package</phase>
106                         <goals>
107                             <goal>single</goal>
108                         </goals>
109                     </execution>
110                 </executions>
111             </plugin>
112             <plugin>
113                 <groupId>org.codehaus.groovy.maven</groupId>
114                 <artifactId>gmaven-plugin</artifactId>
115                 <version>1.0</version>
116                 <executions>
117                     <execution>
118                         <phase>validate</phase>
119                         <goals>
120                             <goal>execute</goal>
121                         </goals>
122                         <configuration>
123                             <source>
124                                 println project.properties['ccsdk.project.version']
125                                 def versionArray
126                                 if (project.properties['ccsdk.project.version'] != null ) {
127                                     versionArray = project.properties['ccsdk.project.version'].split('\\.')
128                                 }
129
130                                 if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
131                                 {
132                                     project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest"
133                                 } else {
134                                     project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest"
135                                 }
136
137                                 println 'New Tag for docker:' + project.properties['project.docker.latesttag.version']
138                             </source>
139                         </configuration>
140                     </execution>
141                 </executions>
142             </plugin>
143
144         </plugins>
145     </build>
146
147     <profiles>
148         <profile>
149             <id>docker</id>
150             <build>
151                 <plugins>
152                     <plugin>
153                         <groupId>io.fabric8</groupId>
154                         <artifactId>docker-maven-plugin</artifactId>
155                         <version>0.26.1</version>
156                         <inherited>false</inherited>
157                         <configuration>
158                             <images>
159                                 <image>
160                                     <name>${image.name}</name>
161                                     <build>
162                                         <cleanup>try</cleanup>
163                                         <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
164                                         <tags>
165                                             <tag>${project.version}</tag>
166                                             <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
167                                             <tag>${project.docker.latesttag.version}</tag>
168                                         </tags>
169                                     </build>
170                                 </image>
171                             </images>
172                             <verbose>true</verbose>
173                         </configuration>
174                         <executions>
175                             <execution>
176                                 <id>generate-images</id>
177                                 <phase>package</phase>
178                                 <goals>
179                                     <goal>build</goal>
180                                 </goals>
181                             </execution>
182                             <execution>
183                                 <id>push-images</id>
184                                 <phase>${docker.push.phase}</phase>
185                                 <goals>
186                                     <goal>build</goal>
187                                     <goal>push</goal>
188                                 </goals>
189                             </execution>
190                         </executions>
191                     </plugin>
192                 </plugins>
193             </build>
194         </profile>
195
196     </profiles>
197 </project>