Check that java artifacts in manifest are released 86/70386/1
authorGary Wu <gary.i.wu@huawei.com>
Fri, 12 Oct 2018 20:13:13 +0000 (13:13 -0700)
committerGary Wu <gary.i.wu@huawei.com>
Fri, 12 Oct 2018 20:13:13 +0000 (13:13 -0700)
Change-Id: If9be2267c9b9fd7255bc1f809513c1c5b7092fba
Issue-ID: INT-586
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
version-manifest/pom.xml
version-manifest/src/main/scripts/check-java-manifest.sh [new file with mode: 0755]

index 4202b26..27fb4f4 100644 (file)
               </arguments>
             </configuration>
           </execution>
+          <execution>
+            <id>check-java-artifacts-released</id>
+            <phase>verify</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <arguments>
+                <argument>${project.basedir}/src/main/scripts/check-java-manifest.sh</argument>
+                <argument>${project.basedir}/src/main/resources/java-manifest.csv</argument>
+              </arguments>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
     </plugins>
diff --git a/version-manifest/src/main/scripts/check-java-manifest.sh b/version-manifest/src/main/scripts/check-java-manifest.sh
new file mode 100755 (executable)
index 0000000..3c6db49
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+if [ "$#" -ne 1 ]; then
+    echo This script checks java-manifest.csv to verify that the specified versions have been released in nexus
+    echo "$0 <java-manifest.csv>"
+    exit 1
+fi
+
+if [ -z "$WORKSPACE" ]; then
+    export WORKSPACE=`git rev-parse --show-toplevel`
+fi
+
+NEXUS_RELEASE_PREFIX="https://nexus.onap.org/content/repositories/releases"
+
+err=0
+for line in $(tail -n +2 $1); do
+    group=$(echo $line | cut -d , -f 1)
+    artifact=$(echo $line | cut -d , -f 2)
+    version=$(echo $line | cut -d , -f 3)
+    path=$(echo $group/$artifact | tr '.' '/')
+
+    url="$NEXUS_RELEASE_PREFIX/$path/$version/"
+    http_code=$(curl -s -o /dev/null -I -w "%{http_code}" $url)
+    if [ $http_code -ne 200 ]; then
+        echo "[WARNING] $group:$artifact:$version not released"
+        (( err++ ))
+    else
+        echo "[INFO] $group:$artifact:$version OK"
+    fi
+done
+#exit $err
+exit 0