Skip to content

Commit 53cf562

Browse files
committed
copy proxy environment vars to build pod environment
1 parent 29e7546 commit 53cf562

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

binderhub/build.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import json
88
import threading
99
from urllib.parse import urlparse
10+
import os
1011

1112
from kubernetes import client, watch
1213
from tornado.ioloop import IOLoop
@@ -235,6 +236,24 @@ def submit(self):
235236
if self.git_credentials:
236237
env.append(client.V1EnvVar(name='GIT_CREDENTIAL_ENV', value=self.git_credentials))
237238

239+
# copy additional variables from current environment to new pod environment
240+
proxy_environment_variables = [
241+
'http_proxy',
242+
'https_proxy',
243+
'HTTP_PROXY',
244+
'HTTPS_PROXY',
245+
'no_proxy',
246+
'NO_PROXY',
247+
]
248+
249+
for env_var in proxy_environment_variables:
250+
try:
251+
env.append(client.V1EnvVar(name=env_var, value=os.environ[env_var]))
252+
except KeyError:
253+
# skip the environment variable if it isn't present
254+
pass
255+
256+
component_label = "binderhub-build"
238257
self.pod = client.V1Pod(
239258
metadata=client.V1ObjectMeta(
240259
name=self.name,

0 commit comments

Comments
 (0)