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