afbc6617a05f4564df404b856da6414fca92da9e
[ccsdk/cds.git] / ms / controllerblueprints / distribution / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3   ~  Copyright © 2017-2018 AT&T Intellectual Property.
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 <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">
18     <modelVersion>4.0.0</modelVersion>
19     <parent>
20         <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
21         <artifactId>parent</artifactId>
22         <version>0.4.0-SNAPSHOT</version>
23         <relativePath>../parent</relativePath>
24     </parent>
25     <artifactId>distribution</artifactId>
26     <packaging>pom</packaging>
27     <name>Controller Blueprints Distribution</name>
28     <properties>
29         <assembly.id>maven</assembly.id>
30         <name.space>org.onap.ccsdk.apps</name.space>     <!-- <name.space>${namespace}</name.space> -->
31         <serviceArtifactName>controllerblueprints</serviceArtifactName>
32         <image.name>onap/ccsdk-controllerblueprints</image.name>
33                 <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
34                 <docker.push.phase>deploy</docker.push.phase>
35                 <docker.verbose>true</docker.verbose>
36         </properties>
37
38     <dependencies>
39         <dependency>
40             <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
41             <artifactId>application</artifactId>
42         </dependency>
43     </dependencies>
44     <build>
45         <plugins>
46             <plugin>
47                 <artifactId>maven-resources-plugin</artifactId>
48                 <version>2.6</version>
49                 <executions>
50                     <execution>
51                         <id>copy-dockerfile</id>
52                         <goals>
53                             <goal>copy-resources</goal>
54                         </goals><!-- here the phase you need -->
55                         <phase>validate</phase>
56                         <configuration>
57                             <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
58                             <resources>
59                                 <resource>
60                                     <directory>src/main/docker</directory>
61                                     <includes>
62                                         <include>*</include>
63                                     </includes>
64                                     <filtering>true</filtering>
65                                 </resource>
66                             </resources>
67                         </configuration>
68                     </execution>
69                 </executions>
70             </plugin>
71             <plugin>
72                 <groupId>org.apache.maven.plugins</groupId>
73                 <artifactId>maven-antrun-plugin</artifactId>
74                 <executions>
75                     <execution>
76                         <id>ant-test</id>
77                         <phase>package</phase>
78                         <configuration>
79                             <tasks>
80                                 <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/>
81                             </tasks>
82                         </configuration>
83                         <goals>
84                             <goal>run</goal>
85                         </goals>
86                     </execution>
87                 </executions>
88             </plugin>
89             <plugin>
90                 <!--build the final artifact for docker deployment -->
91                 <artifactId>maven-assembly-plugin</artifactId>
92                 <version>3.1.0</version>
93                 <configuration>
94                     <!-- <skipAssembly>${skip.assembly}</skipAssembly>-->
95                     <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
96                     <descriptors>
97                         <descriptor>src/main/docker/distribution.xml</descriptor>
98                     </descriptors>
99                     <tarLongFileMode>posix</tarLongFileMode>
100                 </configuration>
101                 <executions>
102                     <execution>
103                         <id>${assembly.id}</id>
104                         <phase>package</phase>
105                         <goals>
106                             <goal>single</goal>
107                         </goals>
108                     </execution>
109                 </executions>
110             </plugin>
111             <plugin>
112                 <groupId>org.codehaus.groovy.maven</groupId>
113                 <artifactId>gmaven-plugin</artifactId>
114                 <version>1.0</version>
115                 <executions>
116                     <execution>
117                         <phase>validate</phase>
118                         <goals>
119                             <goal>execute</goal>
120                         </goals>
121                         <configuration>
122                             <source>
123                                 println project.properties['ccsdk.project.version'];
124                                 def versionArray;
125                                 if (project.properties['ccsdk.project.version'] != null ) {
126                                     versionArray = project.properties['ccsdk.project.version'].split('\\.');
127                                 }
128
129                                 if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
130                                 {
131                                     project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
132                                 } else {
133                                     project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest";
134                                 }
135
136                                 println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
137                             </source>
138                         </configuration>
139                     </execution>
140                 </executions>
141             </plugin>
142
143         </plugins>
144     </build>
145
146         <profiles>
147                 <profile>
148                         <id>docker</id>
149                         <build>
150                                 <plugins>
151                                         <plugin>
152                                                 <groupId>io.fabric8</groupId>
153                                                 <artifactId>docker-maven-plugin</artifactId>
154                                                 <version>0.26.1</version>
155                                                 <inherited>false</inherited>
156                                                 <configuration>
157                                                         <images>
158                                                                 <image>
159                                                                         <name>${image.name}</name>
160                                                                         <build>
161                                                                                 <cleanup>try</cleanup>
162                                                                                 <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
163                                                                                 <tags>
164                                                                                         <tag>${project.version}</tag>
165                                                                                         <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
166                                                                                         <tag>${project.docker.latesttag.version}</tag>
167                                                                                 </tags>
168                                                                         </build>
169                                                                 </image>
170                                                         </images>
171                                                         <verbose>true</verbose>
172                                                 </configuration>
173                                                 <executions>
174                             <execution>
175                                 <id>generate-images</id>
176                                 <phase>package</phase>
177                                 <goals>
178                                     <goal>build</goal>
179                                 </goals>
180                             </execution>
181                             <execution>
182                                 <id>push-images</id>
183                                 <phase>${docker.push.phase}</phase>
184                                 <goals>
185                                     <goal>build</goal>
186                                     <goal>push</goal>
187                                 </goals>
188                             </execution>
189                                                 </executions>
190                                         </plugin>
191                                 </plugins>
192                         </build>
193                 </profile>
194
195         </profiles>
196 </project>