Q:

Cannot Build Gerrit while accessing remote repository through a proxy

I try to build gerrit with bazel (0.13.0rc2 and 0.20) on Ubuntu. My company uses a proxy that requires authentication. The environment variables http_proxy and https_proxy are set (and other tools like wget, maven, ... work) but bazel reports "HTTP/1.0 407 Proxy Authentication Required" errors:
$ 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"

Any suggestions are welcome!

A:

If somebody else has a similar problem:
After searching a while and e. g. tried to specify the environment variables HTTP_PROXY and HTTPS_PROXY (see also bazel issue #587) I found this discussion and used gerritforge/jenkins-slave-bazel for building (proxy configured also for 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

That at least solves the bazel proxy issue.

