-
Notifications
You must be signed in to change notification settings - Fork 389
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
go_repository caching #394
Comments
There's not really a good way to implement Bazel's About I filed a feature request some time ago for a general cache that we could use for repository rules (bazelbuild/bazel#5086). If that gets implemented, we could do something like this. In the future, I expect |
Thanks for the comment and the background information - we have found tar.gz hashes to be stable for us so far, but maybe it will start hitting us at some point. What @aehlig proposed as a first solution to get caching for the starlark I wonder if we could adopt that same approach for the |
I'd love to have a general API for repository rule caching. Aside from that though, I'd rather One possible exception though: Go has a module cache. So for |
Fair enough about not wanting to add a specific cache. In regards to not using the go module cache, could we not just use the go sdk / cli provided by rules_go to just run the 'hermetically provided' rules_nodejs is doing something very similar with npm packages, by providing yarn hermetically and relying on its global yarn cache. |
That would work, but I think it would be pretty surprising for people if they don't have a Go SDK installed, but they end up with a module cache populated after running a Bazel command. If we did that, I think users would need to opt in somehow. Setting |
Yep agreed that this should only happen when |
My understanding is that with #400 we have a module cache ( This means that right now user calls to their installed Go SDK will not hit What can we do to share/combine the |
I wanted I'm not really opposed to sharing the user's module cache, but it should be opt-in, probably through an environment variable, something like
|
I know bazel only utilises the
repository_cache
right now forhttp_archive
as well as when a rule utilisesrepository_ctx.download_and_extract
orrepository_ctx.download
and asha
is provided. Further there has also been some progress made on cachinggit_repository
: bazelbuild/bazel#5928.I also know that when using
go_repository
I can addand the repository_cache will be utilised via one of the above mentioned functions. But what is the case right now if I do not specify a tar file to be downloaded but just want to use e.g. git directly? I have seen a
fetch_repo
binary is used rather than the 'native'git_repository
or the methods the rule itself is using. What is the reason for this, does that provide any way to cache the fetched repo to a specified location?As a bit of a background note, I actually do not mind adding the sha and git urls manually once but the problem is it does not play nicely with
bazel run //:gazelle -- update-repos ...
, i.e. if I run this on ago_repository
where I have added these attributes it just removes them and replaces them with the latest commit so that leads to not such a nice developer experience if someone wants to utilise this tool. Maybe there is also some way to tell theupdate-repos
command to prefer the archives? I suppose it should not even be too difficult to add right? (Happy to give it a try)The text was updated successfully, but these errors were encountered: