You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a built-in way for rustup to adapt to a CI environment #5011
Discussed at the rust all-hands, it was suggested that it'd be good if rustup had better support for CI scenarios so it's less necessary for people to rely on third parties to provide them. This issue is intended to explore the existing options and see what we can adopt into rustup itself and how we can do so.
I guess the first big question is, if we want to do this, how do we want to go about setting environment variables? We could set them whenever cargo is called (but only if they're not set in the environment). Or we could have a command that outputs them to stdout and let the user redirect that as needed (e.g. github actions uses $GITHUB_ENV).
if cfg.process.var("CI").is_ok() && cfg.process.var("RUSTUP_CI").is_err(){
// If we're in CI (but not rustup's own CI, which wants to test this stuff!),
// disable automatic self updates.
returnOk(Self::Disable);
}
So the only thing to do on this point would be to default to --profile minimal. Though that could technically break people (I'm unsure what the actual impact would be).
I guess the first big question is, if we want to do this, how do we want to go about setting environment variables? We could set them whenever cargo is called (but only if they're not set in the environment). Or we could have a command that outputs them to stdout and let the user redirect that as needed
@ChrisDenton I think if I remember correctly from the discussion then our hypothetical GitHub Actions integration will take care of the forge-specific configurations, so as far as rustup is concerned the second option seems more reasonable, given that the env vars you want to set is, I assume, universal to any forge?
The problem matchers may be specific to particular forges but I figured they're spiritually similar to completions. Maybe we just need a command to install them.
A command that output environment variables for CI in .env format
A command that gives a path to the problem matcher(s) (probably only gha will be supported initially)
So should we have a new ci command? E.g. rustup ci env or rustup ci matchers github.
@ChrisDenton Sounds good to me! If you're not sure of the final naming, we can always hide the subcommand in clap first: we already have a few hidden subcommands actually.
They do not have to be and long term it'd be nice if they weren't. However, as far as I'm aware Cargo can only change future versions of Cargo whereas rustup can provide a more or less consistent configuration for older versions (as much as that is possible).
If the problem is ensuring the Cargo team has ownership of the Cargo bits then I think we can figure out a technical solution to that. E.g. a crate that lives in the Cargo repo or maybe even just a single configuration file we can mirror in the rustup repo.
Is the impact of prior releases enough to make this central to the design? From what I've seen, people are generally on stable except for MSRV verification jobs which are not usually in the critical path of performance or behavior.
Is the impact of prior releases enough to make this central to the design?
@epage I don't think so; the previous offline discussion at the all hands merely discussed the possibility of making a part of the current setup actions native to rustup. It is just that when looking at the prior art it seems that the existing solutions all tinker with the default cargo config.
From my perspective I don't particularly care whether rustup or cargo is delivering the required config options, as long as they are delivered to most of our users.
If cargo is moving towards the same direction then I'd love to merge a simpler version without any cargo bits, at least for the first step.
That would just leave problem matchers for a ci subcommand, right?
How do we plan to verify them? I just removed them from typos because of that problem. What I need to do i change typos action to use sarif. I use a tool to use sarif for clippy and would be interested in that as an end-goal for cargo. I wonder if problem matchers are worth thee hassle but I am biased in that I've been using dtolnay's action which doesn't have them.
That would just leave problem matchers for a ci subcommand, right?
@epage Currently removing all things cargo and rustup1 leaves me with:
RUST_BACKTRACE=short
... I think that probably deserves a separate discussion but the rustup ci env subcommand is just for this one line then it might not be worth it, indeed.
How do we plan to verify them?
That's a good question!
https://github.com/r7kamura/rust-problem-matchers doesn't have a test suite but I'm looking at something like what GitHub does in setup-go where you basically write a small interpreter and verify at least the regex declarations are correct.
Footnotes
As for rustup we could also add some rustup-specific stuff here such as RUSTUP_PERMIT_COPY_RENAME=1, but in the goal of minimizing this I can let CI=1 imply everything we need to override in rustup in CI environments. ↩
Activity
ChrisDenton commentedon Aug 11, 2026
I guess the first big question is, if we want to do this, how do we want to go about setting environment variables? We could set them whenever
cargois called (but only if they're not set in the environment). Or we could have a command that outputs them to stdout and let the user redirect that as needed (e.g. github actions uses$GITHUB_ENV).ChrisDenton commentedon Aug 11, 2026
We've already disabled self-update in CI for a long time now:
rustup/src/cli/self_update.rs
Lines 482 to 486 in 8e6dbd2
--profile minimal. Though that could technically break people (I'm unsure what the actual impact would be).djc commentedon Aug 11, 2026
I would guess that's going to be fairly breaking.
ChrisDenton commentedon Aug 11, 2026
Yeah. We could provide an opt-in command like
rustup setup CIor something like that so we can make such breaking changes.rami3l commentedon Aug 11, 2026
@djc If we are talking about GitHub, then maybe we are not introducing any new breakages at all since they are not using our default config: #4337
rustup/CHANGELOG.md
Lines 337 to 340 in 8e6dbd2
AFAIK GitHub defaults to the
minimalprofile.Also related to: #3078
rami3l commentedon Aug 11, 2026
@ChrisDenton I think if I remember correctly from the discussion then our hypothetical GitHub Actions integration will take care of the forge-specific configurations, so as far as rustup is concerned the second option seems more reasonable, given that the env vars you want to set is, I assume, universal to any forge?
ChrisDenton commentedon Aug 11, 2026
Yes, there shouldn't be any GitHub specific environment variables we set.
ChrisDenton commentedon Aug 11, 2026
The problem matchers may be specific to particular forges but I figured they're spiritually similar to completions. Maybe we just need a command to install them.
ChrisDenton commentedon Aug 12, 2026
Ok so concretely we need at least:
So should we have a new
cicommand? E.g.rustup ci envorrustup ci matchers github.rami3l commentedon Aug 12, 2026
@ChrisDenton Sounds good to me! If you're not sure of the final naming, we can always hide the subcommand in clap first: we already have a few hidden subcommands actually.
rami3l commentedon Aug 17, 2026
If you don't mind I'd love to claim this.
@rustbot claim
ChrisDenton commentedon Aug 17, 2026
Feel free!
CARGO_TERM_COLORautomatically in GitLab CI cargo#16969 as a duplicate of this issueepage commentedon Aug 25, 2026
Why are the cargo parts in rustup?
CARGO_TERM_COLORautomatically in GitLab CI cargo#16969 as a duplicate of this issueChrisDenton commentedon Aug 25, 2026
They do not have to be and long term it'd be nice if they weren't. However, as far as I'm aware Cargo can only change future versions of Cargo whereas rustup can provide a more or less consistent configuration for older versions (as much as that is possible).
ChrisDenton commentedon Aug 25, 2026
If the problem is ensuring the Cargo team has ownership of the Cargo bits then I think we can figure out a technical solution to that. E.g. a crate that lives in the Cargo repo or maybe even just a single configuration file we can mirror in the rustup repo.
epage commentedon Aug 26, 2026
Is the impact of prior releases enough to make this central to the design? From what I've seen, people are generally on stable except for MSRV verification jobs which are not usually in the critical path of performance or behavior.
bjorn3 commentedon Aug 26, 2026
Perhaps line-tables-only instead to avoid regressing backtraces in test failures?
rami3l commentedon Aug 26, 2026
@epage I don't think so; the previous offline discussion at the all hands merely discussed the possibility of making a part of the current setup actions native to rustup. It is just that when looking at the prior art it seems that the existing solutions all tinker with the default cargo config.
From my perspective I don't particularly care whether rustup or cargo is delivering the required config options, as long as they are delivered to most of our users.
If cargo is moving towards the same direction then I'd love to merge a simpler version without any cargo bits, at least for the first step.
epage commentedon Aug 26, 2026
That would just leave problem matchers for a
cisubcommand, right?How do we plan to verify them? I just removed them from typos because of that problem. What I need to do i change typos action to use sarif. I use a tool to use sarif for clippy and would be interested in that as an end-goal for cargo. I wonder if problem matchers are worth thee hassle but I am biased in that I've been using dtolnay's action which doesn't have them.
rami3l commentedon Aug 26, 2026
@epage Currently removing all things cargo and rustup1 leaves me with:
... I think that probably deserves a separate discussion but the
rustup ci envsubcommand is just for this one line then it might not be worth it, indeed.That's a good question!
https://github.com/r7kamura/rust-problem-matchers doesn't have a test suite but I'm looking at something like what GitHub does in setup-go where you basically write a small interpreter and verify at least the regex declarations are correct.
Footnotes
As for rustup we could also add some rustup-specific stuff here such as
RUSTUP_PERMIT_COPY_RENAME=1, but in the goal of minimizing this I can letCI=1imply everything we need to override in rustup in CI environments. ↩