oxidecomputer / buildomat

a software build labour-saving device
Mozilla Public License 2.0
53 stars 2 forks source link

want to be able to get a job's rust toolchain from `rust-toolchain.toml` #55

Closed hawkw closed 2 months ago

hawkw commented 4 months ago

Currently, a Buildomat job can have a rust_toolchain = <string> configuration key to install Rustup and the specified toolchain. Many projects use a rust-toolchain.toml file to specify the Rust version and additional components that should be used to build the repo. However, a project which has a rust-toolchain.toml must duplicate the toolchain version in any Buildomat jobs it defines which require Rust to be present. It would be nice to be able to use the toolchain file as a single source of truth, so that changing the toolchain version only requires changing rust-toolchain.toml For instance, see: https://github.com/oxidecomputer/hubris/pull/1748#discussion_r1566003910

If I understand correctly, the presence of the rust-toolchain = configuration is also what tells Buildomat that a job requires rustup at all. Therefore, I think we probably want to specify that the toolchain file should be used using either a new value (e.g. rust-toolchain = "file:rust-toolchain.toml") or a new config (maybe rust-toolchain-file = "rust-toolchain.toml" or something?). This way, we can still avoid installing Rustup for builds that don't need it.

I'd be happy to have a go at implementing this, potentially.

jclulow commented 4 months ago

Yes I think we could just accept true for the existing rust_toolchain property instead of a string, and have that do whatever rustup usually does as much as possible with the toolchain files.

jclulow commented 2 months ago

I have implemented support for rust_toolchain = true in ccaf3cdfe68a63d7edb057e38dfe0460cd769f7f, which is now live. From the updated documentation:

It is also possible to use the boolean value true here, at which point the system will interpret the contents of the rust-toolchain.toml file in the root of the repository to decide what to install. The file must contain a valid channel value, and may also contain a valid profile value. Neither the legacy (pre-TOML) file format, nor TOML files which contain the path directive, are supported.

#: rust_toolchain = true