diff --git a/CHANGELOG.md b/CHANGELOG.md index 75759550..16fb88b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.29.0] - 2019-07-11 + +### Changed +- `mount_paths` are now allowed to be absolute. This is to support mounting the Docker IPC socket (usually located at `/var/run/docker.sock`) in the container for running Docker commands in tasks. + ## [0.28.0] - 2019-06-30 ### Changed diff --git a/Cargo.lock b/Cargo.lock index 344a5314..10769c7c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -906,7 +906,7 @@ dependencies = [ [[package]] name = "toast" -version = "0.28.0" +version = "0.29.0" dependencies = [ "atty 0.2.11 (registry+/~https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+/~https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 6b1221d9..620caf07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "toast" -version = "0.28.0" +version = "0.29.0" authors = ["Stephan Boyer "] description = "Containerize your development and continuous integration environments." license = "MIT" diff --git a/src/toastfile.rs b/src/toastfile.rs index e708333a..c09323f2 100644 --- a/src/toastfile.rs +++ b/src/toastfile.rs @@ -41,7 +41,8 @@ pub struct Task { #[serde(default)] pub output_paths: Vec, - // Must be relative [ref:mount_paths_relative] + // Can be relative or absolute (absolute paths are allowed in order to support mounting the + // Docker socket, which is usually located at `/var/run/docker.sock`) // Must not contain `,` [ref:mount_paths_no_commas] // Must be empty if `cache` is enabled [ref:mount_paths_nand_cache] #[serde(default)] @@ -347,19 +348,6 @@ fn check_task(name: &str, task: &Task) -> Result<(), Failure> { // Check `mount_paths`. for path in &task.mount_paths { - // Check that the path is relative. [tag:mount_paths_relative] - if path.is_absolute() { - return Err(Failure::User( - format!( - "Task {} has an absolute {}: {}.", - name.code_str(), - "mount_path".code_str(), - path.to_string_lossy().code_str() - ), - None, - )); - } - // Check that the path doesn't contain any commas. [tag:mount_paths_no_commas] if path.to_string_lossy().contains(',') { return Err(Failure::User( @@ -1135,7 +1123,7 @@ tasks: let task = Task { description: None, dependencies: vec![], - cache: true, + cache: false, environment: HashMap::new(), input_paths: vec![], output_paths: vec![Path::new("/bar").to_owned()], @@ -1157,7 +1145,7 @@ tasks: let task = Task { description: None, dependencies: vec![], - cache: true, + cache: false, environment: HashMap::new(), input_paths: vec![], output_paths: vec![], @@ -1169,9 +1157,7 @@ tasks: command: String::new(), }; - let result = check_task("foo", &task); - assert!(result.is_err()); - assert!(result.unwrap_err().to_string().contains("/bar")); + assert!(check_task("foo", &task).is_ok()); } #[test]