-
Notifications
You must be signed in to change notification settings - Fork 108
feat(prow-jobs/tikv/pd): add automatic PD client dependency update job for TiDB #3818
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
Draft
Copilot
wants to merge
9
commits into
main
Choose a base branch
from
copilot/automate-dependency-update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cdbe458
Initial plan
Copilot 3f2b9f0
Add postsubmit job to auto-update pd dependency in TiDB
Copilot 1efe0e0
Update pd module to client submodule and trigger only on client folde…
Copilot 2af8bb0
Apply suggestion from @wuhuizuo
wuhuizuo 0fa3027
Apply suggestion from @wuhuizuo
wuhuizuo b1186a5
Apply suggestion from @wuhuizuo
wuhuizuo cc5cf62
Apply suggestion from @wuhuizuo
wuhuizuo 4640b69
fix: auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ae40502
Apply suggestion from @wuhuizuo
wuhuizuo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,111 @@ | ||
| global_definitions: | ||
| branches: &branches | ||
| - ^master$ | ||
| - ^release-[0-9]+[.][0-9]+$ | ||
| skip_if_only_changed: &skip_if_only_changed "(\\.(md|png|jpeg|jpg|gif|svg|pdf)|Dockerfile|OWNERS|OWNERS_ALIASES)$" | ||
|
|
||
| # struct ref: https://pkg.go.dev/sigs.k8s.io/prow/pkg/config#Postsubmit | ||
| postsubmits: | ||
| tikv/pd: | ||
| - name: auto-update-pd-gomod | ||
| decorate: true | ||
| decorate_config: | ||
| skip_cloning: true | ||
| run_if_changed: "^client/.*$" | ||
| branches: *branches | ||
| spec: | ||
| containers: | ||
| - name: build | ||
| image: golang:1.23 | ||
| command: [bash, -ceo, pipefail] | ||
| args: | ||
| - | | ||
| # clone tidb repo | ||
| git clone https://github.com/pingcap/tidb.git --branch "${PULL_BASE_REF}" ../tidb && cd ../tidb | ||
|
|
||
| ###### update mods that comes from pd repo ##### | ||
| new_pd="$(go list -m github.com/tikv/pd/client@${PULL_BASE_REF} | awk '{print $1 "@" $2}')" | ||
| echo "new pd: $new_pd" | ||
| go mod edit --require "$new_pd" go.mod | ||
|
|
||
| # fast exit if no change on go.mod file | ||
| git add go.mod | ||
| if git diff --cached --exit-code --name-status go.mod; then | ||
| echo "🤷 No changes happened." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # update go.sum | ||
| go mod tidy | ||
| git add go.mod go.sum | ||
|
|
||
| # install `gh` tool | ||
| type -p curl >/dev/null || ( apt update && apt install curl -y) | ||
| curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ | ||
| && chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ | ||
| && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ | ||
| && apt update \ | ||
| && apt install gh -y | ||
|
|
||
| # setup git | ||
| git config user.email "[email protected]" | ||
| git config user.name "ti-chi-bot" | ||
| gh auth setup-git | ||
|
|
||
| # commit and push the changes. | ||
| head_branch="fix/${PULL_BASE_REF}/update-dep-pd" | ||
| git checkout -b "$head_branch" | ||
| commit_msg="chore(deps): bump go mod github.com/tikv/pd/client" | ||
| git commit -m "$commit_msg" | ||
| git push -f --set-upstream origin "$head_branch" | ||
|
|
||
| # create pull request | ||
| pr_desc=" | ||
| ### What problem does this PR solve? | ||
|
|
||
| Auto generated by bot. | ||
| Issue Number: ref #${REF_ISSUE_NUM} | ||
|
|
||
| ### Check List | ||
|
|
||
| Tests <!-- At least one of them must be included. --> | ||
|
|
||
| - [x] Unit test | ||
| - [ ] Integration test | ||
| - [ ] Manual test (add detailed scripts or steps below) | ||
| - [ ] No need to test | ||
| > - [ ] I checked and no code files have been changed. | ||
| > <!-- Or your custom "No need to test" reasons --> | ||
|
|
||
| ### Release note | ||
|
|
||
| \`\`\`release-note | ||
| None | ||
| \`\`\` | ||
| " | ||
| gh pr create \ | ||
| --base $PULL_BASE_REF \ | ||
| --head "$head_branch" \ | ||
| --title "$commit_msg" \ | ||
| --body "$pr_desc" \ | ||
| --reviewer "$REVIEWER" \ | ||
| --assignee "$ASSIGNEE" | ||
| env: | ||
| - name: REVIEWER | ||
| value: "rleungx" | ||
| - name: ASSIGNEE | ||
| value: "rleungx" | ||
| - name: REF_ISSUE_NUM | ||
| value: "63997" | ||
| - name: GH_TOKEN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| key: token | ||
| name: github-token | ||
| resources: | ||
| requests: | ||
| memory: 1Gi | ||
| cpu: "500m" | ||
| limits: | ||
| memory: 2Gi | ||
| cpu: "1" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.