From 8cfce3a71ec24fd7debabe0ef3ff20d5dcf08423 Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Mon, 2 Aug 2021 20:58:17 +0900 Subject: [PATCH] Update Helm Charts if present --- hooks/filter-flow-hotfix-start-version | 10 ++++++++++ hooks/filter-flow-release-start-version | 8 ++++++++ hooks/post-flow-hotfix-start | 5 +++++ hooks/post-flow-release-start | 5 +++++ 4 files changed, 28 insertions(+) diff --git a/hooks/filter-flow-hotfix-start-version b/hooks/filter-flow-hotfix-start-version index 79402ab..66946be 100755 --- a/hooks/filter-flow-hotfix-start-version +++ b/hooks/filter-flow-hotfix-start-version @@ -40,6 +40,16 @@ if [[ ! $VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then VERSION=$(bump_version $VERSION $LEVEL) fi +echo "Checking for Chart" +if [[ -f $ROOT_DIR/chart/Chart.yaml ]]; then + echo "Found Chart" + CHART_VERSION=$(grep "^version:" $ROOT_DIR/chart/Chart.yaml | sed -E "s/^version:\s+([0-9]+\.[0-9]+\.[0-9]+)/\1/") + echo "Current Chart Version: $CHART_VERSION" + CHART_VERSION=$(bump_version $CHART_VERSION $LEVEL) + echo "New Chart Version: $CHART_VERSION" + sed -Ei "/^version:/s/[0-9]+\.[0-9]+\.[0-9]/${CHART_VERSION}/" "$ROOT_DIR/chart/Chart.yaml" +fi + # Return the VERSION echo "${VERSION}" exit 0 diff --git a/hooks/filter-flow-release-start-version b/hooks/filter-flow-release-start-version index b0ecab8..1cf453d 100755 --- a/hooks/filter-flow-release-start-version +++ b/hooks/filter-flow-release-start-version @@ -40,6 +40,14 @@ if [[ ! $VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then VERSION=$(bump_version $VERSION $LEVEL) 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" + sed -Ei "/^appVersion:/s/[0-9]+\.[0-9]+\.[0-9]/${VERSION}/" "$ROOT_DIR/chart/Chart.yaml" + git stash push --quiet +fi + # Return the VERSION echo "${VERSION}" exit 0 diff --git a/hooks/post-flow-hotfix-start b/hooks/post-flow-hotfix-start index 9028906..3f14e3f 100755 --- a/hooks/post-flow-hotfix-start +++ b/hooks/post-flow-hotfix-start @@ -36,6 +36,11 @@ VERSION_TAG=$(get_config gitflow.prefix.versiontag) update_version_file "$VERSION_FILE" $VERSION die_on_error "Failed to update $VERSION_FILE with version $VERSION" +if [[ -f $ROOT_DIR/chart/Chart.yaml ]]; then + git stash pop --quiet + git add "$ROOT_DIR/chart/Chart.yaml" +fi + git add "$VERSION_FILE" die_on_error "Failed to stage $VERSION_FILE" git commit -m "Bumped to version $VERSION" diff --git a/hooks/post-flow-release-start b/hooks/post-flow-release-start index e430073..be174d2 100755 --- a/hooks/post-flow-release-start +++ b/hooks/post-flow-release-start @@ -36,6 +36,11 @@ VERSION_TAG=$(get_config gitflow.prefix.versiontag) update_version_file "$VERSION_FILE" $VERSION die_on_error "Failed to update $VERSION_FILE with version $VERSION" +if [[ -f $ROOT_DIR/chart/Chart.yaml ]]; then + git stash pop --quiet + git add "$ROOT_DIR/chart/Chart.yaml" +fi + git add "$VERSION_FILE" die_on_error "Failed to stage $VERSION_FILE" git commit -m "Bumped to version $VERSION"