pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.46k stars 5.74k forks source link

*: support bazel #33691

Closed hawkingrei closed 2 years ago

hawkingrei commented 2 years ago

What problem does this PR solve?

Issue Number: close #34083

Problem Summary:

What is changed and how it works?

Check List

Tests

Side effects

Documentation

Release note

None
breezewish commented 2 years ago

Just curious, if these BAZEL files are automatically generated, can they be git-ignored? It's usually not a good practice to include generated files in the git repository.

In fact, Some bazel files are automatically generated. for example flaky test (It isn't recommended) and some other config have to be controlled by development such as visibility and test size that controls the test timeout. so it must be with the repo.

BTW, the open resource repos using the bazel like abseil-cpp, cockroach, tensorflow have many BAZEl.build files in their repo.

@hawkingrei Does this mean that we need to manually maintain these BAZEL.build files instead of using auto-generated ones, as the auto-generated ones may not be desired? I would like to know, for example, when I introduced a new package in the TiDB repository (or simply, added a new file), what steps should I take in order to make sure everything works? How these BAZEL files need to be generated? What kind of modification should I make? etc. If these steps are not property done, will my tests just being ignored in CI?

breezewish commented 2 years ago

Maybe you also need to introduce a CI step to ensure that people doesn't forget to generate necessary BAZEL files? I'm not sure however.

hawkingrei commented 2 years ago

Maybe you also need to introduce a CI step to ensure that people doesn't forget to generate necessary BAZEL files? I'm not sure however.

In fact, Generate bazel config is a task that takes some time in the CI. Althought it take less time than that tests without cache. so I will remove it in the future to speed ci again in the future.

However, Gezalle just can manage the dependency in the bazel config. it cannot manage the other thing. if we need to manage the config such as flasky test and so on. Gazalle just copy the old config to the new config. it is the main reason why we cannot remove bazel.build.

hawkingrei commented 2 years ago

Just curious, if these BAZEL files are automatically generated, can they be git-ignored? It's usually not a good practice to include generated files in the git repository.

In fact, Some bazel files are automatically generated. for example flaky test (It isn't recommended) and some other config have to be controlled by development such as visibility and test size that controls the test timeout. so it must be with the repo. BTW, the open resource repos using the bazel like abseil-cpp, cockroach, tensorflow have many BAZEl.build files in their repo.

@hawkingrei Does this mean that we need to manually maintain these BAZEL.build files instead of using auto-generated ones, as the auto-generated ones may not be desired? I would like to know, for example, when I introduced a new package in the TiDB repository (or simply, added a new file), what steps should I take in order to make sure everything works? How these BAZEL files need to be generated? What kind of modification should I make? etc. If these steps are not property done, will my tests just being ignored in CI?

For the common developers, It will be fine that they use gazelle to generate the config. For the repo admin, it needs to control the other thing by changing the config in the bazel. in these cases, we need to change the config and save it, so that gazelle can get this changement and keep them in the new config if the dependency has been updated.

bb7133 commented 2 years ago

/merge

ti-chi-bot commented 2 years ago

This pull request has been accepted and is ready to merge.

Commit hash: 971ee85614b712ed4dde038904249603d926a707

ti-chi-bot commented 2 years ago

@hawkingrei: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available [here](https://prow.tidb.io/command-help). If you have questions or suggestions related to my behavior, please file an issue against the [ti-community-infra/tichi](https://github.com/ti-community-infra/tichi/issues/new?title=Prow%20issue:) repository.