Respect the --ci flag in more places in bootstrap#152734
Respect the --ci flag in more places in bootstrap#152734Shunpoco wants to merge 2 commits intorust-lang:mainfrom
--ci flag in more places in bootstrap#152734Conversation
This comment has been minimized.
This comment has been minimized.
9cbfad4 to
3d26693
Compare
This comment has been minimized.
This comment has been minimized.
|
Replacing uses of |
|
Thanks, now I understand that bootstrap's --ci flag should not integrated into CiEnv. But I still think it's worth to introduce What do you think about it? |
3d26693 to
960683b
Compare
Why? That's exactly what should happen, if we override the mode to |
|
Because CiEnv has But if you think all CI env should go to CiEnv::GithubActions, I think that's fine. your way is much simpler than what I thought (now I feel that I was thinking too much). So can I write such a code in bootstrap config's parse_inner()? let ci_env = match flags_ci {
Some(true) => CiEnv::GitHubActions,
Some(false) => CiEnv::None,
None => CiEnv::current(),
}; |
It's actually the other way around - we used to have more variants there (e.g. Azure pipelines), but those were removed as they stopped being used in our CI. We don't really explicitly support any downstream usage of our CI, so we only maintain what we use upstream, and that is currently just GitHub Actions. We could turn
Yeah, sounds reasonable, because we anyway have to pass |
|
r? kobzol |
|
Thanks for the clarification! Now I fully understand that. |
--ci flag in bootstrap is not respected in some cases. This commit modifies such inconsistencies in the tool.
960683b to
0596a08
Compare
src/build_helper/src/ci.rs
Outdated
| @@ -1,6 +1,7 @@ | |||
| #[derive(Copy, Clone, PartialEq, Eq, Debug)] | |||
| #[derive(Copy, Clone, PartialEq, Eq, Debug, Default)] | |||
There was a problem hiding this comment.
Default is a bit of a footgun here, and it's unclear to me that not being on CI is a good default anyway. ::current() should be used instead.
Since default seems to be unused, I think that you can just revert this change?
There was a problem hiding this comment.
I added Default to CiEnv because bootstrap's Config has Default (now ci_env is a member of Config).
But I just find that no one use Config::default(), so I will drop Default from both Config and CiEnv.
Update: I dropped Defaults in 7e22e90
--ci flag in more places in bootstrap
|
Thank you, left one nit. After fixing it, you can r=me. @bors delegate |
Motivation
Currently, the way of checking CI environment in bootstrap is not unified. Sometimes
--ciflag is respected, but in other cases only GITHUB_ACTIONS env var is checked.Change
This PR modifies the way of treating the flag in bootstrap. If
--ci(or--ci=true) is added, bootstrap's config set ci_env asCiEnv::GithubActions. This PR also modifies some lines in bootstrap to respect the config's CiEnv instance.Note
I haven't touched anything in tidy, because I want to raise another PR for introducing --ci flag in tidy. In the PR, I will need to change how tidy treats CI information. So currently I leave it as it is.