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