Skip to content

fileserver: migrate pingcap/tidb release-8.5 artifact downloads to OCI#4293

Merged
ti-chi-bot[bot] merged 5 commits intomainfrom
split/release-8.5-oci-from-4274
Mar 5, 2026
Merged

fileserver: migrate pingcap/tidb release-8.5 artifact downloads to OCI#4293
ti-chi-bot[bot] merged 5 commits intomainfrom
split/release-8.5-oci-from-4274

Conversation

@wuhuizuo
Copy link
Contributor

@wuhuizuo wuhuizuo commented Mar 5, 2026

Summary

  • split out pipelines/pingcap/tidb/release-8.5/** changes from fileserver: migrate pingcap/tidb artifact downloads to OCI registry #4274 into a standalone PR
  • migrate release-8.5 pipelines away from fileserver.pingcap.net to OCI artifact pulls
  • keep implementation pattern aligned with migrated latest jobs (OCI_TAG_* + download_pingcap_oci_artifact.sh via utils container)

Scope

  • 30 files under pipelines/pingcap/tidb/release-8.5/

Validation

  • Jenkinsfile validation succeeded for all changed Groovy files via .ci/verify-jenkins-pipeline-file.sh

Ref #4274
Fixes #4292

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the artifact download process for the release-8.5 branch of TiDB pipelines. By transitioning from a custom file server to OCI artifact pulls, the change standardizes the build process, aligning it with the patterns already established for latest jobs. This migration enhances consistency and leverages modern container registry capabilities for artifact management across the CI/CD system.

Highlights

  • Artifact Download Migration: Migrated artifact downloads for release-8.5 pipelines from fileserver.pingcap.net to OCI (Open Container Initiative) artifact pulls.
  • Standardized Implementation: Adopted the implementation pattern aligned with latest jobs, utilizing OCI_TAG_* variables and the download_pingcap_oci_artifact.sh script via a dedicated utils container.
  • Pipeline Configuration Updates: Updated numerous Jenkins Groovy pipeline files and Kubernetes pod templates to reflect the new OCI-based artifact fetching mechanism.
Changelog
  • pipelines/pingcap/tidb/release-8.5/pod-pull_check2.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pod-pull_e2e_test.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pod-pull_integration_common_test.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pod-pull_integration_copr_test.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pod-pull_integration_ddl_test.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pod-pull_integration_jdbc_test.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pod-pull_integration_mysql_test.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pod-pull_integration_nodejs_test.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pod-pull_integration_python_orm_test.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pod-pull_integration_tidb_tools_test.yaml
    • Added utils container definition with specified image and resource limits.
  • pipelines/pingcap/tidb/release-8.5/pull_build.groovy
    • Removed FILE_SERVER_URL environment variable.
    • Removed file server upload logic from post-build steps.
  • pipelines/pingcap/tidb/release-8.5/pull_check2.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script in utils container.
    • Removed fileserver check flag upload from post-build steps.
  • pipelines/pingcap/tidb/release-8.5/pull_common_test.groovy
    • Removed FILE_SERVER_URL environment variable.
  • pipelines/pingcap/tidb/release-8.5/pull_e2e_test.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_br_test.groovy
    • Removed FILE_SERVER_URL environment variable.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_common_test.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script in utils container.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_copr_test.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script in utils container.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_ddl_test.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script in utils container.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_e2e_test.groovy
    • Removed FILE_SERVER_URL environment variable.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_jdbc_test.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script in utils container.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_lightning_test.groovy
    • Removed FILE_SERVER_URL environment variable.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_mysql_test.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script in utils container.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_nodejs_test.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script in utils container.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_python_orm_test.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script in utils container.
  • pipelines/pingcap/tidb/release-8.5/pull_integration_tidb_tools_test.groovy
    • Defined OCI_TAG_PD and OCI_TAG_TIKV variables.
    • Replaced FILE_SERVER_URL with OCI_ARTIFACT_HOST.
    • Migrated artifact download from fileserver to OCI script in utils container.
  • pipelines/pingcap/tidb/release-8.5/pull_mysql_client_test.groovy
    • Removed FILE_SERVER_URL environment variable.
  • pipelines/pingcap/tidb/release-8.5/pull_mysql_test.groovy
    • Removed FILE_SERVER_URL environment variable.
  • pipelines/pingcap/tidb/release-8.5/pull_sqllogic_test.groovy
    • Removed FILE_SERVER_URL environment variable.
  • pipelines/pingcap/tidb/release-8.5/pull_unit_test.groovy
    • Removed FILE_SERVER_URL environment variable.
  • pipelines/pingcap/tidb/release-8.5/pull_unit_test_ddlv1.groovy
    • Removed FILE_SERVER_URL environment variable.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully migrates artifact downloads for release-8.5 pipelines from fileserver.pingcap.net to an OCI registry. However, a critical command injection vulnerability has been identified in multiple Jenkinsfiles. This vulnerability arises because untrusted PR titles are used to compute OCI tags, which are then directly interpolated into shell scripts, allowing arbitrary command execution on the CI infrastructure. Additionally, two key issues were noted: the removal of the artifact upload mechanism in pull_build.groovy which could impact downstream jobs, and an inconsistency in pull_e2e_test.groovy where the new download logic does not utilize the dedicated utils container. Addressing the command injection by sanitizing OCI tags or using environment variables, along with resolving the identified inconsistencies, will significantly improve the security and consistency of the new CI workflow.

I am having trouble creating individual review comments. Click here to see my feedback.

pipelines/pingcap/tidb/release-8.5/pull_e2e_test.groovy (59-62)

security-critical critical

This section is vulnerable to a critical command injection. The PR title (REFS.pulls[0].title) is used to compute OCI tags, which are then directly interpolated into a shell script. This allows an attacker to execute arbitrary commands on the Jenkins agent via a malicious PR title (e.g., | pd=;id;). Additionally, for consistency with other pipelines in this PR, the artifact download should be performed within the utils container, which also makes the script cleaner by using dir("bin") instead of cd bin.

                    container("utils") {
                        dir("bin") {
                            retry(3) {
                                sh label: 'download binary', script: """
                                    ${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh --pd=${OCI_TAG_PD} --tikv=${OCI_TAG_TIKV}
                                """
                            }
                        }
                    }

pipelines/pingcap/tidb/release-8.5/pull_check2.groovy (66-68)

security-critical critical

The PR title (REFS.pulls[0].title) is used to compute OCI tags (OCI_TAG_PD, OCI_TAG_TIKV) which are then interpolated into a shell script executed via the sh step. Since the PR title is untrusted and the tag computation in component.computeArtifactOciTagFromPR does not sufficiently sanitize shell metacharacters (it only excludes whitespace and backslash), an attacker can inject arbitrary commands into the Jenkins pipeline by crafting a malicious PR title (e.g., feat: something | pd=;id;). This leads to Command Injection on the Jenkins agent.

pipelines/pingcap/tidb/release-8.5/pull_integration_common_test.groovy (76-78)

security-critical critical

The PR title (REFS.pulls[0].title) is used to compute OCI tags which are then interpolated into a shell script. This allows for command injection via a malicious PR title. An attacker could use a title like | pd=;id; to execute arbitrary commands on the Jenkins agent.

pipelines/pingcap/tidb/release-8.5/pull_integration_copr_test.groovy (76-78)

security-critical critical

The PR title (REFS.pulls[0].title) is used to compute OCI tags which are then interpolated into a shell script. This allows for command injection via a malicious PR title. An attacker could use a title like | pd=;id; to execute arbitrary commands on the Jenkins agent.

pipelines/pingcap/tidb/release-8.5/pull_integration_ddl_test.groovy (78-80)

security-critical critical

The PR title (REFS.pulls[0].title) is used to compute OCI tags which are then interpolated into a shell script. This allows for command injection via a malicious PR title. An attacker could use a title like | pd=;id; to execute arbitrary commands on the Jenkins agent.

pipelines/pingcap/tidb/release-8.5/pull_integration_jdbc_test.groovy (75-77)

security-critical critical

The PR title (REFS.pulls[0].title) is used to compute OCI tags which are then interpolated into a shell script. This allows for command injection via a malicious PR title. An attacker could use a title like | pd=;id; to execute arbitrary commands on the Jenkins agent.

pipelines/pingcap/tidb/release-8.5/pull_integration_mysql_test.groovy (76-78)

security-critical critical

The PR title (REFS.pulls[0].title) is used to compute OCI tags which are then interpolated into a shell script. This allows for command injection via a malicious PR title. An attacker could use a title like | pd=;id; to execute arbitrary commands on the Jenkins agent.

pipelines/pingcap/tidb/release-8.5/pull_integration_nodejs_test.groovy (74-76)

security-critical critical

The PR title (REFS.pulls[0].title) is used to compute OCI tags which are then interpolated into a shell script. This allows for command injection via a malicious PR title. An attacker could use a title like | pd=;id; to execute arbitrary commands on the Jenkins agent.

pipelines/pingcap/tidb/release-8.5/pull_integration_python_orm_test.groovy (72-74)

security-critical critical

The PR title (REFS.pulls[0].title) is used to compute OCI tags which are then interpolated into a shell script. This allows for command injection via a malicious PR title. An attacker could use a title like | pd=;id; to execute arbitrary commands on the Jenkins agent.

pipelines/pingcap/tidb/release-8.5/pull_integration_tidb_tools_test.groovy (82-84)

security-critical critical

The PR title (REFS.pulls[0].title) is used to compute OCI tags which are then interpolated into a shell script. This allows for command injection via a malicious PR title. An attacker could use a title like | pd=;id; to execute arbitrary commands on the Jenkins agent.

pipelines/pingcap/tidb/release-8.5/pull_build.groovy (64-86)

high

This change removes the logic for packaging and uploading the tidb-server build artifact. This is a significant functional change for the pull_build pipeline, as it will no longer publish its primary artifact for other jobs to consume. While this aligns with migrating away from fileserver.pingcap.net, it implies a shift in the CI workflow where downstream jobs might need to build tidb-server from source themselves, potentially increasing overall CI execution time. Was this change in workflow intended?

@ti-chi-bot
Copy link
Collaborator

ti-chi-bot commented Mar 5, 2026

Jenkins Replay Status

…-from-4274

# Conflicts:
#	pipelines/pingcap/tidb/release-8.5/pull_check2.groovy
#	pipelines/pingcap/tidb/release-8.5/pull_e2e_test.groovy
Copy link

@ti-chi-bot ti-chi-bot bot left a comment

Choose a reason for hiding this comment

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

I have already done a preliminary review for you, and I hope to help you do a better job.

Summary

This PR migrates the artifact download process for release-8.5 pipelines of PingCAP's TiDB repository from fileserver.pingcap.net to OCI-based artifact retrieval via the utils container. The changes span YAML and Groovy files, introducing OCI-specific configurations and removing legacy file server dependencies. The implementation aligns with existing patterns in the latest jobs and replaces hardcoded artifact URLs with dynamic OCI tags. The approach is consistent and clean but introduces opportunities for optimization and enhancements in configurability and error handling.


Critical Issues

  • Insufficient Error Handling During Artifact Download
    • Files: Multiple Groovy files (e.g., pull_check2.groovy, pull_common_test.groovy)
    • Lines: Artifact download steps using download_pingcap_oci_artifact.sh
    • Issue: The retry mechanism in case of failure (retry(3)) is helpful but lacks detailed error reporting if retries fail. Failures could be due to network issues, authentication problems, or incorrect OCI tags, but no specific error messages are logged.
    • Suggestion: Enhance error handling by capturing the output of download_pingcap_oci_artifact.sh and logging it for debugging:
      retry(3) {
          sh label: 'download tidb components', script: """
              ${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh \
              --pd=${OCI_TAG_PD} --tikv=${OCI_TAG_TIKV} || echo "Artifact download failed. Check OCI_TAG_PD=${OCI_TAG_PD} and OCI_TAG_TIKV=${OCI_TAG_TIKV}"
          """
      }

Code Improvements

  • Hardcoded OCI Host Configuration

    • Files: Multiple Groovy files
    • Lines: environment { OCI_ARTIFACT_HOST = 'hub-zot.pingcap.net/mirrors/hub' }
    • Issue: The OCI host URL is hardcoded across all pipelines. If the host changes, updating all files individually will be error-prone.
    • Suggestion: Extract the host URL into a centralized configuration file or environment variable that can be reused across pipelines:
      environment {
          OCI_ARTIFACT_HOST = env.OCI_ARTIFACT_HOST ?: 'hub-zot.pingcap.net/mirrors/hub'
      }
  • Duplicated Artifact Download Logic

    • Files: Multiple Groovy files (e.g., pull_check2.groovy, pull_common_test.groovy, etc.)
    • Lines: Artifact download steps using download_pingcap_oci_artifact.sh
    • Issue: The artifact download logic is repeated across pipelines, increasing maintenance overhead.
    • Suggestion: Extract the artifact download logic into a shared pipeline step or a reusable function:
      def downloadArtifacts(String workspace, String pdTag, String tikvTag) {
          sh label: 'download tidb components', script: """
              ${workspace}/scripts/artifacts/download_pingcap_oci_artifact.sh \
              --pd=${pdTag} --tikv=${tikvTag}
          """
      }
      Replace individual calls with:
      container("utils") {
          dir("bin") {
              retry(3) {
                  downloadArtifacts(WORKSPACE, OCI_TAG_PD, OCI_TAG_TIKV)
              }
          }
      }

Best Practices

  • Missing Documentation for OCI Tags

    • Files: Multiple Groovy files
    • Lines: final OCI_TAG_PD, final OCI_TAG_TIKV
    • Issue: The computation of OCI tags is not documented, making it unclear to future developers how these tags are derived or validated.
    • Suggestion: Add comments explaining the logic for computeArtifactOciTagFromPR:
      // Computes the OCI tag for the given component based on the base reference,
      // pull request title, and target branch. Ensure the base_ref and title are valid.
      final OCI_TAG_PD = component.computeArtifactOciTagFromPR('pd', REFS.base_ref, REFS.pulls[0].title, 'master')
  • Testing Coverage

    • Files: Scripts like download_pingcap_oci_artifact.sh used in pipelines
    • Issue: No information is provided about testing the artifact download script with various OCI tags and environments.
    • Suggestion: Ensure the script is tested with both valid and invalid tags, network disruptions, and authentication errors. Add unit tests or mock tests for the script in the repository.
  • Resource Allocation in YAML Files

    • Files: Multiple pod configuration YAML files (e.g., pod-pull_check2.yaml, pod-pull_e2e_test.yaml)
    • Lines: resources { requests: { memory: 256Mi, cpu: 100m }, limits: { cpu: "1", memory: 4Gi } }
    • Issue: Resource requests and limits for the utils container are consistent across all files but might not reflect actual requirements.
    • Suggestion: Verify if the specified resources (e.g., memory: 256Mi, cpu: 100m) match the usage patterns of the utils container. Excessive allocation can lead to inefficient resource utilization.

Summary of Recommendations

  1. Improve error handling and logging for artifact downloads to aid debugging.
  2. Centralize the OCI host configuration to reduce duplication.
  3. Refactor repeated artifact download steps into reusable functions.
  4. Document tag computation logic for clarity and maintainability.
  5. Verify resource allocations in YAML files and adjust if needed.
  6. Ensure testing coverage for download scripts under various conditions.

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Mar 5, 2026

Replay focus verification for 6 non-optional release-8.5 jobs has been re-run with gawk-compatible env (to fix inline pod-yaml preprocessing on macOS awk).

Current snapshot:

  • pull_build replay #4346: BUILDING
  • pull_check2 replay #4820: FAILURE (next retry pending in the running replay loop)
  • pull_mysql_test replay #4634: BUILDING
  • pull_unit_test replay #5457: BUILDING
  • pull_unit_test_ddlv1 replay #1417: BUILDING
  • pull_br_integration_test replay #1768: BUILDING

Live task-item status is continuously updated in the marker comment (<!-- jenkins-replay-status -->).

Move to agent none and use per-stage Kubernetes agents for isolation.
Checkout into REFS.repo and standardize binary cache key via
prow.getCacheKey('binary', REFS). Reduce retries for artifact downloads,
simplify container usage, add comment for OCI_ARTIFACT_HOST, and remove
Debug and post-reporting steps to streamline the pipeline.
Copy link

@ti-chi-bot ti-chi-bot bot left a comment

Choose a reason for hiding this comment

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

I have already done a preliminary review for you, and I hope to help you do a better job.

Summary

This pull request migrates artifact downloads for the release-8.5 pipelines of the PingCAP/TiDB project from a legacy file server (fileserver.pingcap.net) to OCI-based artifact pulls. The implementation aligns with previously updated latest pipelines by introducing OCI tags and utilizing a shared script (download_pingcap_oci_artifact.sh) within a dedicated utils container. Overall, the PR is well-structured and achieves the intended migration, but some improvements are suggested to enhance maintainability, reduce redundancy, and ensure better error handling.


Critical Issues

None identified. The changes appear logically correct, and no security vulnerabilities or performance bottlenecks are evident. Validation for Jenkinsfile changes has been performed, reducing risk of regressions.


Code Improvements

  1. Redundant OCI Tag Computation:

    • Files: All .groovy pipeline files (e.g., pull_check2.groovy, pull_common_test.groovy, etc.)
    • Issue: OCI_TAG_PD and OCI_TAG_TIKV are computed redundantly in each pipeline file. This logic could be centralized to improve maintainability and reduce duplication.
    • Suggestion: Move OCI tag computation to a shared helper method or script, which can be imported or invoked across pipelines. Example:
      final OCI_TAGS = component.computeArtifactOciTags(REFS.base_ref, REFS.pulls[0].title, 'master')
  2. Error Handling for Artifact Download:

    • Files: All .groovy pipeline files where download_pingcap_oci_artifact.sh is invoked (e.g., pull_check2.groovy, pull_common_test.groovy, etc.)
    • Issue: The script invocation lacks proper error handling. A failed retry could result in silent pipeline failure or misbehavior.
    • Suggestion: Add explicit error checks after script execution. Example:
      sh label: "download tidb components", script: """
          ${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh --pd=${OCI_TAG_PD} --tikv=${OCI_TAG_TIKV}
      """
      if (currentBuild.result == 'FAILURE') {
          error("Artifact download failed")
      }
  3. Resource Requests for utils Container:

    • Files: YAML files (e.g., pod-pull_check2.yaml, pod-pull_integration_common_test.yaml)
    • Issue: The utils container requests 256Mi memory while limiting to 4Gi. This discrepancy could lead to over-allocation. Additionally, CPU requests (100m) are low compared to the 1 core limit.
    • Suggestion: Reassess resource requests and limits for the utils container based on actual usage patterns. Consider balanced values like:
      resources:
        requests:
          memory: 1Gi
          cpu: 500m
        limits:
          memory: 2Gi
          cpu: 1

Best Practices

  1. Script Invocation Path Consistency:

    • Files: All .groovy files using download_pingcap_oci_artifact.sh
    • Issue: The script's path (${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh) is hardcoded, which may lead to issues with workspace changes.
    • Suggestion: Use a configurable path or ensure the script is verified to exist before invocation:
      if (!fileExists("${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh")) {
          error("Artifact download script is missing")
      }
  2. Documentation for New Environment Variables:

    • Files: All .groovy files where OCI_ARTIFACT_HOST is introduced.
    • Issue: The purpose of OCI_ARTIFACT_HOST is not documented. Future maintainers may face difficulty understanding its role.
    • Suggestion: Add comments explaining the variable's purpose and usage. Example:
      // OCI_ARTIFACT_HOST: Cache mirror for OCI artifact pulls to improve performance
      environment {
          OCI_ARTIFACT_HOST = 'hub-zot.pingcap.net/mirrors/hub'
      }
  3. Testing Coverage:

    • Files: All pipeline files.
    • Issue: The validation step covers Jenkinsfile syntax, but there is no mention of functional testing for the artifact download logic.
    • Suggestion: Add unit or integration tests for download_pingcap_oci_artifact.sh to ensure correct behavior when pulling artifacts. Simulated tests for failure scenarios (e.g., invalid tags or network issues) should also be included.
  4. Naming Conventions:

    • Files: .groovy pipeline files.
    • Issue: Variable names like OCI_TAG_PD and OCI_TAG_TIKV are clear but inconsistent with OCI_ARTIFACT_HOST. Consider uniform naming conventions, e.g., OCI_PD_TAG, OCI_TIKV_TAG.

By addressing these improvement opportunities, the PR can achieve greater maintainability, robustness, and alignment with best practices.

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Mar 5, 2026

Replay follow-up final snapshot (focused 6 non-optional release-8.5 jobs):

Status marker comment has been updated to final (success=5, failure=1, running=0).

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Mar 5, 2026

Retried pull_check2 replay with updated pipeline Groovy.

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Mar 5, 2026

Update: replay pull_check2 #4825 has already completed and failed.

Copy link

@ti-chi-bot ti-chi-bot bot left a comment

Choose a reason for hiding this comment

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

I have already done a preliminary review for you, and I hope to help you do a better job.

Summary

This pull request migrates the artifact download mechanism for the release-8.5 pipelines of the PingCAP TiDB project from fileserver.pingcap.net to OCI. The approach uses the download_pingcap_oci_artifact.sh script and incorporates a new utils container for downloading artifacts. The changes span multiple YAML and Groovy pipeline files, ensuring consistency across the migration. The PR is generally well-organized, but there are areas that could benefit from improvements to error handling, resource allocation, and documentation.


Critical Issues

  1. Error Handling in Artifact Download (Groovy Files):

    • Files: All modified .groovy files (e.g., pipelines/pingcap/tidb/release-8.5/pull_check2.groovy at line 50).
    • Issue: The artifact download script (download_pingcap_oci_artifact.sh) is wrapped in a retry mechanism, but no specific error handling logic is present to ensure recoverability or clarity in case of persistent failures.
    • Suggested Solution:
      Add error logging and diagnostic information after retry attempts fail:
      retry(3) {
          sh label: 'download tidb components', script: """
              ${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh --pd=${OCI_TAG_PD} --tikv=${OCI_TAG_TIKV} || echo "Artifact download failed for PD or TiKV. Check network connectivity or artifact availability."
          """
      }
  2. Resource Allocation for utils Container (YAML Files):

    • Files: All modified .yaml files (e.g., pipelines/pingcap/tidb/release-8.5/pod-pull_check2.yaml at line 6).
    • Issue: The utils container is assigned resource limits of 4Gi memory and 1 CPU. Depending on the expected workload, this could be excessive or insufficient. Resource usage should be benchmarked to ensure optimal allocations.
    • Suggested Solution:
      Investigate actual resource requirements during artifact download and adjust limits. For example:
      resources:
        requests:
          memory: 128Mi
          cpu: 100m
        limits:
          cpu: "500m"
          memory: 2Gi

Code Improvements

  1. Centralize OCI Tag Computation:

    • Files: All modified .groovy files (e.g., pipelines/pingcap/tidb/release-8.5/pull_check2.groovy at lines 7–8).
    • Issue: The OCI_TAG_* computation logic is repeated across multiple pipeline files, increasing maintenance complexity.
    • Suggested Solution:
      Move the OCI tag computation logic to a shared Groovy utility function or module:
      def computeOciTags(refs) {
          return [
              pd: component.computeArtifactOciTagFromPR('pd', refs.base_ref, refs.pulls[0].title, 'master'),
              tikv: component.computeArtifactOciTagFromPR('tikv', refs.base_ref, refs.pulls[0].title, 'master')
          ]
      }
  2. Remove Unused Debug Code:

    • Files: pipelines/pingcap/tidb/release-8.5/pull_build.groovy at lines 17–92.
    • Issue: Stages like Debug info and redundant archiveArtifacts steps are removed. While this is intentional, it would be better to replace them with concise logging or diagnostics for pipeline validation and debugging.
    • Suggested Solution:
      Add minimal debug information, such as a single environment variable dump for critical parameters:
      stage('Debug info') {
          steps {
              sh label: 'Print Environment Variables', script: 'printenv | grep -E "OCI_TAG|K8S_NAMESPACE|JOB_NAME"'
          }
      }

Best Practices

  1. Testing Coverage:

    • Files: All modified .groovy and .yaml files.
    • Issue: The PR description mentions validation via verify-jenkins-pipeline-file.sh, but there is no mention of functional tests for artifact downloads.
    • Suggested Solution:
      Add integration tests to verify OCI artifact downloads and ensure compatibility across different scenarios.
  2. Documentation for Resource Changes:

    • Files: All modified .yaml files.
    • Issue: Resource changes for the utils container are not documented, leaving ambiguity around why these specific limits were chosen.
    • Suggested Solution:
      Add comments in the YAML files to explain resource configurations:
      resources:
        requests:
          memory: 256Mi  # Minimum memory required for artifact download operations
          cpu: 100m      # Low CPU usage expected
        limits:
          cpu: "1"       # Upper bound for heavy workloads
          memory: 4Gi    # Set to handle large artifact downloads
  3. Streamline Naming Conventions:

    • Files: All .groovy and .yaml files.
    • Issue: Variable names like OCI_TAG_PD and OCI_TAG_TIKV could be generalized for better readability and extensibility.
    • Suggested Solution:
      Use a more generic naming convention:
      def ociTags = computeOciTags(REFS)
      sh label: 'download tidb components', script: """
          ${WORKSPACE}/scripts/artifacts/download_pingcap_oci_artifact.sh --pd=${ociTags.pd} --tikv=${ociTags.tikv}
      """
  4. Eliminate Code Duplication:

    • Files: Multiple .groovy files (e.g., pull_check2.groovy, pull_common_test.groovy).
    • Issue: Identical logic for OCI artifact downloads is repeated across many pipelines.
    • Suggested Solution:
      Extract common functionality into reusable methods or a shared pipeline step library.

Conclusion

This PR is well-structured and introduces necessary changes to migrate pipelines to OCI artifact downloads. However, addressing error handling, resource allocation, testing, and code reuse will enhance reliability, maintainability, and clarity.

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Mar 5, 2026

Identified and fixed the pod-yaml root cause for pull_check2 replay failure.

Root cause from replay #4825 log:

  • utils was accidentally placed under spec.volumes (invalid volume schema), causing Kubernetes plugin YAML parse failure.

Fix:

  • commit: f05aa04c
  • file: pipelines/pingcap/tidb/release-8.5/pod-pull_check2.yaml
  • change: move utils from volumes to containers.

Validation replay after fix:

Also updated the marker status comment to reflect this retry.

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Mar 5, 2026

/approve

@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 5, 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 approved label Mar 5, 2026
@PingCAP-QE PingCAP-QE deleted a comment from ti-chi-bot Mar 5, 2026
@ti-chi-bot ti-chi-bot bot merged commit 7e533e9 into main Mar 5, 2026
4 of 5 checks passed
@ti-chi-bot ti-chi-bot bot deleted the split/release-8.5-oci-from-4274 branch March 5, 2026 07:01
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 pingcap/tidb on release-8.5

2 participants