Script to get docker timestamps from ONAP instance 96/87796/1
authorGary Wu <gary.i.wu@huawei.com>
Wed, 15 May 2019 17:59:08 +0000 (10:59 -0700)
committerGary Wu <gary.i.wu@huawei.com>
Wed, 15 May 2019 17:59:08 +0000 (10:59 -0700)
Change-Id: I8270244ab16280517a22df3898990be547dbc49b
Issue-ID: INT-1055
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
deployment/heat/onap-rke/scripts/get-image-tags.sh [new file with mode: 0755]

diff --git a/deployment/heat/onap-rke/scripts/get-image-tags.sh b/deployment/heat/onap-rke/scripts/get-image-tags.sh
new file mode 100755 (executable)
index 0000000..7c75084
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+CHECKSUMS=$(kubectl get pods -o jsonpath="{..imageID}" |tr -s '[[:space:]]' '\n' | grep '/onap' | sed 's|.*/onap|onap|' | sort -u)
+
+for checksum in $CHECKSUMS; do
+    sha256=$(echo $checksum | sed 's/.*@sha256://g')
+    tag=$(curl -s https://nexus3.onap.org/service/rest/v1/search?assets.attributes.checksum.sha256=$sha256 | jq -r '.items[] | (.name + ":" + .version + "_")' | grep -v latest | sort -V | tail -1 | sed 's/_$//')
+    echo ${tag:-${checksum}}
+done