From 42d4dc259803ecb80928aa12d736b23f1a81021a Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Fri, 3 Sep 2021 10:27:51 +0900 Subject: [PATCH] Do not update the chart version if there was an error bumping it --- hooks/filter-flow-release-start-version | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hooks/filter-flow-release-start-version b/hooks/filter-flow-release-start-version index 1cf453d..4b3a1d0 100755 --- a/hooks/filter-flow-release-start-version +++ b/hooks/filter-flow-release-start-version @@ -43,7 +43,12 @@ fi if [[ -f $ROOT_DIR/chart/Chart.yaml ]]; then CHART_VERSION=$(grep "^version:" $ROOT_DIR/chart/Chart.yaml | sed -E "s/^version:\s+([0-9]+\.[0-9]+\.[0-9]+)/\1/") CHART_VERSION=$(bump_version $CHART_VERSION $LEVEL) - sed -Ei "/^version:/s/[0-9]+\.[0-9]+\.[0-9]/${CHART_VERSION}/" "$ROOT_DIR/chart/Chart.yaml" + status=$? + if (( ! status )); then + sed -Ei "/^version:/s/[0-9]+\.[0-9]+\.[0-9]/${CHART_VERSION}/" "$ROOT_DIR/chart/Chart.yaml" + else + warn "Helm Chart Version was not modified" + fi sed -Ei "/^appVersion:/s/[0-9]+\.[0-9]+\.[0-9]/${VERSION}/" "$ROOT_DIR/chart/Chart.yaml" git stash push --quiet fi