Skip to content

Commit 816eeb3

Browse files
ahornbyfacebook-github-bot
authored andcommitted
preserve http_proxy in generated github actions sudo invocatons
Summary: X-link: facebookincubator/zstrong#1102 make it possible to run the generated github actions locally with [act](https://github.com/nektos/act) when behind a proxy by preserving http_proxy in generated github actions sudo invocatons also updated to consistently write `apt-get` instead of the interactive `apt` (we had a mix) example usage (substitute myproxy for your actual proxy): ``` mkdir $HOME/act-artifacts cd ~/fizz time act -r -j build -W .github/workflows/getdeps_linux.yml --artifact-server-path=$HOME/act-artifacts --artifact-server-addr=127.0.0.1 --cache-server-addr=127.0.0.1 --env http_proxy=http://myproxy:8080 --env https_proxy=myproxy:8080 --action-offline-mode ``` Reviewed By: bigfootjon Differential Revision: D67864689 fbshipit-source-id: 45695675ca5672e56104c8c33803afe004ff98da
1 parent 35e07bd commit 816eeb3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

build/fbcode_builder/getdeps.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,13 @@ def run_project_cmd(self, args, loader, manifest):
440440
elif manager == "deb":
441441
packages = sorted(set(all_packages["deb"]))
442442
if packages:
443-
cmd_args = ["sudo", "apt", "install", "-y"] + packages
443+
cmd_args = [
444+
"sudo",
445+
"--preserve-env=http_proxy",
446+
"apt-get",
447+
"install",
448+
"-y",
449+
] + packages
444450
elif manager == "homebrew":
445451
packages = sorted(set(all_packages["homebrew"]))
446452
if packages:
@@ -1155,7 +1161,7 @@ def write_job_for_platform(self, platform, args): # noqa: C901
11551161
build_opts.allow_system_packages
11561162
and build_opts.host_type.get_package_manager()
11571163
):
1158-
sudo_arg = "sudo "
1164+
sudo_arg = "sudo --preserve-env=http_proxy "
11591165
allow_sys_arg = " --allow-system-packages"
11601166
if build_opts.host_type.get_package_manager() == "deb":
11611167
out.write(" - name: Update system package info\n")

0 commit comments

Comments
 (0)