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