-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
FR: prune target list based on dirty files #8521
Comments
We quite quickly had to switch away from the pure remote cache approach to something what you are suggesting here and our monorepo is far from the biggest one. And we have also run into the challenges that you mention, like handling changes of external repositories and BUILD files correctly. I think it would help a lot of people. Some related discussions: #7962 as well as https://groups.google.com/forum/m/#!msg/bazel-discuss/I9udqWIcEdI/iczVgWLOBQAJ Edit: Also for reference, we based our ci script on https://github.com/bazelbuild/bazel/blob/master/scripts/ci/ci.sh but it has been heavily modified since. |
Oh yeah in our ci we use the |
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so. |
Please either re-open this or include a link to the feature added since that implements this functionality. That is: what flag do I use to override what files bazel sees as being changed? |
I am closing this as not planned - I think https://github.com/Tinder/bazel-diff is a viable alternative that doesn't require changing Bazel. |
Bazel-diff only seems to be a solution if:
Granted at least three of these are likely the most common cases, but none of them are necessarily universal. I'd kinda rather see "not planed" FR's be tagged as such, demoted to last priority and left open. IMHO Closed should be for |
Description of the problem / feature request:
Bazel should be able to take a list of "dirty" files as input, and prune the target list based on it.
Feature requests: what underlying problem are you trying to solve with this feature?
In CI contexts bazel often ends up doing a lot of unnecessary/redundant work. For example, in CI a common pattern is to run
on a clean worker. This requires computing the full build graph, downloading all remote repositories, getting cache hits (and currently downloading all outputs) for every action in the graph, etc. As a result, it can be unnecessarily slow for mostly-cached builds, since most of this work is unrelated to the handful of files that have actually been changed or the targets that transitively depend on them. Especially in monorepo contexts, where a PR may only affect one corner of the codebase.
What a lot of users end up doing is hacking together something of their own using bazel query - something logically equivalent to
...except hopefully with proper handling of non-src dependencies (e.g. 'data', etc), BUILD/bzl files, WORKSPACE files, removed files, etc.
Unsurprisingly, this is hard to get right, and awkward to have to insert into a build flow. So it's a power feature only for users sufficiently motivated to improve build performance. But bazel knows how to do this internally - every incremental build is doing effectively this computation based on the files in the workspace that were touched or added or removed.
The request, then, is to build a proper feature around this - support something like:
so that CI systems can easily and scalably do pruned test runs, and without jeopardizing correctness by implementing this themselves.
(Recommended priority: low. It can be worked around via query; I only have a few examples of users doing this themselves so far. Filing this as a place to collect +1's, but suggest waiting for evidence of interested users before taking it on.)
The text was updated successfully, but these errors were encountered: