Watch
0
0
Fork
You've already forked hyperhive
0

swarm-builder: give the check flake the hive's docs source

The builder's hyperhive input is the docs-stripped flake source, so an
agent config with docs.enable = true failed to evaluate: docs.source
defaults to reference-docs, built from the missing docs/. Pass the host's
c0re.hyperhiveDocs as a hyperhive-docs input and set docs.source from it,
as the hive's meta flake does.

Fixes #5411
This commit is contained in:
atlas 2026-10-17 08:54:06 +02:00 • committed by mara
commit e9c471caeb
6 changed files with 80 additions and 10 deletions

View file

@ -49,6 +49,7 @@ async fn main() -> Result<()> {
check_flake: var("CHECK_FLAKE")?,
hyperhive: var("HYPERHIVE_FLAKE")?,
nixpkgs: var("NIXPKGS_FLAKE")?,
hyperhive_docs: var("HYPERHIVE_DOCS_FLAKE")?,
forge_url: forge_url()?,
config_org: var("CONFIG_ORG")?,
deadline: BUILD_DEADLINE,

View file

@ -1,5 +1,6 @@
//! One build: `nix build` of the check flake with its three inputs pointed at
//! this host's hyperhive and nixpkgs and at the agent's config commit.
//! One build: `nix build` of the check flake with its four inputs pointed at
//! this host's hyperhive, hyperhive docs and nixpkgs and at the agent's config
//! commit.
//!
//! The config repo is private, so `git` fetches it with the builder's forge
//! token. The token reaches `git` through a credential helper that reads it
@ -44,6 +45,8 @@ pub struct Builder {
pub hyperhive: String,
/// The nixpkgs source this host was deployed from.
pub nixpkgs: String,
/// The hyperhive `docs/` source this host was deployed from.
pub hyperhive_docs: String,
/// `https://<forge>`, with no trailing slash and no path.
pub forge_url: String,
/// The org the config repos are in.
@ -99,6 +102,9 @@ impl Builder {
"nixpkgs".to_owned(),
self.nixpkgs.clone(),
"--override-input".to_owned(),
"hyperhive-docs".to_owned(),
self.hyperhive_docs.clone(),
"--override-input".to_owned(),
"agent".to_owned(),
self.agent_url(job),
])
@ -302,6 +308,7 @@ mod tests {
check_flake: "/nix/store/c-check".to_owned(),
hyperhive: "/nix/store/h-source".to_owned(),
nixpkgs: "/nix/store/n-source".to_owned(),
hyperhive_docs: "/nix/store/d-docs-source".to_owned(),
forge_url: "https://forge.example".to_owned(),
config_org: "agent-configs".to_owned(),
nix: PathBuf::from("nix"),
@ -326,7 +333,14 @@ mod tests {
.filter(|w| w[0] == "--override-input")
.map(|w| w[1].as_str())
.collect();
assert_eq!(overridden, ["hyperhive", "nixpkgs", "agent"]);
assert_eq!(
overridden,
["hyperhive", "nixpkgs", "hyperhive-docs", "agent"]
);
assert!(
args.windows(2)
.any(|w| w[0] == "hyperhive-docs" && w[1] == "/nix/store/d-docs-source")
);
assert!(args.iter().any(|a| a == "/nix/store/c-check#check"));
assert!(args.iter().any(|a| a == "--no-write-lock-file"));
}