Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(manager/rust-toolchain): Add support for rust toolchain versioning #32432

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

kyle-leonhard
Copy link

@kyle-leonhard kyle-leonhard commented Nov 10, 2024

Changes

This PR adds a new manager that manages Rust toolchain versions in rust-toolchain.toml files based on releases in the rust-lang/rust github repository. The relevant Rust docs are here: https://rust-lang.github.io/rustup/overrides.html

Context

Renovate supports updating Cargo crates but not the Rust toolchain itself. This has been discussed here, for example: #24762.

Rust allows for the toolchain version (e.g. 1.82.0) to be specified as an override in the channel key in a rust-toolchain.toml file (docs). The version may be specified either as a fully qualified version (e.g. 1.82.0) a major.minor version (e.g. 1.82) or as a named release (e.g. beta, nightly, stable, nightly-2014-11-15). This PR ignores named releases.

https://github.com/rust-lang/rust releases are the datasource.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@kyle-leonhard kyle-leonhard changed the title Add support for rust toolchain versioning feat(manager/rust): Add support for rust toolchain versioning Nov 10, 2024
docs/usage/rust.md Outdated Show resolved Hide resolved
lib/modules/manager/api.ts Show resolved Hide resolved
lib/modules/versioning/rust/index.ts Outdated Show resolved Hide resolved
lib/modules/manager/rust/readme.md Outdated Show resolved Hide resolved
lib/modules/versioning/rust/index.spec.ts Outdated Show resolved Hide resolved
lib/modules/versioning/rust/index.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/rust/index.ts Outdated Show resolved Hide resolved
lib/modules/manager/rust/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/rust/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/rust/extract.ts Outdated Show resolved Hide resolved
docs/usage/rust.md Outdated Show resolved Hide resolved
docs/usage/rust.md Outdated Show resolved Hide resolved
lib/modules/manager/api.ts Outdated Show resolved Hide resolved
lib/modules/versioning/rust/index.ts Outdated Show resolved Hide resolved
lib/modules/manager/rust/extract.ts Outdated Show resolved Hide resolved
Co-authored-by: Rhys Arkins <[email protected]>
@kyle-leonhard kyle-leonhard changed the title feat(manager/rust): Add support for rust toolchain versioning feat(manager/rust-toolchain): Add support for rust toolchain versioning Nov 13, 2024
@kyle-leonhard
Copy link
Author

Hey @rarkins , thanks for bearing with me as I figured things out. I appreciate it.

I think things are in a good place now. Do you mind triggering the workflows once more and giving things a look?

Is there a good way to try this out locally before merging, beyond unit tests? I'm betting on the renovate CLI

@rarkins
Copy link
Collaborator

rarkins commented Nov 19, 2024

If you mean test out your own (new) functionality then you can run pnpm start ... just like you'd run renovate ... normally.

lib/modules/manager/rust-toolchain/extract.ts Show resolved Hide resolved
describe('modules/manager/rust-toolchain/extract', () => {
describe('extractPackageFile()', () => {
it('returns result when fully qualified version is set', () => {
const res = extractPackageFile(`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use codeBlock template helper for proper indention


export function extractPackageFile(content: string): PackageFileContent {
const deps: PackageDependency[] = [];
for (const match of regexMatchAll(channelRegex, content)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theres only one occurrence, so need of match all

I would prefer to use our toml parser and zod schema validation. so we don't have false deps when they extend the format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants