Skip to content

Commit 0aa255a

Browse files
authored
Merge pull request opensandbox-group#673 from Pangjiping/feat/bump-versions
bump ingress gateway to 1.0.6
2 parents ebe9cb3 + 5c52f64 commit 0aa255a

4 files changed

Lines changed: 145 additions & 9 deletions

File tree

.github/workflows/publish-server.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,54 @@ jobs:
104104
run: |
105105
chmod +x build.sh
106106
./build.sh
107+
108+
bump-server-chart:
109+
if: startsWith(github.ref, 'refs/tags/server/v')
110+
needs: publish-image
111+
runs-on: ubuntu-latest
112+
permissions:
113+
contents: write
114+
pull-requests: write
115+
steps:
116+
- name: Checkout code
117+
uses: actions/checkout@v6
118+
119+
- name: Parse tag and set variables
120+
id: parse_tag
121+
run: |
122+
TAG_PATH="${{ github.ref }}"
123+
TAG_PATH="${TAG_PATH#refs/tags/}"
124+
IMAGE_TAG="${TAG_PATH#server/}"
125+
if [ -z "$IMAGE_TAG" ]; then
126+
echo "failed to parse image tag from $TAG_PATH" >&2
127+
exit 1
128+
fi
129+
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
130+
131+
- name: Bump server chart image tag
132+
env:
133+
GH_TOKEN: ${{ github.token }}
134+
run: |
135+
IMAGE_TAG="${{ steps.parse_tag.outputs.image_tag }}"
136+
if [[ "$IMAGE_TAG" =~ ^v ]]; then
137+
VERSION="$IMAGE_TAG"
138+
else
139+
VERSION="v${IMAGE_TAG}"
140+
fi
141+
142+
chmod +x scripts/bump-server-chart.sh
143+
./scripts/bump-server-chart.sh "$VERSION"
144+
145+
BRANCH="bump/server-chart-${VERSION}"
146+
git config user.name "github-actions[bot]"
147+
git config user.email "github-actions[bot]@users.noreply.github.com"
148+
git checkout -b "$BRANCH"
149+
git add kubernetes/charts/opensandbox-server/values.yaml
150+
git diff --staged --quiet && echo "No changes to commit" && exit 0
151+
git commit -m "chore(chart): bump opensandbox-server image to ${VERSION}"
152+
git push origin "$BRANCH"
153+
154+
gh pr create \
155+
--title "chore(chart): bump opensandbox-server image to ${VERSION}" \
156+
--body "Auto-generated after publishing server image \`${VERSION}\` (tag \`${{ github.ref_name }}\`)." \
157+
--base "$(gh api repos/${{ github.repository }} --jq .default_branch)"

kubernetes/charts/opensandbox-server/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ server:
1414
# -- Server image configuration
1515
image:
1616
repository: sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/server
17-
tag: "v0.1.8"
17+
tag: "v0.1.9"
1818

1919
# -- Number of server replicas
2020
replicaCount: 2
@@ -38,7 +38,7 @@ server:
3838
gatewayRouteMode: "header"
3939
image:
4040
repository: sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/ingress
41-
tag: "v1.0.5"
41+
tag: "v1.0.6"
4242
replicaCount: 2
4343
port: 28888
4444
dataplaneNamespace: "opensandbox"

scripts/bump-component-version.sh

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# Bump egress or execd image version across the entire project.
16+
# Bump component image versions across the project (image refs like component:vX.Y.Z).
17+
# For ingress, also updates gateway image tag in kubernetes/charts/opensandbox-server/values.yaml.
1718
# Usage: from repo root:
1819
# ./scripts/bump-component-version.sh egress v1.0.2
1920
# ./scripts/bump-component-version.sh execd v1.0.7
21+
# ./scripts/bump-component-version.sh ingress v1.0.6
2022
# ./scripts/bump-component-version.sh v1.0.2 # same as: egress v1.0.2
2123

2224
set -euo pipefail
2325

2426
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
2527
cd "$REPO_ROOT"
2628

27-
# Parse args: [egress|execd] NEW_VERSION or NEW_VERSION (default egress)
29+
# Parse args: COMPONENT NEW_VERSION or NEW_VERSION (default component: egress)
2830
COMPONENT=""
2931
NEW_VERSION=""
3032
if [ $# -eq 1 ]; then
@@ -34,15 +36,16 @@ elif [ $# -eq 2 ]; then
3436
COMPONENT="$1"
3537
NEW_VERSION="$2"
3638
else
37-
echo "Usage: $0 [egress|execd] NEW_VERSION" >&2
39+
echo "Usage: $0 [egress|execd|ingress|code-interpreter] NEW_VERSION" >&2
3840
echo " $0 NEW_VERSION # bumps egress" >&2
3941
echo "Example: $0 egress v1.0.2" >&2
4042
echo "Example: $0 execd 1.0.7" >&2
43+
echo "Example: $0 ingress v1.0.6" >&2
4144
exit 1
4245
fi
4346

4447
case "$COMPONENT" in
45-
egress|execd|code-interpreter) ;;
48+
egress|execd|ingress|code-interpreter) ;;
4649
*)
4750
echo "Error: unsupported component: $COMPONENT" >&2
4851
exit 0
@@ -54,6 +57,33 @@ if [[ ! "$NEW_VERSION" =~ ^v ]]; then
5457
NEW_VERSION="v${NEW_VERSION}"
5558
fi
5659

60+
updated=0
61+
62+
# Helm values: gateway ingress image uses repository + tag (not ingress:vX in one string).
63+
CHART_VALUES="kubernetes/charts/opensandbox-server/values.yaml"
64+
if [ "$COMPONENT" = "ingress" ]; then
65+
INGRESS_REPO='repository: sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/ingress'
66+
if [ ! -f "$CHART_VALUES" ]; then
67+
echo "Error: missing $CHART_VALUES" >&2
68+
exit 1
69+
fi
70+
if ! grep -qF "$INGRESS_REPO" "$CHART_VALUES"; then
71+
echo "Error: expected ingress gateway repository line not found in $CHART_VALUES" >&2
72+
exit 1
73+
fi
74+
tmpfile="$(mktemp)"
75+
cp "$CHART_VALUES" "$tmpfile"
76+
perl -i -0pe 's{
77+
(repository:\s+sandbox-registry\.cn-zhangjiakou\.cr\.aliyuncs\.com/opensandbox/ingress\n
78+
\s+tag:\s+")[^"]+(")
79+
}{$1'"$NEW_VERSION"'$2}x' "$CHART_VALUES"
80+
if ! cmp -s "$CHART_VALUES" "$tmpfile"; then
81+
echo "Updated $CHART_VALUES (server.gateway.image tag for ingress)"
82+
updated=$((updated + 1))
83+
fi
84+
rm -f "$tmpfile"
85+
fi
86+
5787
# Pattern and replacement for this component (e.g. egress:vX.Y.Z -> egress:NEW_VERSION)
5888
PATTERN="${COMPONENT}:v[0-9]+\.[0-9]+\.[0-9]+"
5989
REPLACEMENT="${COMPONENT}:${NEW_VERSION}"
@@ -68,8 +98,9 @@ done < <(grep -rEl \
6898
--exclude-dir=.git --exclude-dir=__pycache__ --exclude-dir=.venv --exclude-dir=node_modules \
6999
"$PATTERN" . 2>/dev/null || true)
70100

71-
updated=0
72-
for f in "${files[@]}"; do
101+
# Iterate without "${files[@]}" on an empty array (bash 3.x + set -u can error).
102+
for ((i = 0; i < ${#files[@]}; i++)); do
103+
f="${files[$i]}"
73104
[ -f "$f" ] || continue
74105
case "$f" in
75106
*RELEASE_NOTES*) continue ;;
@@ -81,7 +112,7 @@ for f in "${files[@]}"; do
81112
done
82113

83114
if [ "$updated" -eq 0 ]; then
84-
echo "No files were updated (no matches for $PATTERN)." >&2
115+
echo "No files were updated (nothing matched for component $COMPONENT)." >&2
85116
exit 1
86117
fi
87118

scripts/bump-server-chart.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2026 Alibaba Group Holding Ltd.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Bump server.image.tag in opensandbox-server Helm values (only that field).
17+
# Usage from repo root:
18+
# ./scripts/bump-server-chart.sh v0.1.9
19+
# ./scripts/bump-server-chart.sh 0.1.9
20+
21+
set -euo pipefail
22+
23+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
24+
cd "$REPO_ROOT"
25+
26+
NEW_VERSION="${1:-}"
27+
if [ -z "$NEW_VERSION" ]; then
28+
echo "Usage: $0 VERSION" >&2
29+
exit 1
30+
fi
31+
32+
if [[ ! "$NEW_VERSION" =~ ^v ]]; then
33+
NEW_VERSION="v${NEW_VERSION}"
34+
fi
35+
36+
FILE="kubernetes/charts/opensandbox-server/values.yaml"
37+
if [ ! -f "$FILE" ]; then
38+
echo "Error: missing $FILE" >&2
39+
exit 1
40+
fi
41+
42+
# Match tag line immediately after opensandbox/server repository (not gateway/ingress).
43+
SERVER_REPO='repository: sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/server'
44+
if ! grep -qF "$SERVER_REPO" "$FILE"; then
45+
echo "Error: expected server repository line not found in $FILE" >&2
46+
exit 1
47+
fi
48+
49+
perl -i -0pe 's{
50+
(repository:\s+sandbox-registry\.cn-zhangjiakou\.cr\.aliyuncs\.com/opensandbox/server\n
51+
\s+tag:\s+")[^"]+(")
52+
}{$1'"$NEW_VERSION"'$2}x' "$FILE"
53+
54+
echo "Updated $FILE: server.image.tag -> $NEW_VERSION"

0 commit comments

Comments
 (0)