Skip to content

Commit

Permalink
Merge pull request #3690 from ty-dc/fix/update-k8s-version
Browse files Browse the repository at this point in the history
ci fix: Optimize robot to update kind/node version
  • Loading branch information
weizhoublue committed Jul 9, 2024
2 parents 394f8f5 + 85d5582 commit 48a8e93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/auto-diff-k8s-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@ jobs:
- name: get latest kind node version
run: |
bash ./test/scripts/update-kindnode-version.sh ${{ env.MINIMUM_K8S_VERSION }} ${{ env.K8S_MATRIX_FILE_PATH }}
if [ $? -eq 0 ]; then
if [ $? -ne 0 ]; then
echo "./test/scripts/update-kindnode-version.sh script failed"
echo "SKIP_CREATE_PR=true" >> $GITHUB_ENV
exit 0
fi
git_status=$(git status --porcelain)
echo "git status: ${git_status}"
if [[ -n "$git_status" ]]; then
echo "SKIP_CREATE_PR=false" >> $GITHUB_ENV
echo "The .github/workflows/auto-diff-k8s-ci.yaml of Spiderpool has changed."
Expand Down Expand Up @@ -164,7 +165,7 @@ jobs:
delete-branch: true
signoff: true
base: main
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.WELAN_PAT }}
labels: ${{ env.PR_LABEL }}
reviewers: ${{ env.PR_REVIWER }}

Expand Down
5 changes: 5 additions & 0 deletions test/scripts/update-kindnode-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ if [[ "$ORIGIN_K8S_VERSION" == "$KIND_NODE_VERSION" ]]; then
elif [[ ${#KIND_NODE_VERSION} -gt ${#ORIGIN_K8S_VERSION} ]]; then
echo "kind/node releases a new version, updates it in k8s matrix."
sed -i 's/\'"${ORIGIN_K8S_VERSION}"/"${KIND_NODE_VERSION}"'/' $K8S_MATRIX_FILE_PATH
exit 0
elif [[ ${#KIND_NODE_VERSION} -eq ${#ORIGIN_K8S_VERSION} && "$KIND_NODE_VERSION" != "$ORIGIN_K8S_VERSION" ]]; then
echo "kind/node released a new .z version, updated in the k8s matrix"
sed -i 's/\'"${ORIGIN_K8S_VERSION}"/"${KIND_NODE_VERSION}"'/' $K8S_MATRIX_FILE_PATH
exit 0
else
echo "update failed, please check."
exit 1
Expand Down

0 comments on commit 48a8e93

Please sign in to comment.