https://pantsbuild.org/ logo
#general
Title
# general
g

gray-shoe-19951

04/14/2023, 12:53 AM
A quick question on the external tools. As mentioned here, we host external binary internally. then we override url_template. In our environment, we have
http_proxy
,
https_proxy
and
no_proxy
env vars. However, it seems pants is not able to download the binary from our internal hosting and the reason appears to me is that it does not use
no_proxy
. In other words, with
http_proxy
and
https_proxy
, it wont be able to download the binary from internal hosting since internal hosting is not publicly accessible. Extra info: if I do not override the url_template, pants can download external binary with
http_proxy
and
https_proxy
. Is it correct?
Atm, I believe pants ignore no_proxy env var while downloading binary tools. Team, could you confirm it?
e

enough-analyst-54434

04/14/2023, 2:15 PM
Confirmed. Pants main:
Copy code
jsirois@Gill-Windows:~/dev/pantsbuild/pants (main) $ git grep -i no_proxy
jsirois@Gill-Windows:~/dev/pantsbuild/pants (main) $ git grep -i http_proxy
docs/markdown/Using Pants/restricted-internet-access.md:Setting `HTTP_PROXY` and `HTTPS_PROXY`
docs/markdown/Using Pants/restricted-internet-access.md:You may need to set standard proxy-related environment variables, such as `http_proxy`, `https_proxy` and `all_proxy`, in executed subprocesses:
docs/markdown/Using Pants/restricted-internet-access.md:env_vars.add = ["http_proxy=<http://myproxy>", "https_proxy"]
jsirois@Gill-Windows:~/dev/pantsbuild/pants (main) $ git grep -i https_proxy
docs/markdown/Using Pants/restricted-internet-access.md:Setting `HTTP_PROXY` and `HTTPS_PROXY`
docs/markdown/Using Pants/restricted-internet-access.md:You may need to set standard proxy-related environment variables, such as `http_proxy`, `https_proxy` and `all_proxy`, in executed subprocesses:
docs/markdown/Using Pants/restricted-internet-access.md:env_vars.add = ["http_proxy=<http://myproxy>", "https_proxy"]
docs/markdown/Using Pants/restricted-internet-access.md:Note that if you leave of the env var's value, as for `https_proxy` above, Pants will use the value of the same variable in the environment in which it is invoked.
As you can see from the grep though, Pants ignores all proxy env vars; so its the tools Pants uses that use or ignore them behind the scenes.
In particular, to perform tool downloads we use this library: https://docs.rs/reqwest/latest/reqwest/#proxies A quick inspection shows it respects
http(s)_proxy
env vars but requires code to disable proxies (i.e. probably does not support
no_proxy
).
g

gray-shoe-19951

04/14/2023, 9:19 PM
Cool thanks for looking into it and clear explanation!
2 Views