Move buildhelper to docker profile
[aai/gizmo.git] / pom.xml
diff --git a/pom.xml b/pom.xml
index 698de2c..9db6177 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -53,6 +53,8 @@ limitations under the License.
         <aai.docker.namespace>onap</aai.docker.namespace>
         <aai.base.image>alpine</aai.base.image>
         <aai.base.image.version>1.6.0</aai.base.image.version>
+        <!-- This will be used for the docker images as the default format of maven build has issues -->
+        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
     </properties>
 
     <dependencyManagement>
@@ -383,7 +385,7 @@ limitations under the License.
                         <version>1.0</version>
                         <executions>
                             <execution>
-                                <phase>prepare-package</phase>
+                                <phase>validate</phase>
                                 <goals>
                                     <goal>execute</goal>
                                 </goals>
@@ -399,6 +401,16 @@ limitations under the License.
                                         }
                                         log.info 'Base image flavour: ' + project.properties['aai.base.image']
                                         log.info 'Base image version: ' + project.properties['aai.base.image.version']
+
+                                        def versionArray;
+                                        if (project.properties['aai.base.image.version'] != null) {
+                                            versionArray = project.properties['aai.base.image.version'].split('\\.');
+                                        }
+    
+                                        project.properties["project.major.version"] = versionArray[0];
+                                        project.properties["project.minor.version"] = versionArray[1];
+                                        project.properties['project.docker.latesttag.version'] = versionArray[0] + '.' + versionArray[1] + '-STAGING-latest';
+                                        println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
                                     </source>
                                 </configuration>
                             </execution>
@@ -419,6 +431,8 @@ limitations under the License.
                                         <filter>@</filter>
                                         <tags>
                                             <tag>latest</tag>
+                                            <tag>${project.docker.latesttag.version}</tag>
+                                            <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-${maven.build.timestamp}</tag>
                                         </tags>
                                         <cleanup>try</cleanup>
                                         <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
@@ -463,7 +477,20 @@ limitations under the License.
                             </execution>
                         </executions>
                     </plugin>
-                </plugins>
+                    <plugin>
+                      <groupId>org.codehaus.mojo</groupId>
+                      <artifactId>build-helper-maven-plugin</artifactId>
+                      <version>3.0.0</version>
+                      <executions>
+                        <execution>
+                          <id>parse-version</id>
+                          <goals>
+                            <goal>parse-version</goal>
+                          </goals>
+                        </execution>
+                      </executions>
+                    </plugin>
+                  </plugins>
             </build>
         </profile>
     </profiles>
@@ -637,19 +664,7 @@ limitations under the License.
                     </execution>
                 </executions>
             </plugin>
-        <plugin>
-             <groupId>org.codehaus.mojo</groupId>
-             <artifactId>build-helper-maven-plugin</artifactId>
-              <version>3.0.0</version>
-              <executions>
-               <execution>
-                 <id>parse-version</id>
-                 <goals>
-                   <goal>parse-version</goal>
-                 </goals>
-               </execution>
-              </executions>
-           </plugin>
+
        </plugins>
     </build>