Skip to content

Commit

Permalink
Attempt to delete better
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Feb 7, 2019
1 parent 935ecd7 commit 8d2f332
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions entry
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ fi
helm repo update


JQ_CMD='"\(.Releases[0].AppVersion) \(.Releases[0].Status)"'
JQ_CMD='"\(.Releases[0].AppVersion),\(.Releases[0].Status)"'
LINE="$(helm ls --all "^$NAME\$" --output json | jq -r "$JQ_CMD")"
INSTALLED_VERSION=$(echo $LINE | awk '{print $1}')
STATUS=$(echo $LINE | awk '{print $2}')
INSTALLED_VERSION=$(echo $LINE | cut -f1 -d,)
STATUS=$(echo $LINE | cut -f2 -d,)

if [ -e /config/values.yaml ]; then
VALUES="--values /config/values.yaml"
Expand All @@ -24,11 +24,12 @@ if [ "$1" = "delete" ]; then
if [ -z "$INSTALLED_VERSION" ]; then
exit
fi
helm delete $NAME || true
helm "$@"
exit
fi

if [ -z "$INSTALLED_VERSION" ]; then
if [ -z "$INSTALLED_VERSION" ] && [ -z "$STATUS" ]; then
helm "$@" $VALUES
exit
fi
Expand Down

0 comments on commit 8d2f332

Please sign in to comment.