Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion automation/script/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def docker_run(self_module, i):
container_env_string = res['container_env_string']

res = update_docker_environment(
docker_settings, env, container_env_string)
docker_settings, env, self_module.host_env_keys, container_env_string)
if res['return'] > 0:
return res

Expand Down
18 changes: 7 additions & 11 deletions automation/script/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def process_mounts(mounts, env, docker_settings, f_run_cmd, run_state):
if 'mounts' in docker_settings:
mounts.extend(docker_settings['mounts'])

for key in ["MLC_INPUT", "MLC_OUTPUT", "MLC_OUTDIRNAME"]:
if "${{ " + key + " }}:${{ " + key + " }}" not in mounts:
mounts.append("${{ " + key + " }}:${{ " + key + " }}")

docker_input_mapping = docker_settings.get("input_mapping", {})
container_env_string = ""

Expand Down Expand Up @@ -182,7 +186,8 @@ def prepare_docker_inputs(input_params, docker_settings,
return docker_inputs, dockerfile_path


def update_docker_environment(docker_settings, env, container_env_string):
def update_docker_environment(
docker_settings, env, host_env_keys, container_env_string):
"""
Updates the Docker environment variables and build arguments.

Expand All @@ -194,23 +199,14 @@ def update_docker_environment(docker_settings, env, container_env_string):
Returns:
dict: A dictionary with a return code indicating success or failure.
"""
# Define proxy-related environment variable keys to propagate
proxy_keys = [
"ftp_proxy", "FTP_PROXY",
"http_proxy", "HTTP_PROXY",
"https_proxy", "HTTPS_PROXY",
"no_proxy", "NO_PROXY",
"socks_proxy", "SOCKS_PROXY",
"GH_TOKEN"
]

# Ensure the '+ CM_DOCKER_BUILD_ARGS' key exists in the environment
if '+ MLC_DOCKER_BUILD_ARGS' not in env:
env['+ MLC_DOCKER_BUILD_ARGS'] = []

# Add proxy environment variables to Docker build arguments and container
# environment string
for proxy_key in proxy_keys:
for proxy_key in host_env_keys:
proxy_value = os.environ.get(proxy_key)
if proxy_value:
container_env_string += f" --env.{proxy_key}={proxy_value} "
Expand Down
27 changes: 14 additions & 13 deletions automation/script/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ def __init__(self, action_object, automation_file):
'MLC_GIT_*',
'MLC_RENEW_CACHE_ENTRY']

self.host_env_keys = [
"GH_TOKEN",
"ftp_proxy",
"FTP_PROXY",
"http_proxy",
"HTTP_PROXY",
"https_proxy",
"HTTPS_PROXY",
"no_proxy",
"NO_PROXY",
"socks_proxy",
"SOCKS_PROXY"]

self.input_flags_converted_to_tmp_env = {
'path': {'desc': 'Filesystem path to search for executable', 'default': ''}}

Expand Down Expand Up @@ -486,19 +499,7 @@ def _run(self, i):
'append_unique': True})

# take some env from the user environment
keys = [
"GH_TOKEN",
"ftp_proxy",
"FTP_PROXY",
"http_proxy",
"HTTP_PROXY",
"https_proxy",
"HTTPS_PROXY",
"no_proxy",
"NO_PROXY",
"socks_proxy",
"SOCKS_PROXY"]
for key in keys:
for key in self.host_env_keys:
if os.environ.get(key, '') != '' and env.get(key, '') == '':
env[key] = os.environ[key]

Expand Down
4 changes: 4 additions & 0 deletions script/install-gcc-src/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ tags:
- gcc
- src-gcc
uid: faae0ebd6e1242db
docker:
skip_run_cmd: true
pre_run_cmds:
- mlc pull repo
tests:
run_inputs:
- {}
Expand Down
4 changes: 4 additions & 0 deletions script/install-llvm-src/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ variations:
- full-history
env:
MLC_GIT_CHECKOUT_TAG: '#'
docker:
skip_run_cmd: true
pre_run_cmds:
- mlc pull repo
versions: {}
tests:
run_inputs:
Expand Down
Loading