pub fn builder_rust(root: &Path) -> Result<String, String>Expand description
The exact Rust version a builder stage may pin, read from what the repository declares
in TOOLCHAIN_FILE. A channel that is not a version number (stable, nightly) or no
declaration at all is refused, with the correction: an image built from a floating
channel is not reproducible, and guessing a version would be the second pin this
function exists to prevent.
use majordomus_cli::deploy::render::builder_rust;
let repo = tempfile::tempdir().unwrap();
assert!(builder_rust(repo.path()).is_err(), "no pin, no builder");
std::fs::write(repo.path().join("rust-toolchain.toml"), "[toolchain]\nchannel = \"1.98.1\"\n").unwrap();
assert_eq!(builder_rust(repo.path()).unwrap(), "1.98.1");