Auto merge of #131453 - onur-ozkan:llvm-ci-check-for-rustc-ci, r=Kobzol

disable `download-rustc` if LLVM submodule has changes in CI

We can't use CI rustc while using in-tree LLVM (which happens in LLVM submodule update PRs) and this PR handles that by ignoring CI-rustc in CI and failing in non-CI environments.
This commit is contained in:
bors 2024-10-10 08:31:30 +00:00
commit de19f2b73d

View File

@ -2399,6 +2399,20 @@ pub(crate) fn download_rustc_commit(&self) -> Option<&str> {
Some(commit) => { Some(commit) => {
self.download_ci_rustc(commit); self.download_ci_rustc(commit);
// CI-rustc can't be used without CI-LLVM. If `self.llvm_from_ci` is false, it means the "if-unchanged"
// logic has detected some changes in the LLVM submodule (download-ci-llvm=false can't happen here as
// we don't allow it while parsing the configuration).
if !self.llvm_from_ci {
// This happens when LLVM submodule is updated in CI, we should disable ci-rustc without an error
// to not break CI. For non-CI environments, we should return an error.
if CiEnv::is_ci() {
println!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled.");
return None;
} else {
panic!("ERROR: LLVM submodule has changes, `download-rustc` can't be used.");
}
}
if let Some(config_path) = &self.config { if let Some(config_path) = &self.config {
let ci_config_toml = match self.get_builder_toml("ci-rustc") { let ci_config_toml = match self.get_builder_toml("ci-rustc") {
Ok(ci_config_toml) => ci_config_toml, Ok(ci_config_toml) => ci_config_toml,