Skip to content

feat(tikv/migration): migrate CI artifacts from fileserver to OCI registry#4272

Merged
ti-chi-bot[bot] merged 9 commits intomainfrom
copilot/migrate-artifacts-to-oci-please-work
Mar 6, 2026
Merged

feat(tikv/migration): migrate CI artifacts from fileserver to OCI registry#4272
ti-chi-bot[bot] merged 9 commits intomainfrom
copilot/migrate-artifacts-to-oci-please-work

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

Migrates tikv/migration integration CI jobs from fileserver.pingcap.net to OCI artifacts in hub-zot.pingcap.net/mirrors/hub.

Changes

  • update pull_integration_test.groovy and pull_integration_kafka_test.groovy to prepare integration binaries via OCI
  • preserve make prepare_test_binaries semantics by downloading required artifacts into cdc/scripts/bin (tidb-server, tikv-server, pd-server, pd-ctl, etcdctl, go-ycsb)
  • set OCI_ARTIFACT_HOST to hub-zot.pingcap.net/mirrors/hub in integration pipelines
  • add utils sidecar (ghcr.io/pingcap-qe/cd/utils/release) in integration pod templates for OCI tooling support
  • keep integration presubmit triggers in prow-jobs/tikv/migration/latest-presubmits.yaml with shared YAML anchors

Follow-up split out

Fixes #4215

Copilot AI self-assigned this Feb 28, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 28, 2026

Hi @Copilot. Thanks for your PR.

I'm waiting for a PingCAP-QE member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

…OCI registry

Co-authored-by: wuhuizuo <2574558+wuhuizuo@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate tikv/migration artifacts to OCI registry feat(tikv/migration): migrate CI artifacts from fileserver to OCI registry Feb 28, 2026
ti-chi-bot bot pushed a commit that referenced this pull request Mar 6, 2026
## Summary
- remove `pull_unit_test` presubmit from
`prow-jobs/tikv/migration/latest-presubmits.yaml`
- delete the Jenkins job DSL
`jobs/tikv/migration/latest/pull_unit_test.groovy`
- delete the pipeline and pod template used by this job under
`pipelines/tikv/migration/latest/`

## Context
- this is a follow-up split from #4272

Fixes #4300
Related to #4215
@wuhuizuo wuhuizuo marked this pull request as ready for review March 6, 2026 10:54
@wuhuizuo wuhuizuo requested review from Copilot and wuhuizuo March 6, 2026 10:54
@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 6, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wuhuizuo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the lgtm label Mar 6, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 6, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-03-06 10:54:55.174547524 +0000 UTC m=+1926.686605195: ☑️ agreed by wuhuizuo.

@ti-chi-bot ti-chi-bot bot added the approved label Mar 6, 2026
@wuhuizuo
Copy link
Contributor

wuhuizuo commented Mar 6, 2026

/ok-to-test

@ti-chi-bot ti-chi-bot bot merged commit 9e255f9 into main Mar 6, 2026
7 of 8 checks passed
@ti-chi-bot ti-chi-bot bot deleted the copilot/migrate-artifacts-to-oci-please-work branch March 6, 2026 11:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the tikv/migration integration presubmit pipelines away from fileserver.pingcap.net by downloading required CI binaries from OCI registries (hub-zot mirror), aligning these jobs with the repo’s broader OCI artifact migration approach.

Changes:

  • Refactors tikv/migration presubmits YAML to use shared YAML anchors for branch and Jenkins job defaults.
  • Updates integration pipelines to download tidb/tikv/pd (+ pd-ctl, etcdctl, go-ycsb) via download_pingcap_oci_artifact.sh and sets OCI_ARTIFACT_HOST to the hub-zot mirror.
  • Adds a utils sidecar container to the integration pod templates to provide OCI tooling (oras, yq, etc.).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
prow-jobs/tikv/migration/latest-presubmits.yaml Uses shared YAML anchors to DRY up presubmit definitions (branches + Jenkins defaults).
pipelines/tikv/migration/latest/pull_integration_test.groovy Switches binary preparation from fileserver to OCI downloads using the utils container + mirror host env.
pipelines/tikv/migration/latest/pull_integration_kafka_test.groovy Same OCI-based binary preparation change for the Kafka integration job.
pipelines/tikv/migration/latest/pod-pull_integration_test.yaml Adds utils sidecar needed for OCI artifact tooling.
pipelines/tikv/migration/latest/pod-pull_integration_kafka_test.yaml Adds utils sidecar needed for OCI artifact tooling in the Kafka pod.

Comment on lines +79 to +93
sh label: 'download test binaries via OCI', script: """
mkdir -p ./cdc/scripts/bin
cd ./cdc/scripts/bin
${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh \
--tidb=${OCI_TAG_TIDB} \
--tikv=${OCI_TAG_TIKV} \
--pd=${OCI_TAG_PD} \
--pd-ctl=${OCI_TAG_PD} \
--etcdctl=${OCI_TAG_ETCD} \
--ycsb=${OCI_TAG_YCSB}
chmod +x tidb-server tikv-server pd-server pd-ctl etcdctl go-ycsb
cd ../../
touch prepare_test_binaries
ls -alh
"""
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OCI download step is doing network fetches but isn’t wrapped in retry(...), unlike similar pipelines in this repo. Consider adding a small retry around the download script invocation to reduce CI flakiness from transient registry/network errors.

Suggested change
sh label: 'download test binaries via OCI', script: """
mkdir -p ./cdc/scripts/bin
cd ./cdc/scripts/bin
${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh \
--tidb=${OCI_TAG_TIDB} \
--tikv=${OCI_TAG_TIKV} \
--pd=${OCI_TAG_PD} \
--pd-ctl=${OCI_TAG_PD} \
--etcdctl=${OCI_TAG_ETCD} \
--ycsb=${OCI_TAG_YCSB}
chmod +x tidb-server tikv-server pd-server pd-ctl etcdctl go-ycsb
cd ../../
touch prepare_test_binaries
ls -alh
"""
retry(3) {
sh label: 'download test binaries via OCI', script: """
mkdir -p ./cdc/scripts/bin
cd ./cdc/scripts/bin
${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh \
--tidb=${OCI_TAG_TIDB} \
--tikv=${OCI_TAG_TIKV} \
--pd=${OCI_TAG_PD} \
--pd-ctl=${OCI_TAG_PD} \
--etcdctl=${OCI_TAG_ETCD} \
--ycsb=${OCI_TAG_YCSB}
chmod +x tidb-server tikv-server pd-server pd-ctl etcdctl go-ycsb
cd ../../
touch prepare_test_binaries
ls -alh
"""
}

Copilot uses AI. Check for mistakes.
// tidb-server: hub-zot.pingcap.net/mirrors/hub/pingcap/tidb/package:<tag>_linux_amd64
// tikv-server: hub-zot.pingcap.net/mirrors/hub/tikv/tikv/package:<tag>_linux_amd64
// pd-server: hub-zot.pingcap.net/mirrors/hub/tikv/pd/package:<tag>_linux_amd64
OCI_ARTIFACT_HOST = 'hub-zot.pingcap.net/mirrors/hub'
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

download_pingcap_oci_artifact.sh uses OCI_ARTIFACT_HOST_COMMUNITY (defaulting to us-docker.pkg.dev/.../hub) for third-party artifacts like --etcdctl and --ycsb. If these jobs are intended to pull all artifacts via the hub-zot mirror, also set OCI_ARTIFACT_HOST_COMMUNITY (or export it just for the script invocation) to the mirror registry; otherwise these downloads will still hit the community registry.

Suggested change
OCI_ARTIFACT_HOST = 'hub-zot.pingcap.net/mirrors/hub'
OCI_ARTIFACT_HOST = 'hub-zot.pingcap.net/mirrors/hub'
OCI_ARTIFACT_HOST_COMMUNITY = 'hub-zot.pingcap.net/mirrors/hub'

Copilot uses AI. Check for mistakes.
Comment on lines +79 to +93
sh label: 'download test binaries via OCI', script: """
mkdir -p ./cdc/scripts/bin
cd ./cdc/scripts/bin
${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh \
--tidb=${OCI_TAG_TIDB} \
--tikv=${OCI_TAG_TIKV} \
--pd=${OCI_TAG_PD} \
--pd-ctl=${OCI_TAG_PD} \
--etcdctl=${OCI_TAG_ETCD} \
--ycsb=${OCI_TAG_YCSB}
chmod +x tidb-server tikv-server pd-server pd-ctl etcdctl go-ycsb
cd ../../
touch prepare_test_binaries
ls -alh
"""
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OCI download step is doing network fetches but isn’t wrapped in retry(...), unlike similar pipelines in this repo. Consider adding a small retry around the download script invocation to reduce CI flakiness from transient registry/network errors.

Suggested change
sh label: 'download test binaries via OCI', script: """
mkdir -p ./cdc/scripts/bin
cd ./cdc/scripts/bin
${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh \
--tidb=${OCI_TAG_TIDB} \
--tikv=${OCI_TAG_TIKV} \
--pd=${OCI_TAG_PD} \
--pd-ctl=${OCI_TAG_PD} \
--etcdctl=${OCI_TAG_ETCD} \
--ycsb=${OCI_TAG_YCSB}
chmod +x tidb-server tikv-server pd-server pd-ctl etcdctl go-ycsb
cd ../../
touch prepare_test_binaries
ls -alh
"""
retry(2) {
sh label: 'download test binaries via OCI', script: """
mkdir -p ./cdc/scripts/bin
cd ./cdc/scripts/bin
${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh \
--tidb=${OCI_TAG_TIDB} \
--tikv=${OCI_TAG_TIKV} \
--pd=${OCI_TAG_PD} \
--pd-ctl=${OCI_TAG_PD} \
--etcdctl=${OCI_TAG_ETCD} \
--ycsb=${OCI_TAG_YCSB}
chmod +x tidb-server tikv-server pd-server pd-ctl etcdctl go-ycsb
cd ../../
touch prepare_test_binaries
ls -alh
"""
}

Copilot uses AI. Check for mistakes.
// tidb-server: hub-zot.pingcap.net/mirrors/hub/pingcap/tidb/package:<tag>_linux_amd64
// tikv-server: hub-zot.pingcap.net/mirrors/hub/tikv/tikv/package:<tag>_linux_amd64
// pd-server: hub-zot.pingcap.net/mirrors/hub/tikv/pd/package:<tag>_linux_amd64
OCI_ARTIFACT_HOST = 'hub-zot.pingcap.net/mirrors/hub'
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

download_pingcap_oci_artifact.sh uses OCI_ARTIFACT_HOST_COMMUNITY (defaulting to us-docker.pkg.dev/.../hub) for third-party artifacts like --etcdctl and --ycsb. If these jobs are intended to pull all artifacts via the hub-zot mirror, also set OCI_ARTIFACT_HOST_COMMUNITY (or export it just for the script invocation) to the mirror registry; otherwise these downloads will still hit the community registry.

Suggested change
OCI_ARTIFACT_HOST = 'hub-zot.pingcap.net/mirrors/hub'
OCI_ARTIFACT_HOST = 'hub-zot.pingcap.net/mirrors/hub'
// Community / third-party artifacts (e.g. etcdctl, ycsb) via the same mirror
OCI_ARTIFACT_HOST_COMMUNITY = 'hub-zot.pingcap.net/mirrors/hub'

Copilot uses AI. Check for mistakes.
Comment on lines +82 to +88
${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh \
--tidb=${OCI_TAG_TIDB} \
--tikv=${OCI_TAG_TIKV} \
--pd=${OCI_TAG_PD} \
--pd-ctl=${OCI_TAG_PD} \
--etcdctl=${OCI_TAG_ETCD} \
--ycsb=${OCI_TAG_YCSB}
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sh step builds a shell command line where --tidb=${OCI_TAG_TIDB}, --tikv=${OCI_TAG_TIKV}, and other flags interpolate values derived from the PR title into an unquoted shell context. Because OCI_TAG_* values come from component.computeArtifactOciTagFromPR, which can be influenced via the PR title and allows shell metacharacters like ;, an attacker can craft a PR title such that the resulting tag injects arbitrary commands executed in the CI container. Treat OCI_TAG_* as untrusted: strictly validate/whitelist allowed characters for tags and ensure they are passed as safely quoted arguments (or via an array/parameter mechanism) so no shell metacharacters can break out of the intended argument.

Copilot uses AI. Check for mistakes.
Comment on lines +82 to +88
${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh \
--tidb=${OCI_TAG_TIDB} \
--tikv=${OCI_TAG_TIKV} \
--pd=${OCI_TAG_PD} \
--pd-ctl=${OCI_TAG_PD} \
--etcdctl=${OCI_TAG_ETCD} \
--ycsb=${OCI_TAG_YCSB}
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sh invocation interpolates OCI_TAG_* values (computed from PR metadata via component.computeArtifactOciTagFromPR) directly into a shell command as unquoted arguments like --tidb=${OCI_TAG_TIDB}. Since the PR title can include shell metacharacters (e.g., ;, &) that are preserved by computeArtifactOciTagFromPR, a malicious PR author could craft a title that turns these arguments into a command-injection vector, executing arbitrary commands in the CI utils container. Please treat these tag values as untrusted: constrain them to a safe character set and ensure they are safely quoted/passed to the script so injected shell syntax cannot alter the command flow.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

fileserver: migrate artifacts for tikv/migration

4 participants