Verify that docker manifest images exist in nexus3

Add enforcement check to ensure that all docker images
specified in the manifest can actually be found on nexus3.

Change-Id: I49ebc60a50cbb9f36f6e06d2d69c39cfeeacfcde
Issue-ID: INT-488
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
diff --git a/version-manifest/pom.xml b/version-manifest/pom.xml
index b2102d5..22634cb 100644
--- a/version-manifest/pom.xml
+++ b/version-manifest/pom.xml
@@ -121,6 +121,19 @@
               </arguments>
             </configuration>
           </execution>
+          <execution>
+            <id>check-docker-images-exist</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <arguments>
+                <argument>${project.basedir}/src/main/scripts/check-docker-manifest.sh</argument>
+                <argument>${project.basedir}/src/main/resources/docker-manifest.csv</argument>
+              </arguments>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
     </plugins>
diff --git a/version-manifest/src/main/resources/docker-manifest.csv b/version-manifest/src/main/resources/docker-manifest.csv
index f61ae80..c4d5b60 100644
--- a/version-manifest/src/main/resources/docker-manifest.csv
+++ b/version-manifest/src/main/resources/docker-manifest.csv
@@ -1,5 +1,6 @@
 image,tag
-onap/aaf,2.1.0-SNAPSHOT
+onap/aaf/aaf_service,2.1.0-SNAPSHOT
+onap/aaf/sms,latest
 onap/aai-resources,1.2-STAGING-latest
 onap/aai-traversal,1.2-STAGING-latest
 onap/aai/esr-gui,1.1.0-SNAPSHOT
@@ -13,7 +14,7 @@
 onap/cli,2.0-STAGING-latest
 onap/data-router,1.2-STAGING-latest
 onap/dmaap/buscontroller,latest
-onap/dmaap/dmaap-mr,1.0.1
+onap/dmaap/dmaap-mr,1.1.4
 onap/externalapi/nbi,latest
 onap/holmes/engine-management,latest
 onap/holmes/rule-management,latest
@@ -21,15 +22,16 @@
 onap/modeling/javatoscachecker,latest
 onap/msb/msb_apigateway,1.1.0-STAGING-latest
 onap/msb/msb_discovery,1.1.0-STAGING-latest
-onap/multicloud/framework,1.1.0-SNAPSHOT
+onap/multicloud/framework,1.1.2-STAGING
 onap/multicloud/openstack-newton,1.1.2-SNAPSHOT
 onap/multicloud/openstack-ocata,1.1.2-SNAPSHOT
 onap/multicloud/openstack-windriver,1.1.2-SNAPSHOT
-onap/multicloud/vio,1.1.0-SNAPSHOT
+onap/multicloud/vio,1.1.2-STAGING
 onap/multicloud/vio-vesagent,1.0.0
-onap/music,latest
-onap/oof,latest
-onap/oom/kube2msb,1.0.0
+onap/music/music,latest
+onap/oom/kube2msb,v1.0.0
+onap/optf-has,latest
+onap/optf-osdf,latest
 onap/org.onap.dcaegen2.collectors.snmptrap,latest
 onap/org.onap.dcaegen2.collectors.ves.vescollector,latest
 onap/org.onap.dcaegen2.deployments.bootstrap,1.1.2
@@ -45,8 +47,8 @@
 onap/org.onap.dcaegen2.platform.servicechange-handler,latest
 onap/org.onap.dcaegen2.services.heartbeat,latest
 onap/org.onap.dcaegen2.services.prh.prh-app-server,latest
-onap/policy-drools,v1.2.0
-onap/policy-pe,v1.2.0
+onap/policy-drools,1.2.0
+onap/policy-pe,1.2.0
 onap/portal-app,2.1-STAGING-latest
 onap/portal-db,2.1-STAGING-latest
 onap/portal-wms,2.1-STAGING-latest
@@ -84,6 +86,6 @@
 onap/vfc/ztevmanagerdriver,1.0.3-STAGING-latest
 onap/vfc/ztevnfmdriver,1.1.0-STAGING-latest
 onap/vid,1.2.1
-onap/vnfsdk/refrepo,1.0.0
-onap/vnfsdk/refrepo-postgres,1.0.0
+onap/vnfsdk/refrepo,1.1-STAGING-latest
+onap/vnfsdk/refrepo/postgres,latest
 openecomp/mso,1.2.1
diff --git a/version-manifest/src/main/scripts/check-docker-manifest.sh b/version-manifest/src/main/scripts/check-docker-manifest.sh
new file mode 100755
index 0000000..9064c83
--- /dev/null
+++ b/version-manifest/src/main/scripts/check-docker-manifest.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ -z "$WORKSPACE" ]; then
+    export WORKSPACE=`git rev-parse --show-toplevel`
+fi
+
+NEXUS_PREFIX="https://nexus3.onap.org/repository/docker.public/v2"
+
+err=0
+for line in $(tail -n +2 $1); do
+    image=$(echo $line | cut -d , -f 1)
+    tag=$(echo $line | cut -d , -f 2)
+    tags=$(curl -s $NEXUS_PREFIX/$image/tags/list | jq -r '.tags[]')
+    echo "$tags" | grep -q "^$tag\$"
+    if [ $? -ne 0 ]; then
+        echo "[ERROR] $image:$tag not found"
+        echo "$tags" | sed 's/^/  /'
+        (( err++ ))
+    fi
+done
+exit $err
diff --git a/version-manifest/src/main/scripts/check-sorted.sh b/version-manifest/src/main/scripts/check-sorted.sh
index d926409..fa120f3 100755
--- a/version-manifest/src/main/scripts/check-sorted.sh
+++ b/version-manifest/src/main/scripts/check-sorted.sh
@@ -3,7 +3,7 @@
 retval=$?
 if [ $retval -ne 0 ]; then
     echo
-    echo "ERROR: $1 is not properly sorted.  Please sort it with the following commands:"
+    echo "[ERROR] $1 is not properly sorted.  Please sort it with the following commands:"
     echo
     echo "  LC_ALL=C sort < $1 > $1.tmp"
     echo "  mv $1.tmp $1"