Skip to content

Commit

Permalink
feat: CI Bot bump chart version along with new deploy image version (#…
Browse files Browse the repository at this point in the history
…2028)

* Update appVersion for next deploy
[skip ci]

* Bump the chart version along with image version

Signed-off-by: Viet Nguyen Duc <[email protected]>

---------

Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 authored Nov 27, 2023
1 parent c3938aa commit bbef734
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/selenium-grid/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: selenium-grid
description: A Helm chart for creating a Selenium Grid Server in Kubernetes
type: application
version: 0.25.1
appVersion: 4.15.0-20231110
appVersion: 4.15.0-20231122
icon: https://github.com/SeleniumHQ/docker-selenium/raw/trunk/logo.png
dependencies:
- repository: https://kedacore.github.io/charts
Expand Down
29 changes: 27 additions & 2 deletions update_tag_in_docs_and_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,45 @@ LATEST_TAG=$1
NEXT_TAG=$2
LATEST_DATE=$(echo ${LATEST_TAG} | sed 's/.*-//')
NEXT_DATE=$(echo ${NEXT_TAG} | sed 's/.*-//')
latest_chart_app_version=$(find . \( -type d -name .git -prune \) -o -type f -name 'Chart.yaml' -print0 | xargs -0 cat | grep ^appVersion | cut -d ':' -f 2 | tr -d '[:space:]')

echo -e "\033[0;32m Updating tag displayed in docs and files...\033[0m"
echo -e "\033[0;32m LATEST_TAG -> ${LATEST_TAG}\033[0m"
echo -e "\033[0;32m NEXT_TAG -> ${NEXT_TAG}\033[0m"

# If you want to test this locally and you are using macOS, do `brew install gnu-sed` and change `sed` for `gsed`.
find . \( -type d -name .git -prune \) -o -type f ! -name 'Chart.yaml' -print0 | xargs -0 sed -i "s/${LATEST_TAG}/${NEXT_TAG}/g"
find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s/${LATEST_TAG}/${NEXT_TAG}/g"

echo -e "\033[0;32m Updating date used in some docs and files...\033[0m"
echo -e "\033[0;32m LATEST_DATE -> ${LATEST_DATE}\033[0m"
echo -e "\033[0;32m NEXT_DATE -> ${NEXT_DATE}\033[0m"

# If you want to test this locally and you are using macOS, do `brew install gnu-sed` and change `sed` for `gsed`.
find . \( -type d -name .git -prune \) -o -type f ! -name 'Chart.yaml' -print0 | xargs -0 sed -i "s/${LATEST_DATE}/${NEXT_DATE}/g"
find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s/${LATEST_DATE}/${NEXT_DATE}/g"

# Bump chart version and appVersion if next tag is different
if [ "$latest_chart_app_version" == $LATEST_TAG ] && [ "$latest_chart_app_version" != "$NEXT_TAG" ]; then
IFS='.' read -ra latest_version_parts <<< "$LATEST_TAG"
IFS='.' read -ra next_version_parts <<< "$NEXT_TAG"
latest_chart_version=$(find . \( -type d -name .git -prune \) -o -type f -name 'Chart.yaml' -print0 | xargs -0 cat | grep ^version | cut -d ':' -f 2 | tr -d '[:space:]')
IFS='.' read -ra latest_chart_version_parts <<< "$latest_chart_version"
if [ "${latest_version_parts[0]}" != "${next_version_parts[0]}" ]; then
((latest_chart_version_parts[0]++))
latest_chart_version_parts[1]=0
latest_chart_version_parts[2]=0
elif [ "${latest_version_parts[1]}" != "${next_version_parts[1]}" ]; then
((latest_chart_version_parts[1]++))
latest_chart_version_parts[2]=0
elif [ "${latest_version_parts[2]}" != "${next_version_parts[2]}" ]; then
((latest_chart_version_parts[2]++))
fi
next_chart_version="${latest_chart_version_parts[0]}.${latest_chart_version_parts[1]}.${latest_chart_version_parts[2]}"
echo -e "\033[0;32m Updating chart version...\033[0m"
echo -e "\033[0;32m LATEST_CHART_VERSION -> ${latest_chart_version}\033[0m"
echo -e "\033[0;32m NEXT_CHART_VERSION -> ${next_chart_version}\033[0m"
# If you want to test this locally and you are using macOS, do `brew install gnu-sed` and change `sed` for `gsed`.
find . \( -type d -name .git -prune \) -o -type f -name 'Chart.yaml' -print0 | xargs -0 sed -i "s/${latest_chart_version}/${next_chart_version}/g"
fi

git diff | cat

Expand Down

0 comments on commit bbef734

Please sign in to comment.