Skip to content

feat: add new component in packages.yaml.tmpl for building tikv/migration image#907

Merged
ti-chi-bot[bot] merged 4 commits intoPingCAP-QE:mainfrom
lybcodes:feature/mirgete-docker-push-job
Mar 5, 2026
Merged

feat: add new component in packages.yaml.tmpl for building tikv/migration image#907
ti-chi-bot[bot] merged 4 commits intoPingCAP-QE:mainfrom
lybcodes:feature/mirgete-docker-push-job

Conversation

@lybcodes
Copy link
Contributor

@lybcodes lybcodes commented Mar 4, 2026

lybcodes added 2 commits March 4, 2026 18:35
image

Signed-off-by: lyb <yebin.li@pingcap.com>
Signed-off-by: lyb <yebin.li@pingcap.com>
@ti-chi-bot ti-chi-bot bot added the size/M label Mar 4, 2026
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 adds a new migration component in the packages.yaml.tmpl file, enabling building and releasing Docker images for tikv-br, tikv-cdc, and kafka-consumer. It also updates the CI shell script to include the migration component in relevant build and test flows. The approach is straightforward, extending existing patterns to a new component, and the changes appear coherent and consistent with current code style.


Critical Issues

  • Potential CI script version/compatibility issues

    • File: .github/scripts/ci.sh lines ~23, ~294
    • Issue: The migration component is added to the components list, but there is no conditional skip logic like for tidb-tools at version v9.0.0. If any special handling is needed for migration in CI (e.g., version exclusions or compatibility checks), it is not present.
    • Suggestion: Confirm if migration requires any special conditional handling similar to tidb-tools. If so, add appropriate skips or version guards.
  • Hardcoded builder image version

    • File: packages/packages.yaml.tmpl lines ~3269-3274
    • Issue: The migration builder image uses a fixed tag v2026.2.1-3-gb0438c3. This may cause issues with reproducibility or updates if not maintained appropriately.
    • Suggestion: Consider templating this tag or documenting update requirements. For example:
      builders:
        - image: ghcr.io/pingcap-qe/cd/utils/release:{{ .Builders.migration_tag | default "v2026.2.1-3-gb0438c3" }}

Code Improvements

  • Improve consistency with existing components

    • File: packages/packages.yaml.tmpl lines ~3263-3299
    • Issue: The migration component description and formatting slightly differ from other components (e.g., no indentation on migration: key, and the desc field uses a lowercase "tikv/migration" while others begin with uppercase).
    • Suggestion: Follow existing styling conventions, capitalize description first letter, and ensure consistent indentation:
      migration:
        desc: Tikv/Migration - tikv-br, tikv-cdc, Kafka-consumer
        git:
          # ...
  • Dockerfile paths clarity

    • File: packages/packages.yaml.tmpl lines ~3288-3299
    • Issue: The kafka-consumer image Dockerfile path is cdc/deployments/tikv-cdc/docker/kafka-consumer.Dockerfile which differs in filename style (capitalized .Dockerfile). Ensure this naming is correct and consistent with project conventions to avoid confusion or build errors.
    • Suggestion: Verify dockerfile naming conventions and align with existing ones like Dockerfile or dockerfile.

Best Practices

  • Add comments to CI script updates

    • File: .github/scripts/ci.sh lines ~23 and ~294
    • Issue: Components list is updated in two places. There is no comment explaining why migration is added or its scope in the build/test matrix.
    • Suggestion: Add brief comments to clarify the addition, e.g.:
      # Added migration component for tikv migration image builds
      local components="tidb tiflow tiflash tikv pd ctl monitoring ng-monitoring tidb-tools migration"
  • Testing coverage

    • The PR description references closing an issue but does not mention any added or updated tests for the new migration component.
    • Suggestion: Ensure there are corresponding tests or CI jobs validating the new migration component images are built correctly. If not present, add integration tests or smoke tests to verify image build success.

Overall, the PR is a well-structured addition of a new component with minor areas for improvement in documentation, consistency, and CI robustness. Addressing these points will improve maintainability and reliability.

@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 integrates the tikv/migration project into the existing CI/CD system by defining it as a new component. This integration allows for automated building and management of its associated Docker images, streamlining the release process and ensuring consistent deployment of tikv-br, tikv-cdc, and kafka-consumer images.

Highlights

  • New Component Added: A new component named 'migration' has been introduced into the packages.yaml.tmpl configuration, enabling the system to manage and build images for the tikv/migration project.
  • Image Definitions for Migration: The 'migration' component defines build configurations for three Docker images: tikv-br, tikv-cdc, and kafka-consumer, sourcing from the tikv/migration GitHub repository.
  • CI Script Updates: The ci.sh script has been updated to include 'migration' in the lists of components for both test_get_builder and test_gen_package_images_script functions, ensuring it's part of the CI/CD pipeline for testing and image generation.
Changelog
  • .github/scripts/ci.sh
    • Added 'migration' to the components variable in test_get_builder function.
    • Added 'migration' to the components variable in test_gen_package_images_script function.
  • packages/packages.yaml.tmpl
    • Added a new top-level 'migration' component definition.
    • Configured the 'migration' component to pull from https://github.com/tikv/migration.git.
    • Defined three artifacts (Docker images: tikv-br, tikv-cdc, kafka-consumer) with their respective repositories, contexts, and Dockerfiles under the 'migration' component.
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 adds a new migration component to the build configuration. The changes include updating a test script to include this new component and defining the component's build properties in packages.yaml.tmpl. My review focuses on the new component definition. I've identified an issue with image tagging which could lead to builds overwriting each other and have suggested a fix to align with existing conventions and ensure build uniqueness.

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 introduces a new component migration in packages.yaml.tmpl for building TiKV/migration related images (tikv-br, tikv-cdc, kafka-consumer) and adds corresponding CI test invocations in .github/scripts/ci.sh. The approach extends existing patterns for adding new components with OS/architecture/version loops and validation checks. Overall, the additions are straightforward and consistent with existing code style, but some improvements in test robustness and template clarity could be made.


Critical Issues

  • CI Script Testing Invocation May Be Incomplete or Incorrect
    In .github/scripts/ci.sh at lines ~399-410, the script runs the migration build with fixed dummy branch and sha parameters:

    $script "$cm" linux "$ac" "$version" "$profile" branch-xxx 123456789abcdef
    shellcheck -S error packages/scripts/build-package-images.sh
    • The use of fixed "branch-xxx" and "123456789abcdef" without context may cause tests to not reflect real scenarios or mask errors.
    • Running shellcheck on the build script here seems unrelated to the migration build test and might be misplaced.

    Suggestion:

    • Use realistic or parameterized git refs and shas matching the new component context or derive them dynamically.
    • Move the shellcheck invocation out of the loop or into a dedicated linting step.
    • Add error checking after $script invocation to catch failures explicitly.

Code Improvements

  • Add Variable for Supported Architectures in packages.yaml.tmpl
    The migration component supports amd64 and arm64, but these architectures are hardcoded in the routers section. It would be better to define supported architectures as a variable or top-level parameter in the template to avoid duplication and ease future maintenance.

  • Clarify Dockerfile Context and Paths in Migration Component
    The template defines three artifacts with different contexts and dockerfiles:

    context: br
    dockerfile: deployments/docker/Dockerfile
    ...
    context: cdc
    dockerfile: deployments/tikv-cdc/docker/Dockerfile
    ...
    dockerfile: deployments/tikv-cdc/docker/kafka-consumer.Dockerfile
    • It's not clear if these relative paths are correct or if the contexts align with dockerfile locations.
    • Consider adding comments or validating paths to avoid build failures due to incorrect contexts.
  • Improve Shell Script Logging
    The echo -en lines in .github/scripts/ci.sh could be improved by adding timestamps or more descriptive logs to facilitate debugging.

  • Error Handling for Image Existence Check
    check_image_existed $img is called but no failure handling is shown. Consider adding explicit exit or retry logic if image check fails.


Best Practices

  • Lack of Documentation in Template
    The new migration component in packages.yaml.tmpl lacks comments explaining what each field means, especially the routers and builders sections. Adding brief comments would aid maintainability.

  • Test Coverage for Migration Component
    The CI script adds basic invocation tests but does not show any integration or smoke tests specific to migration images. Consider adding targeted tests in the CI pipeline to verify functionality of built migration images.

  • Naming Consistency
    In the shell script, variable cm is used for the component name. This is consistent with other components but consider renaming it to component for clarity.

  • Remove Unnecessary shellcheck Call Inside Loop
    Running shellcheck inside the for loop for every architecture is redundant and slows down CI. Move it outside the loop or to a separate lint stage.


Summary of Actionable Suggestions

# In .github/scripts/ci.sh around line 400
for ac in $architectures; do
    echo -en "[📃💿] $cm $os $ac $version $profile:\t"
    img=$($script "$cm" linux "$ac" "$version" "$profile" "$GIT_REF" "$GIT_SHA")
    if ! check_image_existed $img; then
        echo "Image check failed for $img"
        exit 1
    fi
done

# Move shellcheck out of the loop
shellcheck -S error packages/scripts/build-package-images.sh
# In packages/packages.yaml.tmpl

# Add comment about migration component
# migration: builds tikv-br, tikv-cdc and kafka-consumer images for TiKV migration tools.
migration:
  desc: tikv/migration - tikv-br, tikv-cdc, kafka-consumer
  git:
    url: '{{ .Git.url | default "https://github.com/tikv/migration.git" }}'
    ref: {{ .Git.ref | default "main" }}
    sha: {{ .Git.sha | default "" }}
  version: {{ .Release.version }}
  artifactory:
    tags:
      {{- if .Git.sha }}
      - {{ strings.ReplaceAll "/" "-" .Git.ref | strings.ToLower }}-{{ strings.Trunc 7 .Git.sha }}
      {{- end }}
      - {{ strings.ReplaceAll "/" "-" .Git.ref | strings.ToLower }}
      - {{ .Release.version }}
      - latest
  builders:
    - image: ghcr.io/pingcap-qe/cd/utils/release:v2026.2.1-3-gb0438c3
  routers:
    - description: main branch docker images
      os: [linux]
      arch: [amd64, arm64]  # Consider defining this list as a variable
      profile: [release]
      artifacts:
        # Add comment about each artifact's context/dockerfile paths
        - name: tikv-br image
          type: image
          artifactory:
            repo: "{{ .Release.registry }}/tikv/migration/images/tikv-br"
          context: br
          dockerfile: deployments/docker/Dockerfile
        - name: tikv-cdc image
          type: image
          artifactory:
            repo: "{{ .Release.registry }}/tikv/migration/images/tikv-cdc"
          context: cdc
          dockerfile: deployments/tikv-cdc/docker/Dockerfile
        - name: kafka-consumer image
          type: image
          artifactory:
            repo: "{{ .Release.registry }}/tikv/migration/images/kafka-consumer"
          context: cdc
          dockerfile: deployments/tikv-cdc/docker/kafka-consumer.Dockerfile

Addressing these points will improve test reliability, maintainability of the new component, and clarity for future contributors.

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

ti-chi-bot bot commented Mar 5, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-03-05 05:41:53.295964765 +0000 UTC m=+423157.874043949: ☑️ agreed by wuhuizuo.

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

wuhuizuo commented Mar 5, 2026

/hold

Copy link
Contributor

@wuhuizuo wuhuizuo left a comment

Choose a reason for hiding this comment

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

/unhold

@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 merged commit ba6f237 into PingCAP-QE:main Mar 5, 2026
4 checks passed
ti-chi-bot bot pushed a commit to PingCAP-QE/ci that referenced this pull request Mar 5, 2026
…gration-docker-release (#4287)

Depends on: PingCAP-QE/artifacts#907
Close: #3347

---------

Signed-off-by: lyb <yebin.li@pingcap.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

Deprecate job https://ci.pingcap.net/job/migration-docker-release/

2 participants