bazel-contrib / setup-bazel

GitHub Action to configure Bazel
MIT License
34 stars 7 forks source link

Make the bazelrc configurable #13

Closed chrismgrayftsinc closed 6 months ago

chrismgrayftsinc commented 6 months ago

In our github actions, we run bazel with the bazelrc flag set. It would be nice if we could configure the name of the bazelrc so that we could get the benefit of caching without having to change all of our setups.

p0deje commented 6 months ago

@chrismgrayftsinc I am not sure I fully understand what the problem with a current .bazelrc name. Do you also put a $HOME/.bazelrc in your jobs and you'd like an action to avoid overriding it?

If a custom name is given, it must also be passed to as --bazelrc which might confuse users (so they change the name but it's not automatically picked up).

chrismgrayftsinc commented 6 months ago

@chrismgrayftsinc I am not sure I fully understand what the problem with a current .bazelrc name. Do you also put a $HOME/.bazelrc in your jobs and you'd like an action to avoid overriding it?

We have both a .bazelrcr and a .bazel-ci.rc in our repos and use the --bazelrc flag to use the correct one in CI. I grant that this is probably not the recommended way of doing things.

If a custom name is given, it must also be passed to as --bazelrc which might confuse users (so they change the name but it's not automatically picked up).

That's correct. I tried to add that to the documentation, but feel free to suggest changes to make it clearer.

p0deje commented 6 months ago

We have both a .bazelrcr and a .bazel-ci.rc in our repos and use the --bazelrc flag to use the correct one in CI. I grant that this is probably not the recommended way of doing things.

setup-bazel would create $HOME/.bazelrc so it should not cause collisions with you repo files. Then when you run your command with --bazelrc flag, Bazel is supposed to pick up yours and the one in $HOME as well - https://bazel.build/run/bazelrc#global-bazelrc:

In addition to this optional configuration file, Bazel looks for a global rc file. For more details, see the global bazelrc section.

With that said, I don't understand where exactly you have a problem in your jobs?

chrismgrayftsinc commented 6 months ago

Oh I guess I completely misunderstood then.

I was thinking that we were not getting the benefit of the caching through the arguments added to the bazelrc.

I'll close this since it is clearly not needed.