From 4a7a9f837a865d8ebbb679199b2eb6067bb022f8 Mon Sep 17 00:00:00 2001 From: Yureka Date: Tue, 6 Aug 2024 11:43:59 +0200 Subject: [PATCH] fixup! randomly pick a builder and pass it as --store --- buildbot_nix/__init__.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/buildbot_nix/__init__.py b/buildbot_nix/__init__.py index 07543f3..f1f9731 100644 --- a/buildbot_nix/__init__.py +++ b/buildbot_nix/__init__.py @@ -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",