通过代理访问远程存储库时无法构建 Gerrit

Cannot Build Gerrit while accessing remote repository through a proxy

我尝试在 Ubuntu 上使用 bazel(0.13.0rc2 和 0.20)构建 gerrit。我的公司使用需要身份验证的代理。环境变量 http_proxy 和 https_proxy 已设置(以及其他工具,如 wget、maven、... 工作)但 bazel 报告 "HTTP/1.0 407 Proxy Authentication Required" 错误:

$ bazel build gerrit
WARNING: ignoring http_proxy in environment.
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': Error downloading [https://github.com/bazelbuild/rules_closure/archive/08039ba8ca59f64248bb3b6ae016460fe9c9914f.tar.gz] to /home/xxxxxx/.cache/bazel/_bazel_xxxxxx/5fb8c741228852f6bc57df1fc04917a8/external/io_bazel_rules_closure/08039ba8ca59f64248bb3b6ae016460fe9c9914f.tar.gz: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Required"

欢迎提出任何建议!

如果其他人有类似的问题:

搜索了一段时间后,e。 G。尝试指定环境变量 HTTP_PROXY 和 HTTPS_PROXY(另请参阅 bazel issue #587) I found this discussion 并使用 gerritforge/jenkins-slave-bazel 进行构建(也为 docker 配置了代理):

# use docker the docker container gerritforge/jenkins-slave-bazel to build gerrit
$ docker run --privileged -ti --entrypoint=bash --user jenkins gerritforge/jenkins-slave-bazel
$ cd && git clone --recursive https://gerrit.googlesource.com/gerrit
$ cd gerrit && bazel build gerrit

这至少解决了 bazel 代理问题。