swarm-controller: creating an agent now asks its hive to deploy it
`TriggerDeploy` had no producer — a node kind nothing enqueues is dead code, and a publisher with no caller proves as little as a check nobody runs. It goes last in the creation chain, after `InitAgentConfigRepo` rather than merely after the repo exists: the hive deploys by reading that repo, so a deploy asked for any earlier would find nothing to build. That edge is what makes creating an agent at swarm level actually put it on a hive instead of leaving a provisioned name nobody runs. The `hive` it carries is the string this handler already parsed as an `Ident` and matched against the roster, so the node cannot name a hive this swarm does not have.
This commit is contained in:
parent
38ccef987e
commit
d4eb62434d
1 changed files with 17 additions and 2 deletions
|
|
@ -914,9 +914,22 @@ async fn create_agent(
|
|||
})
|
||||
.after_ok(create_repo)
|
||||
.after_ok(create_forge_user);
|
||||
let _init_config = b
|
||||
.node(SwarmNodeKind::InitAgentConfigRepo { agent })
|
||||
let init_config = b
|
||||
.node(SwarmNodeKind::InitAgentConfigRepo {
|
||||
agent: agent.clone(),
|
||||
})
|
||||
.after_ok(create_repo);
|
||||
// Last, and specifically after the config repo is seeded: the
|
||||
// hive deploys by reading that repo, so a deploy asked for any
|
||||
// earlier would find nothing to build. This is the edge that
|
||||
// makes creating an agent at swarm level actually put it on a
|
||||
// hive, rather than leaving a provisioned name nobody runs.
|
||||
let _trigger_deploy = b
|
||||
.node(SwarmNodeKind::TriggerDeploy {
|
||||
hive: hive.clone(),
|
||||
agent,
|
||||
})
|
||||
.after_ok(init_config);
|
||||
vec![create_identity.guid()]
|
||||
})
|
||||
.map_err(|e| {
|
||||
|
|
@ -1529,6 +1542,7 @@ mod tests {
|
|||
let deps = WorkerDeps {
|
||||
auth: None,
|
||||
forge: None,
|
||||
queue: None,
|
||||
};
|
||||
let runner =
|
||||
hive_jobq::scheduler::Scheduler::claim_next(&sched, move |id, kind, builder| {
|
||||
|
|
@ -1580,6 +1594,7 @@ mod tests {
|
|||
let deps = WorkerDeps {
|
||||
auth: None,
|
||||
forge: None,
|
||||
queue: None,
|
||||
};
|
||||
let runner =
|
||||
hive_jobq::scheduler::Scheduler::claim_next(&sched, move |id, kind, builder| {
|
||||
|
|
|
|||
Loading…
Reference in a new issue