updated container labels for consistency

Change-Id: I017c9dec901bab213cf3926bd85bed3aa33350d5
diff --git a/build.gradle b/build.gradle
index aa869e5..08f50ca 100644
--- a/build.gradle
+++ b/build.gradle
@@ -83,14 +83,23 @@
 def getBuildTimestamp() {
     def cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"))
     def date = cal.getTime()
-    def formattedDate = date.format("yyyy-MM-dd'T'HH:mm:ss.ss'Z'")
+    def formattedDate = date.format("yyyy-MM-dd'T'HH:mm:ssZ")
     return formattedDate
 }
 
+def getCommitDate = { ->
+    def stdOut = new ByteArrayOutputStream()
+    exec {
+        commandLine "git", "log", "--pretty=format:%cd", "--date=format:%FT%T%z", "-n", "1"
+        standardOutput = stdOut
+    }
+    return stdOut.toString().trim()
+}
+
 def getCommitHash = { ->
     def hashStdOut = new ByteArrayOutputStream()
     exec {
-        commandLine "git", "rev-parse", "HEAD"
+        commandLine "git", "log", "--pretty=format:%H", "-n", "1"
         standardOutput = hashStdOut
     }
     return hashStdOut.toString().trim()
@@ -106,7 +115,7 @@
 }
  
 task buildSwitchqImage(type: Exec) {
-    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-maas-switchq', './switchq'
+    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.vcs-ref-date=' + getCommitDate(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-maas-switchq', './switchq'
 }
 
 task tagSwitchqImage(type: Exec) {
@@ -122,7 +131,7 @@
 // Bootstrap Image
 
 task buildBootstrapImage(type: Exec) {
-    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-maas-bootstrap', './bootstrap'
+    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.vcs-ref-date=' + getCommitDate(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-maas-bootstrap', './bootstrap'
 }
 
 task tagBootstrapImage(type: Exec) {
@@ -138,7 +147,7 @@
 // IP Allocator Image
 
 task buildAllocationImage(type: Exec) {
-    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-ip-allocator', './ip-allocator'
+    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.vcs-ref-date=' + getCommitDate(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-ip-allocator', './ip-allocator'
 }
 
 task tagAllocationImage(type: Exec) {
@@ -154,7 +163,7 @@
 // Provisioner Image
 
 task buildProvisionerImage(type: Exec) {
-    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-provisioner', './provisioner'
+    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.vcs-ref-date=' + getCommitDate(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'cord-provisioner', './provisioner'
 }
 
 task tagProvisionerImage(type: Exec) {
@@ -170,7 +179,7 @@
 // Config Generator Image
 
 task buildConfigGeneratorImage(type: Exec) {
-    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'config-generator', './config-generator'
+    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.vcs-ref-date=' + getCommitDate(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', 'config-generator', './config-generator'
 }
 
 task tagConfigGeneratorImage(type: Exec) {
@@ -186,7 +195,7 @@
 // Automation Image
 
 task buildAutomationImage(type: Exec) {
-    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', "cord-maas-automation", "-f", "./automation/Dockerfile", "./automation"
+    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.vcs-ref-date=' + getCommitDate(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', "cord-maas-automation", "-f", "./automation/Dockerfile", "./automation"
 }
 
 task tagAutomationImage(type: Exec) {
@@ -202,7 +211,7 @@
 // DHCP Harvester Images
 
 task buildHarvesterImage(type: Exec) {
-    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', "cord-dhcp-harvester", "./harvester"
+    commandLine "docker", 'build', '--label', 'org.label-schema.build-date=' + getBuildTimestamp(), '--label', 'org.label-schema.vcs-ref=' + getCommitHash(), '--label', 'org.label-schema.vcs-ref-date=' + getCommitDate(), '--label', 'org.label-schema.version=' + getBranchName(), '-t', "cord-dhcp-harvester", "./harvester"
 }
 
 task tagHarvesterImage(type: Exec) {