Skip to content

Commit 50838e8

Browse files
Merge pull request #1066 from Mark-Simulacrum/debug-failed-posts
Fix not queueing TryParent into pull_request_builds
2 parents 320e018 + 1238e70 commit 50838e8

File tree

4 files changed

+47
-14
lines changed

4 files changed

+47
-14
lines changed

site/src/github.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -521,12 +521,14 @@ pub async fn post_finished(ctxt: &SiteCtxt) {
521521
conn.queued_commits(),
522522
conn.in_progress_artifacts()
523523
);
524-
let master_commits = if let Ok(mcs) = master_commits {
525-
mcs.into_iter().map(|c| c.sha).collect::<HashSet<_>>()
526-
} else {
527-
// If we can't fetch master commits, return.
528-
// We'll eventually try again later
529-
return;
524+
let master_commits = match master_commits {
525+
Ok(mcs) => mcs.into_iter().map(|c| c.sha).collect::<HashSet<_>>(),
526+
Err(e) => {
527+
log::error!("posting finished did not load master commits: {:?}", e);
528+
// If we can't fetch master commits, return.
529+
// We'll eventually try again later
530+
return;
531+
}
530532
};
531533

532534
for aid in in_progress_artifacts {
@@ -606,7 +608,7 @@ fn master_run_body(direction: Option<Direction>) -> String {
606608

607609
format!(
608610
"
609-
{next_steps}
611+
{next_steps}
610612
611613
@rustbot label: {label}",
612614
next_steps = next_steps,
@@ -637,7 +639,7 @@ Benchmarking this pull request likely means that it is \
637639
perf-sensitive, so we're automatically marking it as not fit \
638640
for rolling up. While you can manually mark this PR as fit \
639641
for rollup, we strongly recommend not doing so since this PR led to changes in \
640-
compiler perf.{next_steps}
642+
compiler perf.{next_steps}
641643
642644
@bors rollup=never
643645
@rustbot label: +S-waiting-on-review -S-waiting-on-perf {label}",

site/src/load.rs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ pub enum MissingReason {
2424
Master {
2525
pr: u32,
2626
parent_sha: String,
27+
is_try_parent: bool,
2728
},
28-
TryParent,
2929
Try {
3030
pr: u32,
3131
include: Option<String>,
@@ -214,6 +214,7 @@ fn calculate_missing_from(
214214
MissingReason::Master {
215215
pr: c.pr.unwrap_or(0),
216216
parent_sha: c.parent_sha,
217+
is_try_parent: false,
217218
},
218219
)
219220
})
@@ -235,11 +236,31 @@ fn calculate_missing_from(
235236
// Enqueue the `TryParent` commit before the `TryCommit` itself, so that
236237
// all of the `try` run's data is complete when the benchmark results
237238
// of that commit are available.
238-
if let Some((try_parent, _)) = master_commits
239+
if let Some((try_parent, metadata)) = master_commits
239240
.iter()
240241
.find(|(m, _)| m.sha == parent_sha.as_str())
241242
{
242-
missing.push((try_parent.clone(), MissingReason::TryParent));
243+
let (pr, parent_sha) = if let MissingReason::Master {
244+
pr,
245+
parent_sha,
246+
is_try_parent: _,
247+
} = &metadata
248+
{
249+
(*pr, parent_sha.clone())
250+
} else {
251+
unreachable!(
252+
"non-master missing reason in master_commits: {:?}",
253+
metadata
254+
);
255+
};
256+
missing.push((
257+
try_parent.clone(),
258+
MissingReason::Master {
259+
pr,
260+
parent_sha,
261+
is_try_parent: true,
262+
},
263+
));
243264
}
244265
missing.push((
245266
Commit {
@@ -351,7 +372,11 @@ mod tests {
351372
sha: "foo".into(),
352373
date: database::Date(time),
353374
},
354-
MissingReason::TryParent,
375+
MissingReason::Master {
376+
pr: 77,
377+
parent_sha: "bar".into(),
378+
is_try_parent: true,
379+
},
355380
),
356381
(
357382
Commit {
@@ -373,6 +398,7 @@ mod tests {
373398
MissingReason::Master {
374399
pr: 11,
375400
parent_sha: "345".into(),
401+
is_try_parent: false,
376402
},
377403
),
378404
];

site/src/request_handlers/next_commit.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ pub async fn handle_next_commit(ctxt: Arc<SiteCtxt>) -> next_commit::Response {
99
let next_commit = if let Some((commit, missing_reason)) = next_commit {
1010
// If we're going to run a master commit next, make sure
1111
// it's been enqueued in the pull_request_build table
12-
if let MissingReason::Master { pr, ref parent_sha } = missing_reason {
12+
if let MissingReason::Master {
13+
pr, ref parent_sha, ..
14+
} = missing_reason
15+
{
1316
let conn = ctxt.conn().await;
1417
// TODO: add capability of doing the following in one step
1518
// to avoid possibile illegal inbetween states.

site/static/status.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@
175175
return `${reason_to_string(reason.InProgress)} - in progress`;
176176
} else if (reason["Master"] != undefined && reason.Master.pr) {
177177
return `<a href="https://github.com/rust-lang/rust/pull/${reason["Master"].pr}">
178-
#${reason["Master"].pr}</a>`;
178+
#${reason["Master"].pr}</a>${
179+
reason.Master.is_try_parent ? " - Try commit parent" : ""
180+
}`;
179181
} else if (reason["Master"] != undefined && reason.Master.pr == 0) {
180182
return "Master";
181183
} else if (reason["Try"] != undefined && reason.Try.pr) {

0 commit comments

Comments
 (0)