admin管理员组

文章数量:1289635

I have a github action runner that is cut off from reaching other domains than company internal ones due to security reasons.

On the other hand the official bazel central registry is mirrored into our company domain so that dependency resolution and building generally works.

I am now initiating following bazel query within my github workflow:

bazel query 'somepath(//components/..., //applications/...)' --notool_deps --noshow_progress --noimplicit_deps

which leads to not being able to have coverage related source be downloaded:

Download from /bazel_coverage_output_generator/releases/coverage_output_generator-v2.8.zip failed: class java.ConnectException Connection refused

At the same time I have seen that any cc_test rule being present underneath the queried folders leads to bazel trying to download coverage_output_generator sources (even if those do not have any dependencies).

Generally my possible workarounds could be

  1. Deactivate coverage for the query only
  2. Provide alternative sources for downloading needed coverage_output_generator sources

There was an bazel issue in former bazel versions that obviously got fixed and looks a bit like the situation described above, but it is unclear what to configure / exactly is needed to have this automatism be deactivated:

Anyone an idea what the reason here could be or how to handle this ?

I have a github action runner that is cut off from reaching other domains than company internal ones due to security reasons.

On the other hand the official bazel central registry is mirrored into our company domain so that dependency resolution and building generally works.

I am now initiating following bazel query within my github workflow:

bazel query 'somepath(//components/..., //applications/...)' --notool_deps --noshow_progress --noimplicit_deps

which leads to not being able to have coverage related source be downloaded:

Download from https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.8.zip failed: class java.ConnectException Connection refused

At the same time I have seen that any cc_test rule being present underneath the queried folders leads to bazel trying to download coverage_output_generator sources (even if those do not have any dependencies).

Generally my possible workarounds could be

  1. Deactivate coverage for the query only
  2. Provide alternative sources for downloading needed coverage_output_generator sources

There was an bazel issue in former bazel versions that obviously got fixed and looks a bit like the situation described above, but it is unclear what to configure / exactly is needed to have this automatism be deactivated:

https://github/bazelbuild/bazel/issues/15088

Anyone an idea what the reason here could be or how to handle this ?

Share Improve this question asked Feb 20 at 17:44 efendiefendi 113 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Although there might be a better solution, you can do (2) pretty easily. Start by configuring the --experimental_downloader_config flag, for example, I have this in my .bazelrc:

$ grep downloader .bazelrc
# configure downloader to always point to artifactory (instead of maven central)
common --experimental_downloader_config=tools/bazel_downloader.cfg

and then the file itself is like iptable rules:

$ cat tools/bazel_downloader.cfg 
<..snipped..>
# Bazel Mirror
rewrite mirror.bazel.build/(.+) artifacts.example/mirror.bazel.build/$1

You can setup a specific mirror for a specific file too by playing with regexes in that file.

See more in Aspect's blog

本文标签: Initiate a bazel query without having coverage being activated for cctest rulesStack Overflow