mirror of
https://github.com/Noratrieb/does-it-build.git
synced 2026-01-14 10:25:01 +01:00
Guard against completely broken nightlies
This commit is contained in:
parent
4671f871a6
commit
5ef63686f3
3 changed files with 24 additions and 4 deletions
2
migrations/20240908102033_nightly_is_broken.sql
Normal file
2
migrations/20240908102033_nightly_is_broken.sql
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE finished_nightly
|
||||
ADD COLUMN is_broken BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
16
src/build.rs
16
src/build.rs
|
|
@ -11,7 +11,7 @@ use color_eyre::{
|
|||
};
|
||||
use futures::StreamExt;
|
||||
use tokio::process::Command;
|
||||
use tracing::{debug, info};
|
||||
use tracing::{debug, error, info};
|
||||
|
||||
use crate::{
|
||||
db::{BuildMode, Db, FullBuildInfo, Status},
|
||||
|
|
@ -38,7 +38,9 @@ impl Display for Toolchain {
|
|||
pub async fn background_builder(db: Db) -> Result<()> {
|
||||
let mut nightly_cache = NightlyCache::default();
|
||||
loop {
|
||||
let nightlies = Nightlies::fetch(&mut nightly_cache).await.wrap_err("fetching nightlies")?;
|
||||
let nightlies = Nightlies::fetch(&mut nightly_cache)
|
||||
.await
|
||||
.wrap_err("fetching nightlies")?;
|
||||
let already_finished = db
|
||||
.finished_nightlies()
|
||||
.await
|
||||
|
|
@ -48,9 +50,15 @@ pub async fn background_builder(db: Db) -> Result<()> {
|
|||
match next {
|
||||
Some((nightly, mode)) => {
|
||||
info!(%nightly, %mode, "Building next nightly");
|
||||
build_every_target_for_toolchain(&db, &nightly, mode)
|
||||
let result = build_every_target_for_toolchain(&db, &nightly, mode)
|
||||
.await
|
||||
.wrap_err_with(|| format!("building targets for toolchain {nightly}"))?;
|
||||
.wrap_err_with(|| format!("building targets for toolchain {nightly}"));
|
||||
if let Err(err) = result {
|
||||
error!(%nightly, %mode, ?err, "Failed to build nightly");
|
||||
db.finish_nightly_as_broken(&nightly, mode)
|
||||
.await
|
||||
.wrap_err("marking nightly as broken")?;
|
||||
}
|
||||
}
|
||||
None => {
|
||||
info!("No new nightly, waiting for an hour to try again");
|
||||
|
|
|
|||
10
src/db.rs
10
src/db.rs
|
|
@ -162,4 +162,14 @@ impl Db {
|
|||
.wrap_err("inserting finished nightly")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn finish_nightly_as_broken(&self, nightly: &str, mode: BuildMode) -> Result<()> {
|
||||
sqlx::query("INSERT INTO finished_nightly (nightly, mode, is_broken) VALUES (?, ?, TRUE)")
|
||||
.bind(nightly)
|
||||
.bind(mode)
|
||||
.execute(&self.conn)
|
||||
.await
|
||||
.wrap_err("inserting finished broken nightly")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue