aboutsummaryrefslogtreecommitdiffstats
path: root/version-manifest/src/main/scripts/add-images-from-oom.sh
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-05-09 15:04:32 -0700
committerGary Wu <gary.i.wu@huawei.com>2018-05-09 15:04:32 -0700
commit64c540bd168c463f1bb1ba08b7c1a803eee24fcb (patch)
tree9fe2896b3a436965566eb5e6028484fd6d538380 /version-manifest/src/main/scripts/add-images-from-oom.sh
parentb8a8ccd85b022503db1aa0691ed1047269fb0757 (diff)
Add script to sync heat template from manifest
Also clean up other helper scripts Change-Id: Icae9cac8c6e9e3cef5e52e66bf79d6c30d23d235 Issue-ID: INT-495 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'version-manifest/src/main/scripts/add-images-from-oom.sh')
-rwxr-xr-xversion-manifest/src/main/scripts/add-images-from-oom.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/version-manifest/src/main/scripts/add-images-from-oom.sh b/version-manifest/src/main/scripts/add-images-from-oom.sh
new file mode 100755
index 000000000..f7207701f
--- /dev/null
+++ b/version-manifest/src/main/scripts/add-images-from-oom.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+if [ "$#" -ne 2 ]; then
+ echo This script adds new docker images from OOM helm charts into docker-manifest.csv
+ echo "$0 <docker-manifest.csv> <oom repo directory>"
+ exit 1
+fi
+
+# expected parameters
+MANIFEST=$(realpath $1)
+OOM_DIR=$(realpath $2)
+
+if [ -z "$WORKSPACE" ]; then
+ export WORKSPACE=`git rev-parse --show-toplevel`
+fi
+
+DIR=$(dirname $(readlink -f "$0"))
+TARGET_DIR=$DIR/target
+rm -rf $TARGET_DIR
+mkdir -p $TARGET_DIR
+cd $TARGET_DIR
+
+cd $OOM_DIR
+rgrep "image: .*" --include=values.yaml -h | cut -d ' ' -f 2 | tr -d '"'| grep -v '<' | grep -e "^onap" -e "^openecomp" | LC_ALL=C sort -u > $TARGET_DIR/oom-manifest.txt
+touch $TARGET_DIR/docker-manifest-new-entries.txt
+
+for line in $(cat $TARGET_DIR/oom-manifest.txt); do
+ image=$(echo $line | cut -d : -f 1)
+ tag=$(echo $line | cut -s -d : -f 2)
+ if [ -z "$tag" ]; then
+ tag="latest"
+ fi
+ if ! grep -q "$image" $MANIFEST; then
+ echo $image,$tag >> $TARGET_DIR/docker-manifest-new-entries.txt
+ fi
+done
+
+cat $MANIFEST $TARGET_DIR/docker-manifest-new-entries.txt | LC_ALL=C sort -u > $MANIFEST.tmp
+mv $MANIFEST.tmp $MANIFEST