move the builder and claude login wire contracts into swarm-wire
This commit is contained in:
parent
f99e502634
commit
0c3d128de1
23 changed files with 224 additions and 81 deletions
|
|
@ -9,7 +9,7 @@ use std::path::PathBuf;
|
|||
use std::process::Stdio;
|
||||
use std::time::Duration;
|
||||
|
||||
use swarm_queue_client::builder::ArchetypesReply;
|
||||
use swarm_wire::builder::ArchetypesReply;
|
||||
|
||||
/// What every evaluation is run with, fixed at start.
|
||||
pub struct Evaluator {
|
||||
|
|
@ -105,7 +105,7 @@ mod tests {
|
|||
nix: PathBuf::from("nix"),
|
||||
hyperhive: "/nix/store/h-source".to_owned(),
|
||||
nixpkgs: "/nix/store/n-source".to_owned(),
|
||||
deadline: swarm_queue_client::builder::ARCHETYPES_DEADLINE,
|
||||
deadline: swarm_wire::builder::ARCHETYPES_DEADLINE,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
//! The swarm builder's build service.
|
||||
//!
|
||||
//! Connects to the swarm queue as its own OIDC client, takes build requests
|
||||
//! from swarm-controller on [`swarm_queue_client::builder::SUBJECT`], builds
|
||||
//! from swarm-controller on [`swarm_wire::builder::SUBJECT`], builds
|
||||
//! each agent config at its commit, answers on the request's reply subject,
|
||||
//! and logs one line per build. It writes nothing to the forge: the
|
||||
//! controller turns the reply into a commit status. It also answers
|
||||
//! [`swarm_queue_client::builder::ARCHETYPES_SUBJECT`] with the agent
|
||||
//! [`swarm_wire::builder::ARCHETYPES_SUBJECT`] with the agent
|
||||
//! archetypes its hyperhive source declares, which the controller stores.
|
||||
//!
|
||||
//! The store identity comes from the `BAO_*` environment. The queue client
|
||||
|
|
@ -19,13 +19,13 @@ use std::time::Duration;
|
|||
|
||||
use anyhow::{Context, Result, anyhow, bail};
|
||||
use futures_util::StreamExt as _;
|
||||
use swarm_queue_client::builder::{
|
||||
ARCHETYPES_DEADLINE, ARCHETYPES_SUBJECT, BUILD_DEADLINE, BuildAgent, QUEUE_GROUP,
|
||||
REPLY_DEADLINE, Reply, SUBJECT,
|
||||
};
|
||||
use swarm_queue_client::{ClientSecret, QueueConfig};
|
||||
use swarm_secret_client::forge::Credential;
|
||||
use swarm_secret_client::stored_secret::StoredSecret;
|
||||
use swarm_wire::builder::{
|
||||
ARCHETYPES_DEADLINE, ARCHETYPES_SUBJECT, BUILD_DEADLINE, BuildAgent, QUEUE_GROUP,
|
||||
REPLY_DEADLINE, Reply, SUBJECT,
|
||||
};
|
||||
|
||||
mod archetypes;
|
||||
mod nix_build;
|
||||
|
|
@ -168,10 +168,10 @@ async fn answer_evaluations(
|
|||
};
|
||||
let reply = evaluator.eval().await;
|
||||
match &reply {
|
||||
swarm_queue_client::builder::ArchetypesReply::Evaluated { archetypes, .. } => {
|
||||
swarm_wire::builder::ArchetypesReply::Evaluated { archetypes, .. } => {
|
||||
tracing::info!(count = archetypes.len(), "archetypes evaluated");
|
||||
}
|
||||
swarm_queue_client::builder::ArchetypesReply::Failed { error_tail } => {
|
||||
swarm_wire::builder::ArchetypesReply::Failed { error_tail } => {
|
||||
tracing::warn!(%error_tail, "archetype evaluation failed");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use std::path::PathBuf;
|
|||
use std::process::Stdio;
|
||||
use std::time::Duration;
|
||||
|
||||
use swarm_queue_client::builder::{BuildAgent, Reply};
|
||||
use swarm_wire::builder::{BuildAgent, Reply};
|
||||
use tokio::io::AsyncReadExt as _;
|
||||
|
||||
/// The most of `nix`'s stderr a failed build's reply carries, from its end.
|
||||
|
|
@ -293,7 +293,7 @@ pub(crate) fn tail(stderr: &str, status: std::process::ExitStatus) -> String {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use swarm_queue_client::builder::BUILD_DEADLINE;
|
||||
use swarm_wire::builder::BUILD_DEADLINE;
|
||||
|
||||
fn job() -> BuildAgent {
|
||||
BuildAgent {
|
||||
|
|
|
|||
Loading…
Reference in a new issue