fix: set NETRC at init and not for every job

This commit is contained in:
Ruben Fiszel
2023-08-17 11:54:11 +02:00
parent 8a3eb8eb52
commit 359845fa9d
2 changed files with 6 additions and 4 deletions
+1 -4
View File
@@ -18,7 +18,7 @@ use crate::{
common::{capitalize, read_result, set_logs},
create_args_and_out_file, get_reserved_variables, handle_child, write_file,
AuthedClientBackgroundTask, DISABLE_NSJAIL, DISABLE_NUSER, GOPRIVATE, GOPROXY,
GO_BIN_CACHE_DIR, GO_CACHE_DIR, HOME_ENV, NETRC, NSJAIL_PATH, PATH_ENV,
GO_BIN_CACHE_DIR, GO_CACHE_DIR, HOME_ENV, NSJAIL_PATH, PATH_ENV,
};
const GO_REQ_SPLITTER: &str = "//go.sum\n";
@@ -238,9 +238,6 @@ func Run(req Req) (interface{{}}, error){{
.stderr(Stdio::piped())
.spawn()?
} else {
if let Some(ref netrc) = *NETRC {
write_file(&HOME_ENV, ".netrc", netrc).await?;
}
let mut run_go = Command::new("./main");
run_go
.current_dir(job_dir)
+5
View File
@@ -332,6 +332,11 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
let worker_dir = format!("{TMP_DIR}/{worker_name}");
tracing::debug!(worker_dir = %worker_dir, worker_name = %worker_name, "Creating worker dir");
if let Some(ref netrc) = *NETRC {
tracing::info!("Writing netrc at {}/.netrc: {}", HOME_ENV.as_str(), netrc);
write_file(&HOME_ENV, ".netrc", netrc).await.expect("could not write netrc");
}
DirBuilder::new()
.recursive(true)
.create(&worker_dir)