summaryrefslogtreecommitdiffstats
path: root/version-manifest/src/main/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'version-manifest/src/main/scripts')
-rwxr-xr-xversion-manifest/src/main/scripts/check-docker-manifest.sh6
-rwxr-xr-xversion-manifest/src/main/scripts/merge-oom-images.sh39
-rwxr-xr-xversion-manifest/src/main/scripts/update-oom-image-versions.sh30
3 files changed, 75 insertions, 0 deletions
diff --git a/version-manifest/src/main/scripts/check-docker-manifest.sh b/version-manifest/src/main/scripts/check-docker-manifest.sh
index 9064c836d..61eb5a2a9 100755
--- a/version-manifest/src/main/scripts/check-docker-manifest.sh
+++ b/version-manifest/src/main/scripts/check-docker-manifest.sh
@@ -1,5 +1,11 @@
#!/bin/bash
+if [ "$#" -ne 1 ]; then
+ echo This script checks docker-manifest.csv to verify that the specified versions exist in nexus3
+ echo "$0 <docker-manifest.csv>"
+ exit 1
+fi
+
if [ -z "$WORKSPACE" ]; then
export WORKSPACE=`git rev-parse --show-toplevel`
fi
diff --git a/version-manifest/src/main/scripts/merge-oom-images.sh b/version-manifest/src/main/scripts/merge-oom-images.sh
new file mode 100755
index 000000000..248bc331c
--- /dev/null
+++ b/version-manifest/src/main/scripts/merge-oom-images.sh
@@ -0,0 +1,39 @@
+#!/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=$(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
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
index 000000000..eba847841
--- /dev/null
+++ b/version-manifest/src/main/scripts/update-oom-image-versions.sh
@@ -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
+