5d9d5d726f98fe7f302a6512996cab6e63995d27
[ccsdk/distribution.git] / 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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
4    <parent>
5         <groupId>org.onap.ccsdk.parent</groupId>
6         <artifactId>odlparent-lite</artifactId>
7         <version>1.2.1-SNAPSHOT</version>
8     </parent>
9
10     <modelVersion>4.0.0</modelVersion>
11     <packaging>pom</packaging>
12     <groupId>org.onap.ccsdk.distribution</groupId>
13     <artifactId>ansible-server</artifactId>
14     <version>0.4.1-SNAPSHOT</version>
15
16     <name>ccsdk :: distribution :: ${project.artifactId}</name>
17     <description>Creates ansible-server Docker container</description>
18
19     <properties>
20         <image.name>onap/ccsdk-ansible-server-image</image.name>
21         <ccsdk.project.version>${project.version}</ccsdk.project.version>
22               <ccsdk.distribution.version>${project.version}</ccsdk.distribution.version>
23         <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
24         <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
25         <docker.verbose>true</docker.verbose>
26     </properties>
27
28
29     <build>
30         <plugins>
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:' + project.properties['project.docker.latesttag.version'];
56                             </source>
57                         </configuration>
58                     </execution>
59                 </executions>
60             </plugin>
61
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</directory>
77                                     <includes>
78                                         <include>**/*</include>
79                                     </includes>
80                                     <filtering>false</filtering>
81                                 </resource>
82                             </resources>
83                         </configuration>
84                     </execution>
85                 </executions>
86             </plugin>
87
88             <plugin>
89                 <artifactId>exec-maven-plugin</artifactId>
90                 <groupId>org.codehaus.mojo</groupId>
91                 <version>1.5.0</version>
92                 <executions>
93                     <execution>
94                         <id>change python permissions</id>
95                         <phase>process-sources</phase>
96                         <goals>
97                             <goal>exec</goal>
98                         </goals>
99                         <configuration>
100                             <executable>/usr/bin/find</executable>
101                             <arguments>
102                                 <argument>${basedir}/target/docker-stage/ansible-server</argument>
103                                 <argument>-name</argument>
104                                 <argument>*.py</argument>
105                                 <argument>-exec</argument>
106                                 <argument>chmod</argument>
107                                 <argument>+x</argument>
108                                 <argument>{}</argument>
109                                 <argument>;</argument>
110                             </arguments>
111                         </configuration>
112                     </execution>
113                 </executions>
114             </plugin>
115         </plugins>
116     </build>
117
118     <profiles>
119         <profile>
120             <id>docker</id>
121             <build>
122                 <plugins>
123                     <plugin>
124                         <groupId>io.fabric8</groupId>
125                         <artifactId>docker-maven-plugin</artifactId>
126                         <version>0.16.5</version>
127                         <inherited>false</inherited>
128                         <configuration>
129                             <images>
130                                 <image>
131                                     <name>${image.name}</name>
132                                     <build>
133                                         <cleanup>try</cleanup>
134                                         <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
135                                         <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
136                                         <tags>
137                                             <tag>${project.version}</tag>
138                                             <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
139                                             <tag>${project.docker.latesttag.version}</tag>
140                                         </tags>
141                                     </build>
142                                 </image>
143                             </images>
144                         </configuration>
145                         <executions>
146                             <execution>
147                                 <id>generate-images</id>
148                                 <phase>package</phase>
149                                 <goals>
150                                     <goal>build</goal>
151                                 </goals>
152                             </execution>
153
154                             <execution>
155                                 <id>push-images</id>
156                                 <phase>deploy</phase>
157                                 <goals>
158                                     <goal>build</goal>
159                                     <goal>push</goal>
160                                 </goals>
161                             </execution>
162                         </executions>
163                     </plugin>
164                 </plugins>
165             </build>
166         </profile>
167     </profiles>
168     <organization>
169         <name>ONAP</name>
170     </organization>
171 </project>