feat(prow-jobs/tikv/pd): add automatic PD client dependency update job for TiDB
Problem
When bug fixes are made to the PD client (which lives in the tikv/pd repository), it's easy to forget to update TiDB's or client-go's dependency on PD. This can result in fixes not taking effect in downstream projects, leading to continued bugs and inconsistent behavior.
Solution
This PR adds a postsubmit job for the tikv/pd repository that automatically creates pull requests in the pingcap/tidb repository when changes are merged to PD.
The job:
- Triggers on pushes to
masterandrelease-*branches intikv/pd -
Only triggers when code changes in the
client/folder (usingrun_if_changed: "^client/.*$") - Clones the
pingcap/tidbrepository with the same target branch as the PD push - Updates the
github.com/tikv/pd/clientdependency to the latest version from that branch - Runs
go mod tidyto updatego.sum - Automatically creates a pull request in
pingcap/tidbwith the updated dependency
Implementation
Created prow-jobs/tikv/pd/common-postsubmits.yaml following the exact same pattern as the existing auto-update-ticdc-gomod job in prow-jobs/pingcap/tiflow/common-postsubmits.yaml. This ensures consistency with established patterns in the codebase.
The job uses:
-
golang:1.23container image - GitHub CLI (
gh) for PR creation - GitHub token from Kubernetes secrets for authentication
- Smart skipping when only documentation or image files change
- Efficient triggering that only runs when the
client/folder is modified
Example Workflow
When a change is merged to the client/ folder in tikv/pd on the release-8.1 branch:
- The postsubmit job is triggered
- Job clones
pingcap/tidbatrelease-8.1branch - Job updates the PD client dependency to the latest version from
release-8.1 - Job creates a PR in
pingcap/tidbtargetingrelease-8.1with the title:chore(deps): bump go mod github.com/tikv/pd/client
This automation ensures that bug fixes and improvements in the PD client are quickly propagated to TiDB, reducing the risk of stale dependencies and ensuring fixes take effect promptly.
Fixes #1074
<issue_title>Automatically update pd client dependency</issue_title>
><issue_description>When we do some bug fixes on the PD client, which is inside the pd repo. It is easy to forget to update TiDB's/client-go's dependency. This might result in the fix not taking effect. So it's better to make it automatically triggered.</issue_description>
>
><agent_instructions>do it like the job we did in file: prow-jobs/pingcap/tiflow/common-postsubmits.yaml
>
> set the post submit job for tikv/pd repo to make it auto create PR to pingcap/tidb repo with the same target branch</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
>
Fixes PingCAP-QE/ci#3817
Original prompt
This section details on the original issue you should resolve
<issue_title>Automatically update pd client dependency</issue_title> <issue_description>When we do some bug fixes on the PD client, which is inside the pd repo. It is easy to forget to update TiDB's/client-go's dependency. This might result in the fix not taking effect. So it's better to make it automatically triggered.</issue_description>
<agent_instructions>do it like the job we did in file: prow-jobs/pingcap/tiflow/common-postsubmits.yaml
set the post submit job for
tikv/pdrepo to make it auto create PR topingcap/tidbrepo with the same target branch</agent_instructions>Comments on the Issue (you are @copilot in this section)
Fixes PingCAP-QE/ci#3817
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.