263938c3a5d59a9ea4fea96d65ea5954a194be39
[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.1.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.4.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-yml</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/ccsdk/Playbooks</outputDirectory>
92                             <resources>
93                                 <resource>
94                                     <directory>src/main/yml</directory>
95                                     <includes>
96                                         <include>*</include>
97                                     </includes>
98                                     <filtering>false</filtering>
99                                 </resource>
100                             </resources>
101                         </configuration>
102                     </execution>
103                 </executions>
104             </plugin>
105         </plugins>
106     </build>
107
108     <profiles>
109         <profile>
110             <id>docker</id>
111             <build>
112                 <plugins>
113                     <plugin>
114                         <groupId>io.fabric8</groupId>
115                         <artifactId>docker-maven-plugin</artifactId>
116                         <version>0.16.5</version>
117                         <inherited>false</inherited>
118                         <configuration>
119                             <images>
120                                 <image>
121                                     <name>${image.name}</name>
122                                     <build>
123                                         <cleanup>try</cleanup>
124                                         <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
125                                         <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile>
126                                         <tags>
127                                             <tag>${project.version}</tag>
128                                             <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
129                                             <tag>${project.docker.latesttag.version}</tag>
130                                         </tags>
131                                     </build>
132                                 </image>
133                             </images>
134                         </configuration>
135                         <executions>
136                             <execution>
137                                 <id>generate-images</id>
138                                 <phase>package</phase>
139                                 <goals>
140                                     <goal>build</goal>
141                                 </goals>
142                             </execution>
143
144                             <execution>
145                                 <id>push-images</id>
146                                 <phase>deploy</phase>
147                                 <goals>
148                                     <goal>build</goal>
149                                     <goal>push</goal>
150                                 </goals>
151                             </execution>
152                         </executions>
153                     </plugin>
154                 </plugins>
155             </build>
156         </profile>
157     </profiles>
158     <organization>
159         <name>ONAP</name>
160     </organization>
161 </project>