pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.33k stars 637 forks source link

Corepack Npm installation doesnt work through proxy #21491

Open Husky22 opened 1 month ago

Husky22 commented 1 month ago

Describe the bug The corepack installation process doesnt get the http_proxy or https_proxy env variables even though pants.toml has the following settings:

[subprocess-environment]
env_vars.add = ["http_proxy", "https_proxy"]

Debug of corepack process:

10:39:47.48 [DEBUG] spawned local process as Some(275230) for Process 
{ argv: ["yarn", "install"], 
env: {
"COREPACK_HOME": "/tmp/pants-sandbox-7UwdMw/._corepack_home", 
"PATH": "/tmp/pants-sandbox-7UwdMw/_binary_shims_d71438cc82ac7616b94db5246abc83b636b9bc4e66183a6ff021d42bf26ed483:/tmp/pants-sandbox-7UwdMw/__node/._corepack:/tmp/pants-sandbox-7UwdMw/__node/./node-v16.15.0-linux-x64/bin",
"YARN_CACHE_FOLDER": "/tmp/pants-sandbox-7UwdMw/._yarn_cache", "npm_config_cache": "._npm"},
working_directory: Some(RelativePath("src/javascript/frontend")),
input_digests: InputDigests { complete: DirectoryDigest { digest: Digest { hash: Fingerprint<f2d0b73b93dc60516dbcba07a41f42122bd162ef0aba4853e85c5ca79d1e8284>, size_bytes: 312 }, tree: "Some(..)" }, 
nailgun: DirectoryDigest { digest: Digest { hash: Fingerprint<e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>, size_bytes: 0 }, tree: "Some(..)" }, 
inputs: DirectoryDigest { digest: Digest { hash: Fingerprint<3cb7dd639d662b77a07458b306bd8fc6b72ef88c1d18372caddc9b0df200d407>, size_bytes: 77 }, tree: "Some(..)" }, 
immutable_inputs: {RelativePath("__node"): DirectoryDigest { digest: Digest { hash: Fingerprint<106533f8da8fc65cb5c71358ebf756ed99a30b24bc23ccf16555a633a30dbd74>, size_bytes: 183 }, tree: "Some(..)" }, RelativePath("_binary_shims_d71438cc82ac7616b94db5246abc83b636b9bc4e66183a6ff021d42bf26ed483"): DirectoryDigest { digest: Digest { hash: Fingerprint<d71438cc82ac7616b94db5246abc83b636b9bc4e66183a6ff021d42bf26ed483>, size_bytes: 641 }, tree: "Some(..)" }}, use_nailgun: {} }, 
output_files: {RelativePath("yarn.lock")},
output_directories: {}, 
timeout: None, 
execution_slot_variable: None, concurrency_available: 0, 
description: "generate yarn.lock for 'javascript.frontend'.", 
level: Info, 
append_only_caches: {CacheName("npm"): RelativePath("._npm"), CacheName("yarn_cache"): RelativePath("._yarn_cache")},
jdk_home: None, 
cache_scope: Successful, 
execution_environment: ProcessExecutionEnvironment { name: None, platform: Linux_x86_64, strategy: Local }, remote_cache_speculation_delay: 0ns, attempt: 0 }

Pants version 2.22.0

OS Linux

Additional info

krishnan-chandra commented 1 month ago

You might need to set corepack_env_vars in the nodejs subsystem to pass those variables through to corepack. I think if you add the HTTP_PROXY and HTTPS_PROXY variables there, it should fix the issue.