From 3389164c13970d9b2d7bfcfe24323b444046cf41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 12 Jul 2024 07:28:28 +0200 Subject: [PATCH 1/2] fix retries beeing zero --- buildbot_nix/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildbot_nix/__init__.py b/buildbot_nix/__init__.py index 03cc229..d5d1d41 100644 --- a/buildbot_nix/__init__.py +++ b/buildbot_nix/__init__.py @@ -252,7 +252,7 @@ class NixBuildCommand(buildstep.ShellMixin, steps.BuildStep): yield self.runCommand(cmd) res = cmd.results() - if res == util.FAILURE: + if res == util.FAILURE and self.retries > 0: retries = RETRY_COUNTER.retry_build(self.getProperty("build_uuid")) if retries > self.retries - 1: return util.RETRY From 458b39fc3a3417b9f5324505468588c503a5e12e Mon Sep 17 00:00:00 2001 From: magic_rb Date: Thu, 11 Jul 2024 20:52:01 +0200 Subject: [PATCH 2/2] Don't pass token into `AvatarGitHub`, it works perfectly without it Signed-off-by: magic_rb --- buildbot_nix/github_projects.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/buildbot_nix/github_projects.py b/buildbot_nix/github_projects.py index c1da85f..2249bc3 100644 --- a/buildbot_nix/github_projects.py +++ b/buildbot_nix/github_projects.py @@ -650,22 +650,7 @@ class GithubBackend(GitBackend): } def create_avatar_method(self) -> AvatarBase | None: - avatar = AvatarGitHub(token=self.auth_backend.get_general_token().get()) - - # TODO: not a proper fix, the /users/{username} endpoint is per installation, but I'm not sure - # how to tell which installation token to use, unless there is a way to build a huge map of - # username -> token, or we just try each one in order - def _get_avatar_by_username(self: Any, username: Any) -> Any: - return f"https://github.com/{username}.png" - - import types - - avatar._get_avatar_by_username = types.MethodType( # noqa: SLF001 - _get_avatar_by_username, - avatar, - ) - - return avatar + return AvatarGitHub() def create_auth(self) -> AuthBase: assert self.config.oauth_id is not None, "GitHub OAuth ID is required"