Script to sync OOM helm charts with manifest 45/46445/2
authorGary Wu <gary.i.wu@huawei.com>
Mon, 7 May 2018 19:27:37 +0000 (12:27 -0700)
committerGary Wu <gary.i.wu@huawei.com>
Mon, 7 May 2018 19:45:40 +0000 (12:45 -0700)
Change-Id: Idb40b4fc8d02b82ba43f9dc4c53f485ba9939091
Issue-ID: INT-492
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
version-manifest/src/main/resources/docker-manifest.csv
version-manifest/src/main/scripts/merge-oom-images.sh
version-manifest/src/main/scripts/update-oom-image-versions.sh [new file with mode: 0755]

index 87f6fd6..0d604eb 100644 (file)
@@ -1,4 +1,10 @@
 image,tag
+onap/aaf/aaf_cm,2.1.0-SNAPSHOT
+onap/aaf/aaf_fs,2.1.0-SNAPSHOT
+onap/aaf/aaf_gui,2.1.0-SNAPSHOT
+onap/aaf/aaf_hello,2.1.0-SNAPSHOT
+onap/aaf/aaf_locate,2.1.0-SNAPSHOT
+onap/aaf/aaf_oauth,2.1.0-SNAPSHOT
 onap/aaf/aaf_service,2.1.0-SNAPSHOT
 onap/aaf/authz-service,latest
 onap/aaf/sms,latest
index 09bc12f..248bc33 100755 (executable)
@@ -1,13 +1,14 @@
 #!/bin/bash
 
 if [ "$#" -ne 2 ]; then
+    echo This script adds docker images that exist in OOM helm charts into docker-manifest.csv
     echo "$0 <docker-manifest.csv> <oom directory>"
     exit 1
 fi
 
 # expected parameters
-MANIFEST=$1
-OOM_DIR=$2
+MANIFEST=$(realpath $1)
+OOM_DIR=$(realpath $2)
 
 if [ -z "$WORKSPACE" ]; then
     export WORKSPACE=`git rev-parse --show-toplevel`
@@ -20,7 +21,7 @@ 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 > $TARGET_DIR/oom-manifest.txt
+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
@@ -34,5 +35,5 @@ for line in $(cat $TARGET_DIR/oom-manifest.txt); do
     fi
 done
 
-cat $MANIFEST $TARGET_DIR/docker-manifest-new-entries.txt | LC_ALL=C sort > $MANIFEST.tmp
-cp $MANIFEST.tmp $MANIFEST
+cat $MANIFEST $TARGET_DIR/docker-manifest-new-entries.txt | LC_ALL=C sort -u > $MANIFEST.tmp
+mv $MANIFEST.tmp $MANIFEST
diff --git a/version-manifest/src/main/scripts/update-oom-image-versions.sh b/version-manifest/src/main/scripts/update-oom-image-versions.sh
new file mode 100755 (executable)
index 0000000..eba8478
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+if [ "$#" -ne 2 ]; then
+    echo This script updates OOM helm charts to use versions in docker-manifest.csv
+    echo "$0 <docker-manifest.csv> <oom 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/kubernetes
+
+for line in $(tail -n +2 $MANIFEST); do
+    image=$(echo $line | cut -d , -f 1)
+    tag=$(echo $line | cut -s -d , -f 2)
+    perl -p -i -e "s|image: $image(:.*$\|$)|image: $image:$tag|g" $(find ./ -name values.yaml)
+done
+