fixup! randomly pick a builder and pass it as --store

This commit is contained in:
Yureka 2024-08-06 11:43:59 +02:00
parent d21f406a25
commit 4a7a9f837a

View file

@ -64,11 +64,15 @@ class NixBuilder:
def to_nix_store(self):
fullConnection = f"{self.sshUser}@{self.hostName}" if self.sshUser is not None else self.hostName
fullConnection = f"{self.protocol}://{fullConnection}"
params = []
if self.sshKey is not None:
fullConnection += f"?ssh-key={self.sshKey}"
params += f"ssh-key={self.sshKey}"
if self.publicHostKey is not None:
encoded_public_key = base64.b64encode(self.publicHostKey.encode('ascii')).decode('ascii')
fullConnection += f"?base64-ssh-public-host-key={encoded_public_key}"
params += f"base64-ssh-public-host-key={encoded_public_key}"
if params != []:
fullConnection += "?"
fullConnection += "&".join(params)
return fullConnection
@ -629,22 +633,10 @@ def nix_build_config(
) -> util.BuilderConfig:
"""Builds one nix flake attribute."""
factory = util.BuildFactory()
factory.addStep(
steps.ShellCommand(
name="Copy the derivation to the local worker store",
command=[
"nix",
"copy",
"--derivation",
"--to",
"../store",
util.Interpolate("%(prop:drv_path)s^*")
]
)
)
# pick a store to run the build on
build_store = random.choice(build_stores)
# TODO proper scheduling instead of picking the first builder
build_store = build_stores[0]
factory.addStep(
NixBuildCommand(
@ -657,8 +649,6 @@ def nix_build_config(
"--option",
"keep-going",
"true",
# do not build directly on the coordinator
"--max-jobs", "0",
"--option",
# stop stuck builds after 20 minutes
"--max-silent-time",