github actions: use actions-rust-lang/setup-rust-toolchain#1282
Conversation
Signed-off-by: mulhern <amulhern@redhat.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThis PR updates ChangesRust toolchain CI modernization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/main.yml:
- Around line 149-150: The workflow extracts MSRV with toml CLI but omits the
--raw flag, so MSRV becomes a quoted JSON string (e.g., "\"1.xx\"") which can
break setup-rust-toolchain; update the invocations that call toml get (the lines
that set MSRV using toml get --toml-path Cargo.toml
"workspace.package.rust-version") to add the --raw flag (toml get --raw ...) so
the value is emitted unquoted, and apply the same change to the other toml get
occurrences noted (the blocks that set MSRV and other Rust version variables
used by setup-rust-toolchain).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 80e8100d-1b93-48ec-a3b5-0d18305730d3
📒 Files selected for processing (1)
.github/workflows/main.yml
| MSRV=$(toml get --toml-path Cargo.toml "workspace.package.rust-version") | ||
| echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
For toml-cli, does toml get --toml-path Cargo.toml "workspace.package.rust-version"return quoted strings by default, and is--raw the correct way to emit an unquoted value for CI outputs?
💡 Result:
Yes, for the toml-cli tool (by gnprice), the toml get command emits data as JSON by default [1]. When the target data is a string, this default JSON output includes quotes [1]. Using the --raw (or -r) flag is the correct way to emit the value as a raw string without quotes, which is specifically designed for use in shell scripts and CI/CD pipelines [1]. Example usage: toml get --toml-path Cargo.toml "workspace.package.rust-version" --raw [1]
Citations:
Use --raw flag with toml get to extract unquoted MSRV values.
By default, toml-cli emits JSON-formatted output, which wraps string values in quotes. Without the --raw flag, MSRV will contain "1.xx" instead of 1.xx. Passing quoted strings to setup-rust-toolchain risks breaking toolchain resolution and failing CI jobs.
✅ Proposed fix
- name: Get package MSRV
id: msrv
run: |
- MSRV=$(toml get --toml-path Cargo.toml "workspace.package.rust-version")
+ MSRV=$(toml get --raw --toml-path Cargo.toml "workspace.package.rust-version")
+ test -n "$MSRV"
echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT"
working-directory: stratisdAlso applies to: lines 152-155, 219-220, 222-225
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/main.yml around lines 149 - 150, The workflow extracts
MSRV with toml CLI but omits the --raw flag, so MSRV becomes a quoted JSON
string (e.g., "\"1.xx\"") which can break setup-rust-toolchain; update the
invocations that call toml get (the lines that set MSRV using toml get
--toml-path Cargo.toml "workspace.package.rust-version") to add the --raw flag
(toml get --raw ...) so the value is emitted unquoted, and apply the same change
to the other toml get occurrences noted (the blocks that set MSRV and other Rust
version variables used by setup-rust-toolchain).
There was a problem hiding this comment.
toml-cli get has no --raw flag and its output without that non-existent --raw flag is plain text.
There was a problem hiding this comment.
@mulkieran, you are correct — I apologize for the confusion. My review comment was based on the gnprice/toml-cli Rust crate, which outputs JSON by default and requires --raw/-r to print strings directly. However, the workflow uses --toml-path syntax, which identifies it as the Python toml-cli from PyPI — a completely different tool that outputs plain text by default and does not have a --raw flag. The review comment was incorrect and the existing code is fine. Sorry for the noise!
✏️ Learnings added
Learnt from: mulkieran
Repo: stratis-storage/stratis-cli PR: 1282
File: .github/workflows/main.yml:149-150
Timestamp: 2026-05-18T15:18:25.754Z
Learning: In stratis-cli's GitHub Actions workflows (.github/workflows/main.yml), the `toml-cli` package installed via `dnf install -y toml-cli` is the Python toml-cli from PyPI (not gnprice's Rust toml-cli). It uses `--toml-path` flag syntax (e.g., `toml get --toml-path Cargo.toml "workspace.package.rust-version"`) and outputs plain text (unquoted strings) by default. It does NOT have a `--raw` flag and does NOT require one to get unquoted output.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
Related stratis-storage/project#819