From d4fdc6985523eefc7f46dca16913550d03158a52 Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Fri, 6 Sep 2024 07:34:51 +0200 Subject: [PATCH] Set proxy_env_vars in OpenStackRunnerManager (#363) * set proxy_env_vars in OpenStackRunnerManager * lint * disable aproxy in private endpoint runners * disable aproxy conditionally * enable log_cli * temporarily disable env vars to test if integration test fails - REVERT ME * disable aproxy unconditionally * Revert latest commits Revert "disable aproxy in private endpoint runners" This reverts commit acfc35ab168e4f6b62328b958cbc24ed2ed368dd. Revert "disable aproxy conditionally" This reverts commit e45878e370987c9e34cc265e35ca3c3c5570f819. Revert "enable log_cli" This reverts commit f8207a7a73c2ebb2c7286e66b8917065ae68ae70. Revert "temporarily disable env vars to test if integration test fails - REVERT ME" This reverts commit e0dca27e309d192b6412be2c6e4a992ac2bc22bc. Revert "disable aproxy unconditionally" This reverts commit c47ef6e53810ed67b7b0b5ad7bf80b4e14f20d78. --- src-docs/openstack_cloud.openstack_runner_manager.md | 12 ++++++------ src/openstack_cloud/openstack_runner_manager.py | 11 ++++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src-docs/openstack_cloud.openstack_runner_manager.md b/src-docs/openstack_cloud.openstack_runner_manager.md index 7f28b8689..64e7ce91d 100644 --- a/src-docs/openstack_cloud.openstack_runner_manager.md +++ b/src-docs/openstack_cloud.openstack_runner_manager.md @@ -133,7 +133,7 @@ The prefix of runner names. --- - + ### method `cleanup` @@ -156,7 +156,7 @@ Cleanup runner and resource on the cloud. --- - + ### method `create_runner` @@ -186,7 +186,7 @@ Create a self-hosted runner. --- - + ### method `delete_runner` @@ -210,7 +210,7 @@ Delete self-hosted runners. --- - + ### method `flush_runners` @@ -233,7 +233,7 @@ Remove idle and/or busy runners. --- - + ### method `get_runner` @@ -256,7 +256,7 @@ Get a self-hosted runner by instance id. --- - + ### method `get_runners` diff --git a/src/openstack_cloud/openstack_runner_manager.py b/src/openstack_cloud/openstack_runner_manager.py index aa03b0ec3..11bac0b92 100644 --- a/src/openstack_cloud/openstack_runner_manager.py +++ b/src/openstack_cloud/openstack_runner_manager.py @@ -42,7 +42,7 @@ from metrics import storage as metrics_storage from openstack_cloud.openstack_cloud import OpenstackCloud, OpenstackInstance from repo_policy_compliance_client import RepoPolicyComplianceClient -from utilities import retry +from utilities import retry, set_env_var logger = logging.getLogger(__name__) @@ -149,6 +149,15 @@ def __init__( # pylint: disable=R0913 prefix=self.name_prefix, ) + # Setting the env var to this process and any child process spawned. + proxies = service_config.proxy_config + if no_proxy := proxies.no_proxy: + set_env_var("NO_PROXY", no_proxy) + if http_proxy := proxies.http: + set_env_var("HTTP_PROXY", http_proxy) + if https_proxy := proxies.https: + set_env_var("HTTPS_PROXY", https_proxy) + @property def name_prefix(self) -> str: """The prefix of runner names.