Phase 5a: approval queue (request_apply_commit, pending/approve/deny)
This commit is contained in:
parent
4a73340150
commit
f12837fe32
7 changed files with 270 additions and 0 deletions
|
|
@ -81,6 +81,25 @@ async fn dispatch(req: &HostRequest, coord: &Coordinator) -> HostResponse {
|
|||
HostResponse::success()
|
||||
}
|
||||
HostRequest::List => HostResponse::list(lifecycle::list().await?),
|
||||
HostRequest::Pending => HostResponse::pending(coord.approvals.pending()?),
|
||||
HostRequest::Approve { id } => {
|
||||
let approval = coord.approvals.mark_approved(*id)?;
|
||||
tracing::info!(%approval.id, %approval.agent, %approval.commit_ref, "approval applied: rebuilding agent");
|
||||
let agent_dir = coord.register_agent(&approval.agent).await?;
|
||||
if let Err(e) =
|
||||
lifecycle::rebuild(&approval.agent, &coord.agent_flake, &agent_dir).await
|
||||
{
|
||||
let note = format!("{e:#}");
|
||||
let _ = coord.approvals.mark_failed(approval.id, ¬e);
|
||||
return Err(e);
|
||||
}
|
||||
HostResponse::success()
|
||||
}
|
||||
HostRequest::Deny { id } => {
|
||||
coord.approvals.mark_denied(*id)?;
|
||||
tracing::info!(%id, "approval denied");
|
||||
HostResponse::success()
|
||||
}
|
||||
})
|
||||
}
|
||||
.await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue