Skip to content

Commit 8d2f332

Browse files
Attempt to delete better
1 parent 935ecd7 commit 8d2f332

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

entry

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ fi
1111
helm repo update
1212

1313

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

1919
if [ -e /config/values.yaml ]; then
2020
VALUES="--values /config/values.yaml"
@@ -24,11 +24,12 @@ if [ "$1" = "delete" ]; then
2424
if [ -z "$INSTALLED_VERSION" ]; then
2525
exit
2626
fi
27+
helm delete $NAME || true
2728
helm "$@"
2829
exit
2930
fi
3031

31-
if [ -z "$INSTALLED_VERSION" ]; then
32+
if [ -z "$INSTALLED_VERSION" ] && [ -z "$STATUS" ]; then
3233
helm "$@" $VALUES
3334
exit
3435
fi

0 commit comments

Comments
 (0)