diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-10-28 23:21:20 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-10-28 23:28:04 +0200 |
commit | 8b71986fe1d7a6a889cbb437294b76b22a1e7377 (patch) | |
tree | b09e7687ff33adc98548aa254dc2e689c82e992d /crates/runner/src | |
parent | fc117b0900cfcba6f5f87882e15c7d263171f6c3 (diff) | |
download | rebel-8b71986fe1d7a6a889cbb437294b76b22a1e7377.tar rebel-8b71986fe1d7a6a889cbb437294b76b22a1e7377.zip |
Pass workdir from driver to runner
The paths modules of driver and runner do not contain any duplicates
anymore. One remaining path that still appears in more places than it
should is /build.
Diffstat (limited to 'crates/runner/src')
-rw-r--r-- | crates/runner/src/paths.rs | 1 | ||||
-rw-r--r-- | crates/runner/src/task.rs | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/crates/runner/src/paths.rs b/crates/runner/src/paths.rs index 660021c..738cb54 100644 --- a/crates/runner/src/paths.rs +++ b/crates/runner/src/paths.rs @@ -60,7 +60,6 @@ pub const TASK_STATE_WORK_SUBDIR: &str = "work"; pub const TASK_BUILDDIR: &str = "build"; pub const TASK_TASKDIR: &str = "build/task"; -pub const TASK_WORKDIR: &str = "build/work"; pub const TASK_RUN: &str = "run"; diff --git a/crates/runner/src/task.rs b/crates/runner/src/task.rs index a909d22..47fa9e4 100644 --- a/crates/runner/src/task.rs +++ b/crates/runner/src/task.rs @@ -44,12 +44,14 @@ fn input_hash(task: &Task) -> InputHash { #[derive(Debug, Serialize)] struct HashInput<'a> { pub command: &'a str, + pub workdir: &'a str, pub inherit: &'a [LayerHash], pub depends: HashMap<DependencyHash, &'a Dependency>, pub outputs: &'a HashMap<String, String>, } let input = HashInput { command: &task.command, + workdir: &task.workdir, inherit: &task.inherit, depends: task .depends @@ -83,7 +85,7 @@ fn init_task(input_hash: &InputHash, task: &Task) -> Result<fs::Mount> { std::fs::write(&runfile, &task.command) .with_context(|| format!("Failed to write {}", runfile))?; - let mount_target = paths::join(&[&task_tmp_dir, paths::TASK_WORKDIR]); + let mount_target = paths::join(&[&task_tmp_dir, &task.workdir]); let mount = if task.inherit.is_empty() { fs::mount(task_layer_dir, &mount_target, None, MsFlags::MS_BIND, None) .with_context(|| format!("Failed to bind mount to {:?}", mount_target))? |