Skip to content

Commit 20f9b0c

Browse files
committed
download-rustc: Don't consider the current commit for download if running in CI
Avoids the following error: ``` curl: (22) The requested URL returned error: 404 error: failed to download pre-built rustc from CI note: old builds get deleted after a certain time help: if trying to compile an old commit of rustc, disable `download-rustc` in config.toml: [rust] download-rustc = false ``` Note that this strategy is more complicated than the one for download-ci-llvm, which doesn't have to deal with rollup commits. Eventually we should probably adopt this for LLVM too, to avoid bugs if someone forgets to mark an LLVM bump as rollup=never. I tested this with `git -c [email protected] -c user.name=bors commit --allow-empty -m 'test bors commit' && GITHUB_ACTIONS=true x check`.
1 parent a6dcffa commit 20f9b0c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bootstrap/config.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use crate::channel::{self, GitInfo};
2323
pub use crate::flags::Subcommand;
2424
use crate::flags::{Color, Flags, Warnings};
2525
use crate::util::{exe, output, t};
26+
use build_helper::ci::CiEnv;
2627
use build_helper::detail_exit_macro;
2728
use once_cell::sync::OnceCell;
2829
use semver::Version;
@@ -1985,11 +1986,15 @@ impl Config {
19851986

19861987
// Look for a version to compare to based on the current commit.
19871988
// Only commits merged by bors will have CI artifacts.
1989+
1990+
// If we are running in CI, the current commit will never have artifacts already built.
1991+
let tip_commit = if CiEnv::is_ci() { "HEAD^" } else { "HEAD" };
1992+
// FIXME(#113250): This may not be the best way to find the right commit; it certainly doesn't match what we do for LLVM.
19881993
let merge_base = output(
19891994
self.git()
19901995
.arg("rev-list")
19911996
.arg(format!("--author={}", self.stage0_metadata.config.git_merge_commit_email))
1992-
.args(&["-n1", "--first-parent", "HEAD"]),
1997+
.args(&["-n1", "--first-parent", tip_commit]),
19931998
);
19941999
let commit = merge_base.trim_end();
19952000
if commit.is_empty() {

0 commit comments

Comments
 (0)