diff --git a/README.md b/README.md index aa7a511d84..34e807cdf3 100644 --- a/README.md +++ b/README.md @@ -364,7 +364,8 @@ it being synced automatically everyday. | REQUEST_SIZE_LIMIT | 2097152 (2MB) | Max request size which impact the maximum size of resources and payload size of job args | Server | | ACCEPT_INVALID_CERTS | false | Accept invalid certificates, including self-signed and expired certificates | Server | | HTTP_PROXY | None | http_proxy | Server + Worker | -| HTTPS_PROXY | false | https_proxy | Server + Worker | +| HTTPS_PROXY | None | https_proxy | Server + Worker | +| NO_PROXY | None | no_proxy | Server + Worker | ## Run a local dev setup diff --git a/backend/windmill-api/src/scripts.rs b/backend/windmill-api/src/scripts.rs index acf997aca5..6f195644dc 100644 --- a/backend/windmill-api/src/scripts.rs +++ b/backend/windmill-api/src/scripts.rs @@ -43,7 +43,6 @@ use windmill_common::{ list_elems_from_hub, not_found_if_none, paginate, require_admin, Pagination, StripPath, }, }; -use windmill_parser::MainArgSignature; use windmill_queue::{self, schedule::push_scheduled_job, QueueTransaction}; lazy_static::lazy_static! { diff --git a/backend/windmill-worker/src/python_executor.rs b/backend/windmill-worker/src/python_executor.rs index 9f628ad80d..dc7079d02a 100644 --- a/backend/windmill-worker/src/python_executor.rs +++ b/backend/windmill-worker/src/python_executor.rs @@ -52,8 +52,8 @@ use crate::global_cache::{build_tar_and_push, pull_from_tar}; use crate::{ common::{read_result, set_logs}, create_args_and_out_file, get_reserved_variables, handle_child, write_file, - AuthedClientBackgroundTask, DISABLE_NSJAIL, DISABLE_NUSER, NSJAIL_PATH, PATH_ENV, - PIP_CACHE_DIR, S3_CACHE_BUCKET, + AuthedClientBackgroundTask, DISABLE_NSJAIL, DISABLE_NUSER, HTTPS_PROXY, HTTP_PROXY, NO_PROXY, + NSJAIL_PATH, PATH_ENV, PIP_CACHE_DIR, S3_CACHE_BUCKET, }; pub async fn create_dependencies_dir(job_dir: &str) { @@ -484,6 +484,16 @@ pub async fn handle_python_reqs( if let Some(host) = PIP_TRUSTED_HOST.as_ref() { vars.push(("TRUSTED_HOST", host)); } + if let Some(http_proxy) = HTTP_PROXY.as_ref() { + vars.push(("HTTP_PROXY", http_proxy)); + } + if let Some(https_proxy) = HTTPS_PROXY.as_ref() { + vars.push(("HTTPS_PROXY", https_proxy)); + } + if let Some(no_proxy) = NO_PROXY.as_ref() { + vars.push(("NO_PROXY", no_proxy)); + } + let _ = write_file( job_dir, "download.config.proto", diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index 81565a28ab..8542ff56b4 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -175,8 +175,9 @@ lazy_static::lazy_static! { .and_then(|x| x.parse::().ok()) .unwrap_or(false); - static ref HTTP_PROXY: Option = std::env::var("http_proxy").ok().or(std::env::var("HTTP_PROXY").ok()); - static ref HTTPS_PROXY: Option = std::env::var("https_proxy").ok().or(std::env::var("HTTPS_PROXY").ok()); + pub static ref NO_PROXY: Option = std::env::var("no_proxy").ok().or(std::env::var("NO_PROXY").ok()); + pub static ref HTTP_PROXY: Option = std::env::var("http_proxy").ok().or(std::env::var("HTTP_PROXY").ok()); + pub static ref HTTPS_PROXY: Option = std::env::var("https_proxy").ok().or(std::env::var("HTTPS_PROXY").ok()); pub static ref DENO_PATH: String = std::env::var("DENO_PATH").unwrap_or_else(|_| "/usr/bin/deno".to_string()); pub static ref NSJAIL_PATH: String = std::env::var("NSJAIL_PATH").unwrap_or_else(|_| "nsjail".to_string()); pub static ref PATH_ENV: String = std::env::var("PATH").unwrap_or_else(|_| String::new()); @@ -1301,6 +1302,9 @@ mount {{ if let Some(ref env) = *HTTP_PROXY { envs.insert("HTTP_PROXY".to_string(), env.to_string()); } + if let Some(ref env) = *NO_PROXY { + envs.insert("NO_PROXY".to_string(), env.to_string()); + } let result: error::Result = match language { None => {