Skip to content

fix(pipelines/tiflash): adjust pull_unit_test pod resources and ccache location - #5064

Open
wuhuizuo wants to merge 1 commit into
mainfrom
pipelines/tiflash-fix-unit-test-ccache
Open

fix(pipelines/tiflash): adjust pull_unit_test pod resources and ccache location#5064
wuhuizuo wants to merge 1 commit into
mainfrom
pipelines/tiflash-fix-unit-test-ccache

Conversation

@wuhuizuo

@wuhuizuo wuhuizuo commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Adjust the tiflash pull_unit_test pipeline so the job can run reliably:

  • Move ccache cache directory from the ephemeral /tmp to the workspace volume ($WORKSPACE/.ccache), so the cache survives the pod and is not limited by pod resource constraints.
  • Remove the customWorkspace override so the default workspace volume is used consistently.
  • In the pod template, switch container resource requests to limits and drop the unused tmp emptyDir volume.

What is changed and how it works?

  • pipelines/pingcap/tiflash/latest/pull_unit_test.groovy
  • pipelines/pingcap/tiflash/latest/pod-pull_unit-test.yaml

Related changes

None.

Check List

  • No formatting changes
  • No documentation changes

…e location

Remove custom workspace and move ccache to the workspace volume, switch
pod resource requests to limits and drop the unused tmp emptyDir volume.
@ti-chi-bot

ti-chi-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lloyd-pottiger for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found 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 size/S label Sep 1, 2026

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

Copy link
Copy Markdown

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 improves the reliability of the tiflash pull_unit_test pipeline by moving the ccache directory to a persistent workspace volume, removing unnecessary workspace overrides, and adjusting pod resource definitions. The approach is straightforward and focuses on configuration changes to pod templates and pipeline scripts. Overall, the changes are concise and align with the stated goals, but a few improvements can be made regarding resource specification clarity and error handling.


Code Improvements

  • Resource Limits vs Requests (pod-pull_unit-test.yaml, lines ~15-20):
    The PR changes requests to limits for CPU and memory. This can cause pods to be evicted or fail to schedule if the cluster cannot guarantee these limits. Usually, requests specify guaranteed resources, while limits cap usage.

    • Why: Using limits without requests can lead to unstable scheduling or OOM kills.
    • Suggestion: Specify both requests and limits to ensure stable scheduling and resource capping, for example:
      resources:
        requests:
          memory: "24Gi"
          cpu: "6"
        limits:
          memory: "24Gi"
          cpu: "6"

    This approach balances resource guarantees and control.

  • Remove commented-out ephemeral-storage request (pod-pull_unit-test.yaml, line ~17):
    If ephemeral-storage limits are required, consider adding explicit requests and limits for ephemeral-storage to avoid pod eviction due to disk pressure.

  • customWorkspace removal (pull_unit_test.groovy, line ~18):
    Removing customWorkspace is reasonable for consistency, but validate that no downstream steps rely on the old path /home/jenkins/agent/workspace/tiflash-build-common.

    • Suggestion: Add a quick check or comment to ensure no hardcoded paths are broken.
  • Shell script quoting style (pull_unit_test.groovy, lines ~49-58):
    The change from triple double quotes (""") to triple single quotes (''') is fine, but consider consistent style across the repo. Also, the use of $WORKSPACE inside single quotes may not expand in some Groovy contexts.

    • Why: Single quotes prevent variable interpolation in Groovy strings.
    • Suggestion: Use double quotes or explicitly expand the variable, e.g.:
      sh label: "config ccache", script: """
        ccache -o cache_dir="\$WORKSPACE/.ccache"
        ...
      """

    Or use Groovy string interpolation if supported.

  • Error handling for ccache commands (pull_unit_test.groovy, lines ~49-58):
    The script runs multiple ccache configuration commands. Consider adding error checking or fail-fast behavior if any command fails.

    • Suggestion: Use set -e or chain commands with &&, e.g.:
      set -e
      ccache -o cache_dir="$WORKSPACE/.ccache" &&
      ccache -o max_size=2G &&
      ...

    This prevents silent failures.


Best Practices

  • Documentation update for workspace change (pull_unit_test.groovy, line ~18):
    Since customWorkspace is removed, add a brief comment explaining that the default workspace volume is now used for consistency and persistence.

  • Testing coverage:
    Ensure that pipeline runs are tested after this change to verify that ccache caching works correctly and resources are respected. This may not be in the code but should be part of the PR validation.

  • Comment on resource rationale (pod-pull_unit-test.yaml, lines ~12-20):
    Add comments explaining why the resource limits are set to these values to help future maintainers understand the reasoning behind these settings.


Summary of actionable suggestions

# pipelines/pingcap/tiflash/latest/pod-pull_unit-test.yaml (resource block)
resources:
  requests:
    memory: "24Gi"
    cpu: "6"
  limits:
    memory: "24Gi"
    cpu: "6"
# Add ephemeral-storage requests/limits if necessary
// pipelines/pingcap/tiflash/latest/pull_unit_test.groovy (ccache config block)
sh label: "config ccache", script: """
    set -e
    ccache -o cache_dir="\$WORKSPACE/.ccache" &&
    ccache -o max_size=2G &&
    ccache -o hash_dir=false &&
    ccache -o compression=true &&
    ccache -o compression_level=6 &&
    ccache -o read_only=false &&
    ccache -z
"""
// pipelines/pingcap/tiflash/latest/pull_unit_test.groovy (near line 18)
// Removed customWorkspace to standardize workspace volume usage for persistent caching and resource management

Addressing these points will improve stability, maintainability, and clarity of the pipeline configuration.

@wuhuizuo

wuhuizuo commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins Replay Status

Summary: success=0, failure=1, building=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant