Roll versions for Casablanca - distribution
[ccsdk/distribution.git] / dgbuilder-docker / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <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">
3         <modelVersion>4.0.0</modelVersion>
4
5         <parent>
6                 <groupId>org.onap.ccsdk.distribution</groupId>
7                 <artifactId>distribution-root</artifactId>
8                 <version>0.3.0-SNAPSHOT</version>
9         </parent>
10
11         <groupId>org.onap.ccsdk.distribution</groupId>
12         <artifactId>distribution-dgbuilder-docker</artifactId>
13         <version>0.3.0-SNAPSHOT</version>
14         <packaging>pom</packaging>
15
16         <name>ccsdk-distribution :: dgbuilder-docker</name>
17         <description>Creates docker container for dgbuilder</description>
18         <organization>
19                 <name>ONAP</name>
20         </organization>
21
22         <properties>
23                 <image.name>onap/ccsdk-dgbuilder-image</image.name>
24                 <ccsdk.project.version>${project.version}</ccsdk.project.version>
25         </properties>
26
27         <build>
28                 <plugins>
29
30
31             <plugin>
32                 <groupId>org.codehaus.groovy.maven</groupId>
33                 <artifactId>gmaven-plugin</artifactId>
34                 <executions>
35                     <execution>
36                         <phase>validate</phase>
37                         <goals>
38                             <goal>execute</goal>
39                         </goals>
40                         <configuration>
41                             <source>
42                                 println project.properties['ccsdk.project.version'];
43                                 def versionArray;
44                                 if ( project.properties['ccsdk.project.version'] != null ) {
45                                     versionArray = project.properties['ccsdk.project.version'].split('\\.');
46                                 }
47
48                                 if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
49                                 {
50                                     project.properties['project.docker.latesttag.version']=versionArray[0]  + '.' + versionArray[1] + "-STAGING-latest";
51                                 } else {
52                                     project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
53                                 }
54
55                                 println 'New Tag for docker:' +
56                                 project.properties['project.docker.latesttag.version'];
57                             </source>
58                         </configuration>
59                     </execution>
60                 </executions>
61             </plugin>
62                         <plugin>
63                                 <artifactId>maven-resources-plugin</artifactId>
64                                 <version>2.6</version>
65                                 <executions>
66                                         <execution>
67                                                 <id>copy-dockerfile</id>
68                                                 <goals>
69                                                         <goal>copy-resources</goal>
70                                                 </goals><!-- here the phase you need -->
71                                                 <phase>validate</phase>
72                                                 <configuration>
73                                                         <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
74                                                         <resources>
75                                                                 <resource>
76                                                                         <directory>src/main/docker</directory>
77                                                                         <includes>
78                                                                                 <include>Dockerfile</include>
79                                                                         </includes>
80                                                                         <filtering>true</filtering>
81                                                                 </resource>
82                                                         </resources>
83                                                 </configuration>
84                                         </execution>
85                                 </executions>
86                         </plugin>
87
88                         <plugin>
89                                 <groupId>org.codehaus.mojo</groupId>
90                                 <artifactId>exec-maven-plugin</artifactId>
91                                 <version>1.5.0</version>
92                                 <executions>
93                                         <execution>
94                                                 <id>Make-stage-dir</id>
95                                                 <phase>generate-sources</phase>
96                                                 <goals>
97                                                         <goal>exec</goal>
98                                                 </goals>
99                                                 <configuration>
100                                                         <executable>/bin/mkdir</executable>
101                                                         <arguments>
102                                                         <argument>-p</argument>
103                                                         <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
104                                                         </arguments>
105                                                 </configuration>
106                                         </execution>
107                                         <execution>
108                                                 <id>Unzip dgbuilder</id>
109                                                 <phase>generate-sources</phase>
110                                                 <goals>
111                                                         <goal>exec</goal>
112                                                 </goals>
113                                                 <configuration>
114                                                         <executable>/usr/bin/unzip</executable>
115                                                         <arguments>
116                                                         <argument>-d</argument>
117                                                         <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
118                                                         <argument>../dgbuilder/target/*.zip</argument>
119                                                         </arguments>
120                                                 </configuration>
121                                         </execution>
122                                         <execution>
123                                                 <id>Copy dgbuilder</id>
124                                                 <phase>generate-sources</phase>
125                                                 <goals>
126                                                         <goal>exec</goal>
127                                                 </goals>
128                                                 <configuration>
129                                                         <executable>/bin/cp</executable>
130                                                         <arguments>
131                                                                 <argument>-r</argument>
132                                                                 <argument>../dgbuilder</argument>
133                                                                 <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
134                                                         </arguments>
135                                                 </configuration>
136                                         </execution>
137
138                                         <execution>
139                                                 <id>dgbuilder createReleaseDir</id>
140                                                 <phase>generate-sources</phase>
141                                                 <goals>
142                                                         <goal>exec</goal>
143                                                 </goals>
144                                                 <configuration>
145                                                         <executable>/bin/bash</executable>
146                                                         <arguments>
147                                                                 <argument>${basedir}/target/docker-stage/opt/onap/ccsdk/dgbuilder/createReleaseDir.sh</argument>
148                                                                 <argument>1702</argument>
149                                                                 <argument>dguser</argument>
150                                                                 <argument>change_email_id@dgbuilder.com</argument>
151                                                         </arguments>
152                                                 </configuration>
153                                         </execution>
154
155                                         <execution>
156                                                 <id>change shell permissions</id>
157                                                 <phase>process-sources</phase>
158                                                 <goals>
159                                                         <goal>exec</goal>
160                                                 </goals>
161                                                 <configuration>
162                                                         <executable>/usr/bin/find</executable>
163                                                         <arguments>
164                                                                 <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
165                                                                 <argument>-name</argument>
166                                                                 <argument>*.sh</argument>
167                                                                 <argument>-exec</argument>
168                                                                 <argument>chmod</argument>
169                                                                 <argument>+x</argument>
170                                                                 <argument>{}</argument>
171                                                                 <argument>;</argument>
172                                                         </arguments>
173                                                 </configuration>
174                                         </execution>
175                                 </executions>
176                         </plugin>
177                 </plugins>
178     </build>
179
180         <profiles>
181         <profile>
182             <id>docker</id>
183             <build>
184                 <plugins>
185                         <plugin>
186                                 <groupId>io.fabric8</groupId>
187                                 <artifactId>docker-maven-plugin</artifactId>
188                                 <version>0.16.5</version>
189                                 <inherited>false</inherited>
190                                 <configuration>
191
192                                         <images>
193                                                 <image>
194                                                         <name>${image.name}</name>
195                                                         <build>
196                                                                 <cleanup>try</cleanup>
197                                                                 <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
198                                                                 <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
199                                                                 <tags>
200                                                                         <tag>${project.version}</tag>
201                                                                         <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
202                                                                         <tag>${project.docker.latesttag.version}</tag>
203                                                                 </tags>
204                                                         </build>
205                                                 </image>
206                                         </images>
207                                 </configuration>
208                                 <executions>
209                                         <execution>
210                                                 <id>generate-images</id>
211                                                 <phase>package</phase>
212                                                 <goals>
213                                                         <goal>build</goal>
214                                                 </goals>
215                                         </execution>
216
217                                         <execution>
218                                                 <id>push-images</id>
219                                                 <phase>deploy</phase>
220                                                 <goals>
221                                                         <goal>build</goal>
222                                                         <goal>push</goal>
223                                                 </goals>
224                                         </execution>
225                                 </executions>
226                         </plugin>
227                 </plugins>
228         </build>
229         </profile>
230     </profiles>
231 </project>