aboutsummaryrefslogtreecommitdiffstats
path: root/version-manifest/src/main/scripts/generate-docker-manifest.sh
blob: 18a0dbb09e87f1b5d607c822fe4107d45778dbbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

realpath() {
  OURPWD="$PWD"
  cd "$(dirname "$1")"
  LINK=$(readlink "$(basename "$1")")
  while [ "$LINK" ]; do
    cd "$(dirname "$LINK")"
    LINK=$(readlink "$(basename "$1")")
  done
  REALPATH="$PWD/$(basename "$1")"
  cd "$OURPWD"
  echo "$REALPATH"
}

if [ "$#" -ne 2 ]; then
    echo This script creates a docker manifest using OOM helm charts as source
    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

cd $OOM_DIR/kubernetes

echo "image,tag" > $MANIFEST.tmp
rgrep -h -E ': onap/.*:.*' | awk '{$1=$1};1' | cut -d' ' -f2 | tr ':' ',' >> $MANIFEST.tmp
LC_ALL=C sort -u < $MANIFEST.tmp > $MANIFEST
rm $MANIFEST.tmp