Skip to content

ci: improve citool job db errors #141355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/ci/citool/src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,20 @@ impl JobDatabase {
}

pub fn load_job_db(db: &str) -> anyhow::Result<JobDatabase> {
let mut db: Value = serde_yaml::from_str(db)?;
let mut db: Value = serde_yaml::from_str(db).context("failed to parse YAML content")?;

// We need to expand merge keys (<<), because serde_yaml can't deal with them
// `apply_merge` only applies the merge once, so do it a few times to unwrap nested merges.
db.apply_merge()?;
db.apply_merge()?;

let db: JobDatabase = serde_yaml::from_value(db)?;
let apply_merge = |db: &mut Value| -> anyhow::Result<()> {
db.apply_merge().context("failed to apply merge keys")
};

// Apply merge twice to handle nested merges
apply_merge(&mut db)?;
apply_merge(&mut db)?;

let db: JobDatabase = serde_yaml::from_value(db).context("failed to parse job database")?;
Ok(db)
}

Expand Down
Loading