Gary Wu | 4885ce6 | 2018-05-07 12:27:37 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Alexis de Talhouƫt | 98814dc | 2018-09-19 11:49:04 -0400 | [diff] [blame] | 3 | realpath() { |
| 4 | OURPWD="$PWD" |
| 5 | cd "$(dirname "$1")" |
| 6 | LINK=$(readlink "$(basename "$1")") |
| 7 | while [ "$LINK" ]; do |
| 8 | cd "$(dirname "$LINK")" |
| 9 | LINK=$(readlink "$(basename "$1")") |
| 10 | done |
| 11 | REALPATH="$PWD/$(basename "$1")" |
| 12 | cd "$OURPWD" |
| 13 | echo "$REALPATH" |
| 14 | } |
| 15 | |
Gary Wu | 4885ce6 | 2018-05-07 12:27:37 -0700 | [diff] [blame] | 16 | if [ "$#" -ne 2 ]; then |
| 17 | echo This script updates OOM helm charts to use versions in docker-manifest.csv |
Gary Wu | 64c540b | 2018-05-09 15:04:32 -0700 | [diff] [blame] | 18 | echo "$0 <docker-manifest.csv> <oom repo directory>" |
Gary Wu | 4885ce6 | 2018-05-07 12:27:37 -0700 | [diff] [blame] | 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | # expected parameters |
| 23 | MANIFEST=$(realpath $1) |
| 24 | OOM_DIR=$(realpath $2) |
| 25 | |
| 26 | if [ -z "$WORKSPACE" ]; then |
| 27 | export WORKSPACE=`git rev-parse --show-toplevel` |
| 28 | fi |
| 29 | |
Gary Wu | 4885ce6 | 2018-05-07 12:27:37 -0700 | [diff] [blame] | 30 | cd $OOM_DIR/kubernetes |
| 31 | |
| 32 | for line in $(tail -n +2 $MANIFEST); do |
| 33 | image=$(echo $line | cut -d , -f 1) |
| 34 | tag=$(echo $line | cut -s -d , -f 2) |
Gary Wu | 44f836b | 2018-05-10 23:54:22 -0700 | [diff] [blame] | 35 | perl -p -i -e "s|$image(:.*$\|$)|$image:$tag|g" $(find ./ -name values.yaml) |
Gary Wu | 4885ce6 | 2018-05-07 12:27:37 -0700 | [diff] [blame] | 36 | done |
| 37 | |