From bbac51e09e93fabec5aedecce6b214dee3b23769 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Fri, 19 Jul 2024 23:38:51 +0200 Subject: [PATCH] fix(gerrit): pass properly the ssh private key and not its path Signed-off-by: Raito Bezarius --- buildbot_nix/__init__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/buildbot_nix/__init__.py b/buildbot_nix/__init__.py index eda8dea..99cc0dc 100644 --- a/buildbot_nix/__init__.py +++ b/buildbot_nix/__init__.py @@ -485,6 +485,14 @@ def nix_eval_config( For each evaluated attribute a new build pipeline is started. """ factory = util.BuildFactory() + + gerrit_private_key = None + with open(project.private_sshkey_path, 'r') as f: + gerrit_private_key = f.read() + + if gerrit_private_key is None: + raise RuntimeError('No gerrit private key to fetch the repositories') + # check out the source factory.addStep( steps.Gerrit( @@ -492,9 +500,10 @@ def nix_eval_config( mode="full", retry=[60, 60], timeout=3600, - sshPrivateKey=project.private_sshkey_path + sshPrivateKey=gerrit_private_key ), ) + # use one gcroots directory per worker. this should be scoped to the largest unique resource # in charge of builds (ie, buildnumber is too narrow) to not litter the system with permanent # gcroots in case of worker restarts. @@ -712,12 +721,6 @@ def config_for_project( ), ], ) - gerrit_private_key = None - with open(project.private_sshkey_path, 'r') as f: - gerrit_private_key = f.read() - - if gerrit_private_key is None: - raise RuntimeError('No gerrit private key to fetch the repositories') config["builders"].extend( [