Skip to content

feat(dockerfiles/ci/tici): update tici Dockerfile for installing yq and oras tools#905

Merged
ti-chi-bot[bot] merged 5 commits intoPingCAP-QE:mainfrom
lybcodes:feature/update-tici-dockerfile
Mar 3, 2026
Merged

feat(dockerfiles/ci/tici): update tici Dockerfile for installing yq and oras tools#905
ti-chi-bot[bot] merged 5 commits intoPingCAP-QE:mainfrom
lybcodes:feature/update-tici-dockerfile

Conversation

@lybcodes
Copy link
Copy Markdown
Contributor

@lybcodes lybcodes commented Mar 2, 2026

local test docker build:
image
image
image

Signed-off-by: lyb <yebin.li@pingcap.com>
@gemini-code-assist
Copy link
Copy Markdown
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 updates the tici CI Docker image to incorporate essential tools, yq and oras. This enhancement provides the necessary capabilities for YAML processing and OCI registry interactions within the CI environment, thereby supporting more robust and efficient build and deployment pipelines.

Highlights

  • Tool Installation: The tici Dockerfile now includes the installation of yq (YAML processor) and oras (OCI Registry As Storage) tools, ensuring these utilities are available in the CI environment.
  • Version Control for Tools: Specific versions for yq (v4.52.2) and oras (v1.3.0) are defined as build arguments, allowing for controlled updates and consistency.
Changelog
  • dockerfiles/ci/tici/Dockerfile
    • Added installation logic for yq and oras tools.
    • Introduced ARG declarations for YQ_VERSION and ORAS_VERSION.
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.

@pingcap-cla-assistant
Copy link
Copy Markdown

pingcap-cla-assistant Bot commented Mar 2, 2026

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot Bot added the size/S label Mar 2, 2026
Copy link
Copy Markdown

@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 updates the tici Dockerfile to install two additional CLI tools: yq and oras. The approach adds arguments for version control and uses conditional architecture selection to download the appropriate binaries, followed by installation and cleanup steps. The overall quality is reasonable, but there are some critical issues around environment variables, error handling, and cleanup that could impact maintainability and robustness.


Critical Issues

  • Undefined $OS variable (dockerfiles/ci/tici/Dockerfile lines 18-27)

    • The curl commands reference ${OS} but this variable is never defined in the Dockerfile, which will cause the downloads to fail.
    • Fix: Define the OS variable similarly to ARCH, e.g.:
      ARG OS=linux
      or
      RUN OS=$(uname | tr '[:upper:]' '[:lower:]')
      Ensure $OS matches the naming convention used by the yq and oras binaries (usually "linux" or "darwin").
  • Potential failure without set -e or error checking (dockerfiles/ci/tici/Dockerfile lines 18-27)

    • If any curl or tar command fails, the Docker build may continue without immediate failure, resulting in incomplete or broken installations.
    • Fix: Add set -euxo pipefail at the start of the RUN command to ensure failures cause the build to stop:
      RUN set -euxo pipefail; \
          ARCH=...; \
          OS=...; \
          ...
    • Alternatively, split the RUN commands to catch errors earlier.

Code Improvements

  • Version argument defaulting and usage (dockerfiles/ci/tici/Dockerfile lines 16-17, 19-22)

    • The PR uses ARGs for versions but does not document or set defaults explicitly other than in the Dockerfile.
    • Consider adding comments explaining version variables or providing a fallback default in the build command.
  • Cleanup of intermediate files (dockerfiles/ci/tici/Dockerfile line 26)

    • The rm -rf command removes downloaded tarballs and extracted directories, which is good.
    • Consider using a single temporary directory (e.g., /tmp/oras-install) to avoid potential conflicts or clutter and to better isolate installation artifacts.
  • Use --location instead of -LO for curl consistency

    • The first curl uses -fsSL, the second uses -LO. Consider using consistent flags for readability and error handling:
      curl -fsSL -o ...

Best Practices

  • Add comments describing the steps (dockerfiles/ci/tici/Dockerfile lines 18-27)

    • Add comments describing what each step is doing, e.g.:
      # Download and install yq binary
      # Download, extract, and install oras tool
  • Testing coverage

    • No tests or validation are included to verify installation success or tool versions.
    • Consider adding a RUN yq --version && oras version step after installation to verify tools are installed correctly.
  • Naming and style

    • The comment line # yq、oras tool uses a non-standard comma character (), replace it with a comma or "and" for consistency:
      # yq and oras tools

Summary of suggested Dockerfile snippet improvements:

ARG YQ_VERSION=v4.52.2
ARG ORAS_VERSION=v1.3.0
ARG OS=linux

RUN set -euxo pipefail; \
    ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
    # Download and install yq
    curl -fsSL "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_${OS}_${ARCH}" -o /usr/local/bin/yq; \
    chmod +x /usr/local/bin/yq; \
    # Download, extract, and install oras
    curl -fsSL "https://github.com/oras-project/oras/releases/download/${ORAS_VERSION}/oras_${ORAS_VERSION#?}_${OS}_${ARCH}.tar.gz" -o /tmp/oras.tar.gz; \
    mkdir -p /tmp/oras-install; \
    tar -zxf /tmp/oras.tar.gz -C /tmp/oras-install; \
    install /tmp/oras-install/oras /usr/local/bin/; \
    rm -rf /tmp/oras.tar.gz /tmp/oras-install; \
    # Verify installations
    yq --version; \
    oras version

This ensures the build fails on errors, uses defined OS variable, isolates temp files, and verifies the installation.

Copy link
Copy Markdown
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 adds yq and oras tools to the tici Docker image. My review focuses on improving the installation method. I've suggested replacing the complex RUN command with Docker's multi-stage build feature (COPY --from), which is a cleaner, more maintainable, and idiomatic approach for including binaries from other Docker images. This also aligns with practices seen elsewhere in the repository. A minor suggestion to use English in a code comment is also included.

Comment thread dockerfiles/ci/tici/Dockerfile Outdated
@lybcodes lybcodes changed the title update tici Dockerfile for installing yq and oras tools feat(dockerfiles/ci/tici): update tici Dockerfile for installing yq and oras tools Mar 2, 2026
Signed-off-by: lyb <yebin.li@pingcap.com>
Copy link
Copy Markdown

@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 updates the dockerfiles/ci/tici/Dockerfile to install the yq and oras CLI tools by leveraging multi-stage builds from their official images. It introduces build arguments for versioning and copies the binaries from the respective images into the final image. The approach is straightforward and avoids manual installation steps, improving maintainability. Overall, the changes are clean and integrate well into the existing Dockerfile.


Code Improvements

  • File: dockerfiles/ci/tici/Dockerfile lines 1-11
    Issue: The Dockerfile uses multiple FROM instructions to import yq and oras images without naming the final stage explicitly. This can be confusing and may cause unintended behavior, as the final stage is implicitly the last FROM (which is $BASE_IMG here). However, the order of FROM statements is non-standard: yq and oras are declared before FROM $BASE_IMG, then FROM $BASE_IMG restarts a new stage. This works but is less readable.

    Suggestion: Use named stages explicitly for clarity, and place the FROM $BASE_IMG as the first stage or last stage, but clearly name all stages. For example:

    ARG BASE_IMG=ghcr.io/pingcap-qe/cd/builders/tiflash:v2024.10.8-135-g43bfc3c-centos7
    ARG YQ_VERSION=4.52.2
    ARG ORAS_VERSION=v1.3.0
    
    FROM mikefarah/yq:${YQ_VERSION} AS yq
    FROM ghcr.io/oras-project/oras:${ORAS_VERSION} AS oras
    
    FROM $BASE_IMG AS base
    
    # ... existing yum install and other RUN commands ...
    
    # Copy yq and oras from respective stages
    COPY --from=yq /usr/bin/yq /usr/local/bin/yq
    COPY --from=oras /bin/oras /usr/local/bin/oras

    This makes it clear what each stage is responsible for, improves maintainability, and prevents potential confusion.


Best Practices

  • File: dockerfiles/ci/tici/Dockerfile lines 1-7
    Issue: The version args YQ_VERSION and ORAS_VERSION are defined but not documented or defaulted clearly in the Dockerfile or PR description, which may cause confusion about how to override them.

    Suggestion: Add default versions in the Dockerfile (which you partially do), but also document how to override them when building the Dockerfile, e.g., in a comment or README snippet:

    ARG YQ_VERSION=4.52.2  # Can be overridden at build time with --build-arg YQ_VERSION=...
    ARG ORAS_VERSION=v1.3.0 # Can be overridden similarly

    Also, consider adding a short comment above the multi-stage build explaining the purpose of these stages.

  • File: dockerfiles/ci/tici/Dockerfile lines 19-22
    Issue: The PR adds the binaries but does not verify their presence or versions after copying. This can lead to subtle issues if the source images change or the binaries are missing.

    Suggestion: Add a simple verification step after copying, for example:

    RUN yq --version && oras version

    This ensures the tools are installed correctly and helps catch errors early during image build.


Minor Suggestions

  • Consider pinning the exact digest of the base images (mikefarah/yq and oras) for reproducible builds if security or stability is a concern, especially in CI.

  • The PR description is empty; adding a short summary there would help future reviewers understand the motivation and usage. For example:

    "This PR adds the latest yq and oras CLI tools to the tici CI Docker image via multi-stage builds to enable YAML processing and OCI artifact management in CI pipelines."


Overall, the PR achieves its goal with minimal changes and can be improved mainly by clarifying Dockerfile stages and adding validation steps.

@ti-chi-bot ti-chi-bot Bot added size/XS and removed size/S labels Mar 2, 2026
Signed-off-by: lyb <yebin.li@pingcap.com>
@ti-chi-bot ti-chi-bot Bot added size/S and removed size/XS labels Mar 2, 2026
Copy link
Copy Markdown

@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 updates the dockerfiles/ci/tici/Dockerfile to install the yq and oras CLI tools by building them in separate stages and copying their binaries into the final image. It uses multi-stage builds with versioned ARGs, which improves maintainability and ensures version control. Overall, the approach is clean and leverages Docker best practices for tooling installation, though a few improvements on layering and version handling can be made.


Code Improvements

  • Reducing Image Layers and Cleanup:

    • File: dockerfiles/ci/tici/Dockerfile lines 6-19
    • Issue: The current Dockerfile adds two separate stages for yq and oras and copies their binaries into the base image, which is good. However, the base image layer (RUN yum install ...) follows these copies, which means the installed tools are not cached efficiently if dependencies change. Also, the final image may include unnecessary leftover files or metadata from the base image.
    • Suggestion: Consider rearranging the Dockerfile so that the base image and its dependencies are installed first, then the binaries are copied in a later step. This improves layer caching and image size efficiency. For example:
      ARG BASE_IMG=...
      ARG YQ_VERSION=4.52.2
      ARG ORAS_VERSION=v1.3.0
      
      FROM $BASE_IMG
      
      RUN yum install -y wget lsof openssh-server openssh-clients sudo mysql protobuf-compiler perl-core openssl-devel
      
      FROM mikefarah/yq:${YQ_VERSION} AS yq
      FROM ghcr.io/oras-project/oras:${ORAS_VERSION} AS oras
      
      FROM $BASE_IMG
      
      COPY --from=yq /usr/bin/yq /usr/local/bin/yq
      COPY --from=oras /bin/oras /usr/local/bin/oras
      This way, the base image dependencies are installed once before copying the tools, reducing rebuild times.
  • Binary Path Consistency:

    • File: dockerfiles/ci/tici/Dockerfile lines 17-18
    • Issue: The yq binary is copied from /usr/bin/yq but the oras binary is copied from /bin/oras. This can be brittle if upstream images change their binary locations.
    • Suggestion: Verify and document the expected binary paths or add a check in the Dockerfile or CI to validate the presence of these binaries, or explicitly install from releases or static binaries to control paths.
  • Pinning Base Image Version:

    • File: dockerfiles/ci/tici/Dockerfile line 1
    • Issue: The base image tag includes a specific version (v2024.10.8-135-g43bfc3c-centos7), which is good for reproducibility. However, the ARG is not used in the multi-stage builds after the first FROM, which might cause inconsistencies if the base image is updated but yq/oras stages are not rebuilt.
    • Suggestion: Consider using the base image ARG consistently in all FROM statements or clarify its usage in comments.

Best Practices

  • Documentation and Comments:

    • File: dockerfiles/ci/tici/Dockerfile lines 3-7
    • Issue: While there are comments about renovate datasource for automated updates, there is no explanation about why yq and oras are added or how they are used in the CI.
    • Suggestion: Add a brief comment explaining the purpose of these tools in the CI environment to aid future maintainers:
      # Install yq for YAML processing and oras for OCI artifact management in CI
  • Testing Coverage:

    • General:
    • Issue: The PR does not mention any updates to tests or CI validation to ensure that yq and oras are correctly installed and executable in the resulting image.
    • Suggestion: Add a simple test step in the CI pipeline or Dockerfile to verify installed versions, e.g.,
      RUN yq --version && oras version
      This helps catch installation or path issues early.
  • Style and Formatting:

    • File: dockerfiles/ci/tici/Dockerfile line 2
    • Issue: There is an unnecessary blank line after the ARG declaration at the top, minor but can be removed for tidiness.
    • Suggestion: Remove extra blank lines to keep the Dockerfile concise.

Overall, the PR introduces useful tooling in a clean multi-stage build manner, but can be improved by adjusting the order of commands for better caching, adding validation steps, and clarifying the intent with comments.

Signed-off-by: lyb <yebin.li@pingcap.com>
@ti-chi-bot ti-chi-bot Bot added size/XS and removed size/S labels Mar 3, 2026
Copy link
Copy Markdown

@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 updates the dockerfiles/ci/tici/Dockerfile to include the installation of two additional CLI tools, yq (version 4.52.2) and oras (version 1.3.0), by copying their binaries from official container images. The approach uses multi-stage Docker build syntax (COPY --from=) to directly copy the binaries into the build image, avoiding manual installation steps or downloading binaries explicitly. Overall, the change is straightforward and cleanly integrates the new tools with minimal disruption to the existing Dockerfile.


Code Improvements

  • Verify binary paths from source images

    • File: dockerfiles/ci/tici/Dockerfile lines 24-27
    • The COPY --from= commands assume the binaries reside at /usr/bin/yq and /bin/oras respectively inside the source images. It’s best practice to verify these exact paths to avoid build failures. For instance, the mikefarah/yq image typically places yq at /usr/bin/yq, but oras binary location might differ depending on the image layout.
    • Suggestion: Confirm the exact binary paths in the source images by inspecting or running them. Alternatively, add a comment with the command used to verify the paths for maintainability. For example:
      # Verified oras binary path by running: docker run --rm -it ghcr.io/oras-project/oras:v1.3.0 which oras
      COPY --from=ghcr.io/oras-project/oras:v1.3.0 /bin/oras /usr/local/bin/oras
  • Make tools executable explicitly

    • File: dockerfiles/ci/tici/Dockerfile lines 24-27
    • The copied binaries might not retain executable permissions, depending on the source image's file metadata and Docker's handling. This can cause permission issues on usage.
    • Suggestion: Add a RUN chmod +x /usr/local/bin/yq /usr/local/bin/oras after copying to ensure executability:
      COPY --from=mikefarah/yq:4.52.2 /usr/bin/yq /usr/local/bin/yq
      COPY --from=ghcr.io/oras-project/oras:v1.3.0 /bin/oras /usr/local/bin/oras
      RUN chmod +x /usr/local/bin/yq /usr/local/bin/oras
  • Consider pinning base image versions explicitly

    • File: dockerfiles/ci/tici/Dockerfile line 1
    • The ARG BASE_IMG is using a specific tag with git commit hash and version, which is good for reproducibility. Just ensure this practice is consistent and documented.

Best Practices

  • Add comments explaining why these tools are needed

    • File: dockerfiles/ci/tici/Dockerfile lines 23-28
    • While the new tools yq and oras are added, there is no explanation in the Dockerfile about their intended use cases or why these specific versions are chosen.
    • Suggestion: Add a brief comment describing the purpose of these tools in the CI environment and mention the decision to vendor binaries via multi-stage copy for efficiency. For example:
      # Install yq (YAML processor) and oras (OCI registry tool) for CI tasks.
      # Binaries copied from official images to avoid manual installation.
  • Testing coverage and validation

    • The PR description shows screenshots of local test builds, which is good. Consider adding automated tests or Docker build validation steps in CI to catch any future regressions related to these tools.

Minor

  • Whitespace cleanup
    • The added blank line after ARG BASE_IMG=... is harmless but inconsistent with previous style.
    • Consider removing the extra blank line after the ARG for consistent formatting.

Summary of suggested Dockerfile snippet improvements:

ARG BASE_IMG=ghcr.io/pingcap-qe/cd/builders/tiflash:v2024.10.8-135-g43bfc3c-centos7
FROM $BASE_IMG

# Install yq (YAML processor) and oras (OCI registry tool) for CI tasks.
# Binaries copied from official images to avoid manual installation.
# renovate: datasource=docker depName=mikefarah/yq
COPY --from=mikefarah/yq:4.52.2 /usr/bin/yq /usr/local/bin/yq
# renovate: datasource=github-tags depName=oras-project/oras
COPY --from=ghcr.io/oras-project/oras:v1.3.0 /bin/oras /usr/local/bin/oras
RUN chmod +x /usr/local/bin/yq /usr/local/bin/oras

Overall, the PR introduces a useful and clean enhancement. Addressing the above points will ensure robustness and maintainability of the Dockerfile changes.

Signed-off-by: lyb <yebin.li@pingcap.com>
Copy link
Copy Markdown

@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 updates the dockerfiles/ci/tici/Dockerfile by adding installation of yq and oras CLI tools via multi-stage Docker build copy from their official container images. The approach uses the COPY --from= directive to directly copy binaries, avoiding re-downloading or rebuilding from source, which is efficient and clean. Overall, the changes are minimal, focused, and follow a good pattern for including external tools in the image.


Code Improvements

  • Pin exact binary paths and verify existence:
    The Dockerfile copies /usr/bin/yq and /bin/oras from the source images. It would be safer to verify that these paths are stable and won't change in future versions. Sometimes, upstream images might relocate binaries or use alternative paths (e.g., /usr/local/bin/oras). Consider adding a check or comment about this assumption to avoid future breakage.

  • Add executable permission assurance:
    Although unlikely, copied binaries may lose executable permission or have restrictive permissions. It's a best practice to explicitly set executable permissions after copying binaries:

    RUN chmod +x /usr/local/bin/yq /usr/local/bin/oras

    This prevents potential permission issues at runtime.

  • Consider adding --no-cache or cleaning up yum cache:
    The Dockerfile installs packages with yum but does not clean caches, which can increase image size. To optimize image size, add:

    RUN yum install -y python3 python3-devel mysql-devel && yum clean all

    Or use --no-cache if supported.


Best Practices

  • Add comments describing why these tools are needed:
    The current comments just mention "yq and oras tools" and Renovate datasource hints. Adding a short description of why these tools are included (e.g., what CI steps require them) would improve maintainability.

  • Test coverage:
    The PR description includes images of local test builds, but no automated tests or CI verification are mentioned. Consider adding a minimal smoke test or CI step that verifies yq --version and oras version run successfully in the built image. This will catch future regressions.

  • Label the Dockerfile or image metadata with tool versions:
    To improve traceability, you may add labels like:

    LABEL yq.version="4.52.2" oras.version="1.3.0"

    This helps with debugging which versions are included in the image.


Minor Suggestions

  • The Renovate datasource comments are helpful; ensure your Renovate config is set to parse and update these correctly for automated version bumps.

No critical issues were found. The PR is a clean, minimal addition that should work well with the suggested improvements.

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Mar 3, 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 3, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Mar 3, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-03-03 03:07:49.083230063 +0000 UTC m=+241113.661309247: ☑️ agreed by wuhuizuo.

@ti-chi-bot ti-chi-bot Bot added the approved label Mar 3, 2026
@ti-chi-bot ti-chi-bot Bot merged commit aebccea into PingCAP-QE:main Mar 3, 2026
8 checks passed
ti-chi-bot Bot pushed a commit to PingCAP-QE/ci that referenced this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants