-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add update-chart scripts (#118)
* chore: add update-greptimedb-version scripts * refactor: refactor update-chart scripts and merge to one function impl update chart * chore: revert appVersion * chore: delete log * chore: update operator chart version * chore: add use 'update-chart' example * chore: add use 'update-chart' example
- Loading branch information
1 parent
ee617c2
commit 2cc9ae9
Showing
4 changed files
with
68 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
|
||
CHART="$1" | ||
VERSION="$2" | ||
|
||
function update_chart() { | ||
if [ -z "$CHART" ] || [ -z "$VERSION" ]; then | ||
echo "Error: Missing required arguments CHART or VERSION." | ||
exit 1 | ||
fi | ||
|
||
if [[ "$CHART" != "greptimedb-standalone" && "$CHART" != "greptimedb-operator" && "$CHART" != "greptimedb-cluster" ]]; then | ||
echo "Error: Invalid CHART value: "$CHART"." | ||
exit 1 | ||
fi | ||
|
||
if [[ ! "$VERSION" =~ ^v && "$CHART" != "greptimedb-operator" ]]; then | ||
echo "Error: VERSION must start with 'v'." | ||
exit 1 | ||
fi | ||
|
||
chart_file="./charts/"$CHART"/Chart.yaml" | ||
values_file="./charts/"$CHART"/values.yaml" | ||
|
||
current_version=$(yq eval '.version' "$chart_file") | ||
|
||
major=$(echo "$current_version" | awk -F. '{print $1}') | ||
minor=$(echo "$current_version" | awk -F. '{print $2}') | ||
patch=$(echo "$current_version" | awk -F. '{print $3}') | ||
|
||
next_version="$major.$minor.$((patch + 1))" | ||
|
||
if [[ "$CHART" == "greptimedb-operator" ]]; then | ||
# The greptimedb-operator image tag not have 'v' prefix. | ||
appVersion=$VERSION | ||
else | ||
appVersion=${VERSION#v} | ||
fi | ||
|
||
yq eval ".appVersion = \"$appVersion\"" -i "$chart_file" | ||
yq eval ".version = \"$next_version\"" -i "$chart_file" | ||
|
||
echo "The chart $CHART version updated to $next_version successfully." | ||
|
||
yq e ".image.tag = \"$VERSION\"" "$values_file" > /tmp/"$CHART"-values-updated.yaml | ||
diff -U0 -w -b --ignore-blank-lines "$values_file" /tmp/"$CHART"-values-updated.yaml > /tmp/"$CHART"-values.diff | ||
patch "$values_file" < /tmp/"$CHART"-values.diff | ||
|
||
echo "The chart $CHART image updated to $VERSION successfully." | ||
} | ||
|
||
update_chart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ kubeVersion: ">=1.18.0-0" | |
description: The greptimedb-operator Helm chart for Kubernetes | ||
name: greptimedb-operator | ||
appVersion: 0.1.0-alpha.23 | ||
version: 0.1.10 | ||
version: 0.1.11 | ||
type: application | ||
home: https://github.com/GreptimeTeam/greptimedb-operator | ||
sources: | ||
|
@@ -13,9 +13,9 @@ keywords: | |
- database | ||
- greptimedb | ||
maintainers: | ||
- name: daviderli614 | ||
email: [email protected] | ||
url: https://github.com/daviderli614 | ||
- name: zyy17 | ||
email: [email protected] | ||
url: https://github.com/zyy17 | ||
- name: daviderli614 | ||
email: [email protected] | ||
url: https://github.com/daviderli614 | ||
- name: zyy17 | ||
email: [email protected] | ||
url: https://github.com/zyy17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters