update docker image tags

Issue-ID: DMAAP-1042
Change-Id: Ia2fa750cb7507e6615a61ed3d7fe872709140939
Signed-off-by: sunil unnava <sunil.unnava@att.com>
diff --git a/pom.xml b/pom.xml
index 14d8064..582dd27 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
 
 	<groupId>org.onap.dmaap.zookeeper</groupId>
 	<artifactId>zookeepr</artifactId>
-	<version>2.0.0-SNAPSHOT</version>
+	<version>3.0.0-SNAPSHOT</version>
 	<name>zookeeper</name>
 	<licenses>
 		<license>
@@ -123,8 +123,8 @@
 					<dockerDirectory>src/main/docker</dockerDirectory>
 					<serverId>docker-hub</serverId>
 					<imageTags>
-						<imageTag>${zookeeperImg}</imageTag>
-						<imageTag>latest</imageTag>
+						<imageTag>${dockertag1}</imageTag>
+						<imageTag>${dockertag2}</imageTag>
 					</imageTags>
 					<forceTags>true</forceTags>
 					<resources>
@@ -157,7 +157,7 @@
 						</goals>
 						<configuration>
 							<image>onap/dmaap/zookeeper</image>
-							<newName>${docker.push.registry}/onap/dmaap/zookeeper:${zookeeperImg}</newName>
+							<newName>${docker.push.registry}/onap/dmaap/zookeeper:${dockertag2}}</newName>
 							<skipDockerTag>${skip.docker.push}</skipDockerTag>
 						</configuration>
 					</execution>
@@ -170,7 +170,7 @@
 						</goals>
 						<configuration>
 							<image>onap/dmaap/zookeeper</image>
-							<newName>${docker.push.registry}/onap/dmaap/zookeeper:latest</newName>
+							<newName>${docker.push.registry}/onap/dmaap/zookeeper:${dockertag1}</newName>
 							<skipDockerTag>${skip.docker.push}</skipDockerTag>
 						</configuration>
 					</execution>
@@ -182,7 +182,7 @@
 							<goal>push</goal>
 						</goals>
 						<configuration>
-							<imageName>${docker.push.registry}/onap/dmaap/zookeeper:${zookeeperImg}</imageName>
+							<imageName>${docker.push.registry}/onap/dmaap/zookeeper:${dockertag2}</imageName>
 							<skipDockerPush>${skip.docker.push}</skipDockerPush>
 						</configuration>
 					</execution>
@@ -194,7 +194,7 @@
 							<goal>push</goal>
 						</goals>
 						<configuration>
-							<imageName>${docker.push.registry}/onap/dmaap/zookeeper:latest</imageName>
+							<imageName>${docker.push.registry}/onap/dmaap/zookeeper:${dockertag1}</imageName>
 							<skipDockerPush>${skip.docker.push}</skipDockerPush>
 						</configuration>
 					</execution>
@@ -206,7 +206,8 @@
 
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<zookeeperImg>2.0.0</zookeeperImg>
+		<timestamp>${maven.build.timestamp}</timestamp>
+        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
 		<sitePath>/content/sites/site/org/onap/dmaap/zookeeper/${project.artifactId}/${project.version}</sitePath>
 		<skip.docker.build>true</skip.docker.build>
 		<skip.docker.push>true</skip.docker.push>
@@ -234,6 +235,44 @@
 				<skip.docker.tag>false</skip.docker.tag>
 				<skip.docker.push>false</skip.docker.push>
 			</properties>
+		   <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.groovy.maven</groupId>
+                        <artifactId>gmaven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>validate</phase>
+                                <goals>
+                                    <goal>execute</goal>
+                                </goals>
+                                <configuration>
+                                    <properties>
+                                        <ver>${project.version}</ver>
+                                        <timestamp>${maven.build.timestamp}</timestamp>
+                                    </properties>
+                                    <source>
+                                        println project.properties['ver'];
+                                        def versionArray;
+                                        if ( project.properties['ver'] != null ) {
+                                        versionArray = project.properties['ver'].split('\\.');
+                                        }
+                                        if ( project.properties['ver'].endsWith("-SNAPSHOT") ) {
+                                        project.properties['dockertag1']=project.properties['ver'] + "-latest";
+                                        project.properties['dockertag2']=project.properties['ver'] + "-" + project.properties['timestamp'];
+                                        } else {
+                                        project.properties['dockertag1']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+                                        project.properties['dockertag2']=project.properties['ver'] + "-STAGING-" + project.properties['timestamp'];
+                                        }
+                                        println 'docker tag 1: ' + project.properties['dockertag1'];
+                                        println 'docker tag 2: ' + project.properties['dockertag2'];
+                                    </source>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    </plugins>
+                    </build>
 		</profile>
 
 	</profiles>