Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(chart): CI Bot bump chart version along with new deploy image version #2028

Merged
merged 3 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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