ci icon indicating copy to clipboard operation
ci copied to clipboard

feat(prow-jobs/tikv/pd): add automatic PD client dependency update job for TiDB

Open Copilot opened this issue 4 months ago • 6 comments

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 master and release-* branches in tikv/pd
  • Only triggers when code changes in the client/ folder (using run_if_changed: "^client/.*$")
  • Clones the pingcap/tidb repository with the same target branch as the PD push
  • Updates the github.com/tikv/pd/client dependency to the latest version from that branch
  • Runs go mod tidy to update go.sum
  • Automatically creates a pull request in pingcap/tidb with 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.23 container 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:

  1. The postsubmit job is triggered
  2. Job clones pingcap/tidb at release-8.1 branch
  3. Job updates the PD client dependency to the latest version from release-8.1
  4. Job creates a PR in pingcap/tidb targeting release-8.1 with 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/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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Oct 16 '25 09:10 Copilot