Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new CI for tiflow to enable integration tests of sync_diff_inspector #3387

Merged
merged 6 commits into from
Feb 17, 2025

Conversation

joechenrh
Copy link
Contributor

@joechenrh joechenrh commented Feb 12, 2025

Related tiflow changes: pingcap/tiflow#12060

Copy link

ti-chi-bot bot commented Feb 12, 2025

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

Key Changes:

  1. Added a new CI configuration file pod-pull_syncdiff_integration_test.yaml for integration tests.
  2. Added a new Jenkins pipeline script pull_syncdiff_integration_test.groovy for running integration tests on the sync_diff_inspector component.
  3. Configured containers for runner, net-tool, and mysql with specific resource limits.
  4. Added environment variables and commands for running integration tests.

Potential Problems:

  1. The new YAML and Groovy files do not have a description or comments explaining their purpose or usage. It is recommended to add some comments to provide context for future developers.
  2. The pod-pull_syncdiff_integration_test.yaml file lacks details about the purpose of each container and their interactions. Adding comments or documentation can help in understanding the configuration better.
  3. The Jenkins pipeline script pull_syncdiff_integration_test.groovy is quite lengthy and could be split into smaller, more manageable functions for better readability and maintainability.
  4. There is no newline at the end of the pull_syncdiff_integration_test.groovy file. It is a good practice to end files with a newline character.

Fixing Suggestions:

  1. Add comments at the beginning of each new file explaining its purpose, usage, and any important information.
  2. Enhance the pod-pull_syncdiff_integration_test.yaml file with comments detailing the role of each container and how they contribute to the integration test environment.
  3. Refactor the Jenkins pipeline script pull_syncdiff_integration_test.groovy by breaking it down into smaller functions or stages for improved readability and maintainability.
  4. Ensure there is a newline at the end of the pull_syncdiff_integration_test.groovy file to adhere to standard file conventions.

Overall, the changes look good, but adding more documentation and improving code organization can enhance the clarity and maintainability of the CI setup.

Copy link

ti-chi-bot bot commented Feb 12, 2025

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

Key Changes:

  1. Added a new YAML file for pod configuration pod-pull_syncdiff_integration_test.yaml.
  2. Added a new Groovy script pull_syncdiff_integration_test.groovy for integration testing of sync_diff_inspector.
  3. Updated the Jenkins pipeline to include the new stages and steps for integration testing.

Potential Problems:

  1. The Groovy script lacks a newline at the end of the file.
  2. The pod-pull_syncdiff_integration_test.yaml file contains hard-coded image versions which may become outdated.
  3. The script for downloading tidb-enterprise-tools-nightly-linux-amd64.tar.gz and extracting it could be improved for error handling and cleanup.
  4. The script for checking the binaries could be enhanced by adding checks for the existence of files before executing them.

Fixing Suggestions:

  1. Add a newline at the end of pull_syncdiff_integration_test.groovy.
  2. Consider parameterizing the image versions in pod-pull_syncdiff_integration_test.yaml to make it more flexible.
  3. Improve error handling and cleanup in the script for downloading and extracting tidb-enterprise-tools-nightly-linux-amd64.tar.gz.
  4. Enhance the binary checking script by adding file existence checks before executing them for better reliability.

Overall, the changes look good, but the potential problems highlighted above should be addressed for better maintainability and robustness of the CI process.

Copy link

ti-chi-bot bot commented Feb 12, 2025

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

Key Changes:

  1. Added a new Kubernetes pod configuration file pod-pull_syncdiff_integration_test.yaml.
  2. Updated a script in pull_engine_integration_test.groovy to use make sync_diff_inspector instead of make sync-diff-inspector.
  3. Added a new script file pull_syncdiff_integration_test.groovy for integration testing with various stages like Debug info, Checkout, and Integration Test.

Potential Problems:

  1. In pod-pull_syncdiff_integration_test.yaml, there seems to be a mix of different container configurations without clear separation or explanation of their purposes. This might lead to confusion or misconfiguration.
  2. In pull_syncdiff_integration_test.groovy, there is no newline at the end of the file, which might cause issues with some tools or scripts reading the file.

Fixing Suggestions:

  1. Add comments or annotations in pod-pull_syncdiff_integration_test.yaml to explain the purpose of each container and their resource allocations for better clarity.
  2. Make sure to add a newline at the end of pull_syncdiff_integration_test.groovy to adhere to common file conventions and prevent any potential parsing issues.

Overall, the changes seem to be focused on setting up integration tests for sync_diff_inspector using Kubernetes pods and Jenkins pipeline scripts. Make sure to address the potential problems mentioned above for better readability and maintainability of the CI setup.

wget --no-verbose --retry-connrefused --waitretry=1 -t 3 -O tidb-enterprise-tools-nightly-linux-amd64.tar.gz https://download.pingcap.org/tidb-enterprise-tools-nightly-linux-amd64.tar.gz
tar -xzf tidb-enterprise-tools-nightly-linux-amd64.tar.gz
mv tidb-enterprise-tools-nightly-linux-amd64/bin/loader bin/
mv tidb-enterprise-tools-nightly-linux-amd64/bin/importer bin/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there specific requirements for the versions of these two tools? The product in this URL has not been updated for a long time: https://download.pingcap.org/tidb-enterprise-tools-nightly-linux-amd64.tar.gz

Copy link
Collaborator

Choose a reason for hiding this comment

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

suggest caching these two products on the internal fileserver to reduce download time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we don't need to specify the versions of these two tools. Acutally I don't even know where the source code of the loader is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let me check where it is from.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we don't need to specify the versions of these two tools. Acutally I don't even know where the source code of the loader is.

loder is from an archived repo https://github.com/pingcap-inc/tidb-enterprise-tools

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So let's just use binary.

caching these two products on the internal fileserver

How to cache these two binary?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I will cache these two binaries to the internal fileserver. The current PR can be merged and take effect first, and after testing, I will update it to the internal download address.

Copy link

ti-chi-bot bot commented Feb 14, 2025

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

Key Changes:

  1. Added a new YAML file pod-pull_syncdiff_integration_test.yaml for defining a Kubernetes Pod configuration.
  2. Modified the pull_engine_integration_test.groovy file to change the command from make sync-diff-inspector to make sync_diff_inspector.
  3. Added a new file pull_syncdiff_integration_test.groovy for integration testing.

Potential Problems:

  1. In the pull_engine_integration_test.groovy file, the command make sync_diff_inspector might need to be updated in other places as well, not just in the prepare stage.
  2. In the pull_syncdiff_integration_test.groovy file, there is a comment saying "should triggerd for master and latest release branches" which seems to have a typo ("triggerd" should be "triggered").
  3. The new YAML file pod-pull_syncdiff_integration_test.yaml specifies resource limits for containers. Make sure these limits are appropriate for the integration tests being run.

Fixing Suggestions:

  1. Update all occurrences of make sync-diff-inspector to make sync_diff_inspector in the pull_engine_integration_test.groovy file.
  2. Correct the typo in the comment in the pull_syncdiff_integration_test.groovy file.
  3. Consider reviewing and adjusting the resource limits specified in the pod-pull_syncdiff_integration_test.yaml file based on the resource requirements of the integration tests.

Overall, the changes seem to be focused on enabling integration tests for sync_diff_inspector in the tiflow project. Make sure to test the changes thoroughly before merging the pull request.

Copy link

ti-chi-bot bot commented Feb 17, 2025

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

Key Changes:

  1. Added a new pod yaml file for integration tests.
  2. Added a new groovy file for running integration tests related to sync_diff_inspector in the pipelines/pingcap/tiflow/latest directory.

Potential Problems:

  1. In the pull_syncdiff_integration_test.groovy file, there is a typo in the stage name "should triggerd for master and latest release branches." It should be "should trigger for master and latest release branches."
  2. In the pull_syncdiff_integration_test.groovy file, there is a missing newline at the end of the file. It's recommended to add a newline at the end to follow standard coding practices.
  3. In the pull_syncdiff_integration_test.groovy file, there are hardcoded URLs like http://fileserver.pingcap.net and https://download.pingcap.org. It's better to use environment variables or configuration files to manage such URLs dynamically.

Fixing Suggestions:

  1. Update the typo in the stage name in the pull_syncdiff_integration_test.groovy file.
  2. Add a newline at the end of the pull_syncdiff_integration_test.groovy file.
  3. Refactor the hardcoded URLs in the pull_syncdiff_integration_test.groovy file to use environment variables or configuration files for better flexibility.

Overall, the changes look good, but it's essential to address the potential problems mentioned above for better code quality and maintainability.

Copy link

ti-chi-bot bot commented Feb 17, 2025

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

Key Changes:

  1. Added a new YAML file pod-pull_syncdiff_integration_test.yaml for defining a Kubernetes Pod configuration.
  2. Added a new Groovy file pull_syncdiff_integration_test.groovy for a Jenkins pipeline to run integration tests for sync_diff_inspector.
  3. The pipeline includes stages for Debug info, Checkout, and Integration Test.
  4. Integration Test stage involves downloading artifacts, checking tools/binaries, and running sync_diff_inspector integration tests.
  5. Post stage archives logs and prints logs if the build is unsuccessful.

Potential Problems:

  1. The new YAML file and Groovy file have been added without any validation or explanation of what they are supposed to achieve.
  2. The script in the Integration Test stage is quite long and complex, which may lead to maintenance issues or difficulties in debugging.
  3. The Groovy file does not have a newline at the end, which might cause issues with certain tools or parsers.

Fixing Suggestions:

  1. Add comments or descriptions in the PR explaining the purpose and functionality of the new files added.
  2. Consider breaking down the script in the Integration Test stage into separate functions or steps for better readability and maintainability.
  3. Ensure that the Groovy file ends with a newline to comply with standard conventions.
  4. Double-check the resource allocations in the YAML file for the containers to ensure they are appropriate for the integration tests.

Overall, the changes seem to be focused on setting up a CI pipeline for running integration tests for sync_diff_inspector. Make sure to address the potential problems and consider the fixing suggestions to improve the PR before merging.

Copy link
Collaborator

@purelind purelind left a comment

Choose a reason for hiding this comment

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

/lgtm

@ti-chi-bot ti-chi-bot bot added the lgtm label Feb 17, 2025
Copy link

ti-chi-bot bot commented Feb 17, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-17 08:26:28.993221229 +0000 UTC m=+863431.389443290: ☑️ agreed by purelind.

Copy link

ti-chi-bot bot commented Feb 17, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: purelind

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

The pull request process is described here

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 Feb 17, 2025
@ti-chi-bot ti-chi-bot bot merged commit de41b40 into PingCAP-QE:main Feb 17, 2025
2 checks passed
ti-chi-bot bot pushed a commit that referenced this pull request Feb 17, 2025
Ref #3387

Add trigger for new pipeline of sync_diff_inspector. Enable the
condition trigger and remove the WIP after passing the test.
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.

2 participants