Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: move the forge concern into its own module

Refs #6897
This commit is contained in:
atlas 2026-11-27 15:47:00 +01:00 • committed by mara
commit a9df331469
2 changed files with 44 additions and 37 deletions

View file

@ -83,7 +83,7 @@ needs `deploy.forgejo.enable` or a hive on its host.
## Registration
1. **swarm-controller** (`swarm-controller/src/forge/runner_token.rs`) reads
1. **swarm-controller** (`swarm-controller/src/git_forge/forge/runner_token.rs`) reads
the forge's instance-wide token from
`GET /api/v1/admin/runners/registration-token` at start and every five
minutes, and writes it to the secret store at
@ -163,7 +163,7 @@ warns about it.
<!-- vale write-good.Passive = YES -->
The **swarm controller** seeds the mirror in its swarm-wide forge-objects
pass (`swarm-controller/src/forge/objects.rs`), beside the orgs it ensures.
pass (`swarm-controller/src/git_forge/forge/objects.rs`), beside the orgs it ensures.
`glue-forge-controller.nix` forwards the effective mirror list as
`SWARM_CONTROLLER_FORGE_MIRRORS` in the `swarm-controller` service
environment (JSON-encoded `[{upstream, dest}]` list). It reads the list of
@ -287,7 +287,7 @@ builder — disk-pressure collection at least runs while nothing is mid-copy.
## References
- `nix/host-modules/swarm-ci-runner.nix`: runner configuration, token fetch, re-registration step, container setup.
- `swarm-controller/src/forge/runner_token.rs`: publishes the registration token.
- `swarm-controller/src/git_forge/forge/runner_token.rs`: publishes the registration token.
- `.forgejo/workflows/ci.yml`: workflow definition.
- `docs/5-project/process/gotchas.md`: nix sandboxing limitations in containers.

View file

@ -387,7 +387,7 @@ drops it unanswered, which reads as a 504. `swarmctl agent agents-md get` and
The controller also keeps the forge objects that are one per swarm, not
one per hive. It ensures them at start and every five minutes after
(`swarm-controller/src/forge/objects.rs`):
(`swarm-controller/src/git_forge/forge/objects.rs`):
- the orgs `agent-configs`, `internal` and `agents`, plus each mirror's
owner org;
@ -411,12 +411,12 @@ one per hive. It ensures them at start and every five minutes after
The config repos get the agent's icon too. When a build sets the agent's icon,
the controller sets the avatar of `agent-configs/<agent>` from the PNG the
builder rendered (`forge/repo_avatar.rs`), as the forge admin, who may edit any
builder rendered (`git_forge/forge/repo_avatar.rs`), as the forge admin, who may edit any
repo's avatar. A marker per repo (`forge-repo-avatar-<repo>`) holds the image's
SHA-256, as for the service accounts below.
The swarm's own forge accounts (`builder`, `ci-metrics` and `review-classifier`)
get an avatar too, from a separate pass in the controller (`forge/service_avatars.rs`).
get an avatar too, from a separate pass in the controller (`git_forge/forge/service_avatars.rs`).
Each has an icon in a hexagonal frame (`branding/service-<login>.svg`, rendered to a PNG
in the assets package) and falls back to the hyperhive logo. Only an account can set its own
avatar, so the pass mints a short-lived `write:user` token for it with the admin API, uploads
@ -433,7 +433,7 @@ controller is down the objects stay as they are.
The controller gives each agent **read** on `internal/docs`. A `GrantDocsRead`
node in the agent's create job adds it as a collaborator, unless it already holds read or more. A pass over the
store's `hive-agent-*` roster (`forge/docs_grant.rs`, at start and every five
store's `hive-agent-*` roster (`git_forge/forge/docs_grant.rs`, at start and every five
minutes) adds any agent that isn't one, so an agent whose create-time grant failed
gets it within five minutes. The pass only adds: a roster it can't read, a
forge read that fails, or an `internal/docs` that doesn't exist (checked once per