Skip to content

Commit 18d3c36

Browse files
authored
Rollup merge of rust-lang#69705 - ehuss:toolstate-remove-redundant-beta, r=Mark-Simulacrum
Toolstate: remove redundant beta-week check. I made a bit of a mistake in rust-lang#69624. The "beta regression" doesn't need to be checked twice. I also rolled up rust-lang#69693 to avoid merge conflicts.
2 parents 2ef7c86 + a41f1f1 commit 18d3c36

File tree

3 files changed

+29
-39
lines changed

3 files changed

+29
-39
lines changed

src/bootstrap/toolstate.rs

+22-33
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,21 @@ impl Step for ToolStateCheck {
215215
tool, old_state, state
216216
);
217217
} else {
218+
// This warning only appears in the logs, which most
219+
// people won't read. It's mostly here for testing and
220+
// debugging.
218221
eprintln!(
219222
"warning: Tool `{}` is not test-pass (is `{}`), \
220223
this should be fixed before beta is branched.",
221224
tool, state
222225
);
223226
}
224227
}
228+
// `publish_toolstate.py` is responsible for updating
229+
// `latest.json` and creating comments/issues warning people
230+
// if there is a regression. That all happens in a separate CI
231+
// job on the master branch once the PR has passed all tests
232+
// on the `auto` branch.
225233
}
226234
}
227235

@@ -230,7 +238,7 @@ impl Step for ToolStateCheck {
230238
}
231239

232240
if builder.config.channel == "nightly" && env::var_os("TOOLSTATE_PUBLISH").is_some() {
233-
commit_toolstate_change(&toolstates, in_beta_week);
241+
commit_toolstate_change(&toolstates);
234242
}
235243
}
236244

@@ -325,11 +333,11 @@ fn prepare_toolstate_config(token: &str) {
325333
Err(_) => false,
326334
};
327335
if !success {
328-
panic!("git config key={} value={} successful (status: {:?})", key, value, status);
336+
panic!("git config key={} value={} failed (status: {:?})", key, value, status);
329337
}
330338
}
331339

332-
// If changing anything here, then please check that src/ci/publish_toolstate.sh is up to date
340+
// If changing anything here, then please check that `src/ci/publish_toolstate.sh` is up to date
333341
// as well.
334342
git_config("user.email", "[email protected]");
335343
git_config("user.name", "Rust Toolstate Update");
@@ -373,14 +381,14 @@ fn read_old_toolstate() -> Vec<RepoState> {
373381
///
374382
/// * See <https://help.github.com/articles/about-commit-email-addresses/>
375383
/// if a private email by GitHub is wanted.
376-
fn commit_toolstate_change(current_toolstate: &ToolstateData, in_beta_week: bool) {
377-
let old_toolstate = read_old_toolstate();
378-
384+
fn commit_toolstate_change(current_toolstate: &ToolstateData) {
379385
let message = format!("({} CI update)", OS.expect("linux/windows only"));
380386
let mut success = false;
381387
for _ in 1..=5 {
382-
// Update the toolstate results (the new commit-to-toolstate mapping) in the toolstate repo.
383-
change_toolstate(&current_toolstate, &old_toolstate, in_beta_week);
388+
// Upload the test results (the new commit-to-toolstate mapping) to the toolstate repo.
389+
// This does *not* change the "current toolstate"; that only happens post-landing
390+
// via `src/ci/docker/publish_toolstate.sh`.
391+
publish_test_results(&current_toolstate);
384392

385393
// `git commit` failing means nothing to commit.
386394
let status = t!(Command::new("git")
@@ -429,31 +437,12 @@ fn commit_toolstate_change(current_toolstate: &ToolstateData, in_beta_week: bool
429437
}
430438
}
431439

432-
fn change_toolstate(
433-
current_toolstate: &ToolstateData,
434-
old_toolstate: &[RepoState],
435-
in_beta_week: bool,
436-
) {
437-
let mut regressed = false;
438-
for repo_state in old_toolstate {
439-
let tool = &repo_state.tool;
440-
let state = repo_state.state();
441-
let new_state = current_toolstate[tool.as_str()];
442-
443-
if new_state != state {
444-
eprintln!("The state of `{}` has changed from `{}` to `{}`", tool, state, new_state);
445-
if new_state < state {
446-
if !NIGHTLY_TOOLS.iter().any(|(name, _path)| name == tool) {
447-
regressed = true;
448-
}
449-
}
450-
}
451-
}
452-
453-
if regressed && in_beta_week {
454-
std::process::exit(1);
455-
}
456-
440+
/// Updates the "history" files with the latest results.
441+
///
442+
/// These results will later be promoted to `latest.json` by the
443+
/// `publish_toolstate.py` script if the PR passes all tests and is merged to
444+
/// master.
445+
fn publish_test_results(current_toolstate: &ToolstateData) {
457446
let commit = t!(std::process::Command::new("git").arg("rev-parse").arg("HEAD").output());
458447
let commit = t!(String::from_utf8(commit.stdout));
459448

src/ci/publish_toolstate.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ GIT_COMMIT_MSG="$(git log --format=%s -n1 HEAD)"
2323
cd rust-toolstate
2424
FAILURE=1
2525
for RETRY_COUNT in 1 2 3 4 5; do
26-
# The purpose is to publish the new "current" toolstate in the toolstate repo.
26+
# The purpose of this is to publish the new "current" toolstate in the toolstate repo.
27+
# This happens post-landing, on master.
28+
# (Publishing the per-commit test results happens pre-landing in src/bootstrap/toolstate.rs).
2729
"$(ciCheckoutPath)/src/tools/publish_toolstate.py" "$GIT_COMMIT" \
2830
"$GIT_COMMIT_MSG" \
2931
"$MESSAGE_FILE" \

src/tools/publish_toolstate.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
# This script publishes the new "current" toolstate in the toolstate repo (not to be
5-
# confused with publishing the test results, which happens in
6-
# `src/ci/docker/x86_64-gnu-tools/checktools.sh`).
7-
# It is set as callback for `src/ci/docker/x86_64-gnu-tools/repo.sh` by the CI scripts
8-
# when a new commit lands on `master` (i.e., after it passed all checks on `auto`).
4+
# This script computes the new "current" toolstate for the toolstate repo (not to be
5+
# confused with publishing the test results, which happens in `src/bootstrap/toolstate.rs`).
6+
# It gets called from `src/ci/publish_toolstate.sh` when a new commit lands on `master`
7+
# (i.e., after it passed all checks on `auto`).
98

109
from __future__ import print_function
1110

0 commit comments

Comments
 (0)