Azure / azure-init

A minimal provisioning agent designed for Azure Linux VMs.
MIT License
7 stars 10 forks source link

[RFE] Select a MSRV #93

Closed jeremycline closed 2 weeks ago

jeremycline commented 3 weeks ago

Current situation

Prior to #84 we didn't declare a Minimum Supported Rust Version. Based on #92 1.76 is too new. We should select a MSRV deemed acceptably old and add it to CI to ensure we work with it.

Impact

While it's fairly easy to get the latest versions of Rust via rustup, distributions often lag behind current Rust releases by a lot. It's possible to build with a new toolchain and use the result on older distros, but if we want to build with the distribution toolchains we'll need to be more conservative about using new stdlib features.

Implementation options

Debian 12 looks to ship 1.63. I believe the latest RHEL 9 minor version includes 1.75.

If the goal is to build with distro-shipped toolchains we'll need to go back to at least 1.63 which shipped in August of 2022.

If we're okay not building with distro toolchains we could pick whatever the project currently builds with and call it a day. That way we are at least explicit about what we support.

dongsupark commented 2 weeks ago

Let's try to run CI with both toolchains, "stable" and "a fairly old version that is still wide-spread". Question is how do we figure out the latter in an automated way, without having to depend on Rust versions of specific distros.

I am thinking about using specific syntax supported by dtolnay/rust-toolchain, like:

      matrix:
        rust: [stable, stable 18 months ago]
...
  - uses: dtolnay/rust-toolchain@master
    with:
      toolchain: ${{matrix.rust}}

As of now "stable 18 months ago" means around 1.67 from Jan 2023, that looks already old enough I suppose.

To do that, we would need to switch from the current actions-rs/toolchain to dtolnay/rust-toolchain action. That is reasonable because actions-rs/toolchain is almost unmaintained.

dongsupark commented 2 weeks ago

As of now "stable 18 months ago" means around 1.67 from Jan 2023, that looks already old enough I suppose.

Actually the current source cannot be built with Rust 1.66.1, 18 months ago, because:

error: package `nix v0.29.0` cannot be built because it requires rustc 1.69 or newer, while the currently active rustc version is 1.66.1
Either upgrade to rustc 1.69 or newer, or use
cargo update -p nix@0.29.0 --precise ver
where `ver` is the latest version of `nix` supporting rustc 1.66.1

That is a good example of why it is hard to support compilation with such an ancient compiler.

So I went with "stable 12 months ago", Rust 1.70. Will soon create a PR.