Watch
0
0
Fork
You've already forked hyperhive
0

queue the build of a config head that moved without a webhook build

This commit is contained in:
atlas 2026-11-02 03:23:47 +01:00 • committed by mara
commit b7d8c0dfc0

View file

@ -1303,22 +1303,38 @@ pub(crate) async fn queue_merged_config_deploy(
);
return;
};
let hive = hive.clone();
let inserted = state
.jobq
insert_merged_deploy(&state.jobq, hive, &agent, &rev, Some(pr));
}
/// Insert the [`merged_deploy_job`] of `agent`'s config at `rev` on `hive`.
/// `pr` is the merged PR a failed build reports on, when there is one. Whether
/// the job was inserted.
pub(crate) fn insert_merged_deploy(
jobq: &Mutex<hive_jobq::scheduler::Scheduler<SwarmNodeKind, SwarmResourceKind>>,
hive: &str,
agent: &str,
rev: &str,
pr: Option<u64>,
) -> bool {
let inserted = jobq
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
.insert_job(None, |b| merged_deploy_job(b, &hive, &agent, &rev, pr));
.insert_job(None, |b| merged_deploy_job(b, hive, agent, rev, pr));
match inserted {
Ok(_) => tracing::info!(%agent, %rev, %hive, "config-pr merge: deploy queued"),
Ok(_) => {
tracing::info!(%agent, %rev, %hive, "config deploy queued");
true
}
Err(e) => {
tracing::warn!(%agent, %rev, %hive, error = %e, "config-pr merge: queueing the deploy failed");
tracing::warn!(%agent, %rev, %hive, error = %e, "queueing the config deploy failed");
false
}
}
}
/// The sub-DAG a merged config PR is: the meta update, the build of the agent
/// from the updated flake, then the deploy of `rev` on `hive`.
/// from the updated flake, then the deploy of `rev` on `hive`. `pr` is the
/// merged PR, `None` for a head no PR delivery reported.
///
/// `after_ok`: a hive builds only from `internal/meta`, so a deploy asked for
/// after a failed update (no builder, an unreadable config repo) could only
@ -1329,13 +1345,13 @@ fn merged_deploy_job(
hive: &str,
agent: &str,
rev: &str,
pr: u64,
pr: Option<u64>,
) -> Vec<hive_jobq::builder::NodeGuid> {
let update_meta = b
.node(SwarmNodeKind::UpdateMeta)
.needs(SwarmResourceKind::Meta);
let root = update_meta.guid();
let _deploy = gated_deploy(b, hive, agent, Some(rev.to_owned()), Some(pr), Some(root));
let _deploy = gated_deploy(b, hive, agent, Some(rev.to_owned()), pr, Some(root));
vec![root]
}
@ -2501,7 +2517,7 @@ mod tests {
}
fn merged_dag(b: &TestBuilder) {
let _ = super::merged_deploy_job(b, "pr1ma", "atlas", "abc", 7);
let _ = super::merged_deploy_job(b, "pr1ma", "atlas", "abc", Some(7));
}
fn custom_dag(b: &TestBuilder) {
@ -4215,7 +4231,9 @@ mod tests {
sched
.lock()
.unwrap()
.insert_job(None, |b| merged_deploy_job(b, "pr1ma", "atlas", "abc", 7))
.insert_job(None, |b| {
merged_deploy_job(b, "pr1ma", "atlas", "abc", Some(7))
})
.expect("the graph inserts");
sched
}