diff --git a/backend/windmill-worker/nsjail/run.bun.config.proto b/backend/windmill-worker/nsjail/run.bun.config.proto index cfe58c4ef6..6368c034e0 100644 --- a/backend/windmill-worker/nsjail/run.bun.config.proto +++ b/backend/windmill-worker/nsjail/run.bun.config.proto @@ -151,7 +151,7 @@ iface_no_lo: true mount { src: "{CACHE_DIR}" - dst: "/tmp/windmill/cache/bun" + dst: "/tmp/windmill/cache_nomount/bun" is_bind: true mandatory: false rw: true diff --git a/backend/windmill-worker/src/bun_executor.rs b/backend/windmill-worker/src/bun_executor.rs index c355a7d53b..4c8051ba4d 100644 --- a/backend/windmill-worker/src/bun_executor.rs +++ b/backend/windmill-worker/src/bun_executor.rs @@ -454,7 +454,6 @@ pub fn copy_recursively( source: impl AsRef, destination: impl AsRef, skip: Option<&Vec>, - no_symlink: bool, ) -> io::Result<()> { let mut stack = Vec::new(); stack.push(( @@ -462,7 +461,6 @@ pub fn copy_recursively( destination.as_ref().to_path_buf(), 0, )); - let mut already_visited_symlinks = std::collections::HashSet::new(); while let Some((current_source, current_destination, level)) = stack.pop() { for entry in fs::read_dir(¤t_source)? { let entry = entry?; @@ -478,33 +476,10 @@ pub fn copy_recursively( let original = entry.path(); if filetype.is_dir() { - if filetype.is_symlink() { - let link = fs::read_link(original)?; - if already_visited_symlinks.contains(&link) { - continue; - } - already_visited_symlinks.insert(link); - } else { - already_visited_symlinks.insert(original); - } fs::create_dir_all(&destination)?; stack.push((entry.path(), destination, level + 1)); } else { - if let Err(e) = fs::hard_link(&original, &destination) { - tracing::error!( - "Could not hard link {original:?} to {destination:?}, trying symlink or copy (no_symlink={no_symlink}): {e:#}" - ); - if no_symlink { - fs::copy(&original, &destination)?; - } else { - if let Err(e) = std::os::unix::fs::symlink(&original, &destination) { - tracing::error!( - "Could not symlink {original:?} to {destination:?}, copying: {e:#}" - ); - fs::copy(&original, &destination)?; - } - } - } + fs::hard_link(&original, &destination)? } } } @@ -589,7 +564,7 @@ pub async fn handle_bun_job( #[cfg(unix)] if tokio::fs::metadata(&buntar_path).await.is_ok() { - if let Err(e) = copy_recursively(&buntar_path, job_dir, None, false) { + if let Err(e) = copy_recursively(&buntar_path, job_dir, None) { tracing::error!("Could not extract buntar: {e:#}"); } else { gbuntar_name = Some(buntar_name.clone()); @@ -627,7 +602,6 @@ pub async fn handle_bun_job( "shared".to_string(), "bunfig.toml".to_string(), ]), - true, ) { fs::remove_dir_all(&buntar_path)?; tracing::error!("Could not create buntar: {e}"); diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index 5bc47ec939..0ce67c01e7 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -226,6 +226,8 @@ pub async fn create_token_for_owner( pub const TMP_LOGS_DIR: &str = concatcp!(TMP_DIR, "/logs"); pub const ROOT_CACHE_DIR: &str = concatcp!(TMP_DIR, "/cache/"); +pub const ROOT_CACHE_NOMOUNT_DIR: &str = concatcp!(TMP_DIR, "/cache_nomount/"); + pub const LOCK_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "lock"); pub const PIP_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "pip"); pub const TAR_PIP_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "tar/pip"); @@ -234,8 +236,8 @@ pub const DENO_CACHE_DIR_DEPS: &str = concatcp!(ROOT_CACHE_DIR, "deno/deps"); pub const DENO_CACHE_DIR_NPM: &str = concatcp!(ROOT_CACHE_DIR, "deno/npm"); pub const GO_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "go"); -pub const BUN_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "bun"); -pub const BUN_TAR_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "buntar"); +pub const BUN_CACHE_DIR: &str = concatcp!(ROOT_CACHE_NOMOUNT_DIR, "bun"); +pub const BUN_TAR_CACHE_DIR: &str = concatcp!(ROOT_CACHE_NOMOUNT_DIR, "buntar"); pub const HUB_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "hub"); pub const GO_BIN_CACHE_DIR: &str = concatcp!(ROOT_CACHE_DIR, "gobin"); diff --git a/docker-compose.yml b/docker-compose.yml index 9fe4baa749..3deab4352a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,7 +61,7 @@ services: volumes: # mount the docker socket to allow to run docker containers from within the workers - /var/run/docker.sock:/var/run/docker.sock - - worker_dependency_cache:/tmp/windmill/cache + # - worker_dependency_cache:/tmp/windmill/cache - worker_logs:/tmp/windmill/logs ## This worker is specialized for "native" jobs. Native jobs run in-process and thus are much more lightweight than other jobs