ci: improve citool job db errors
This commit is contained in:
parent
c43786c9b7
commit
f57a64ae5a
1 changed files with 10 additions and 4 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue