This commit is contained in:
phaer 2023-10-27 10:49:40 +02:00 committed by Mic92
parent c7b360eb16
commit 9ad17c646b
2 changed files with 18 additions and 11 deletions

View file

@ -20,15 +20,16 @@ from buildbot.process.project import Project
from buildbot.process.properties import Interpolate, Properties from buildbot.process.properties import Interpolate, Properties
from buildbot.process.results import ALL_RESULTS, statusToString from buildbot.process.results import ALL_RESULTS, statusToString
from buildbot.steps.trigger import Trigger from buildbot.steps.trigger import Trigger
from twisted.internet import defer, threads
from twisted.python.failure import Failure
from .github_projects import ( # noqa: E402 from .github_projects import ( # noqa: E402
GithubProject, GithubProject,
create_project_hook, create_project_hook,
load_projects, load_projects,
refresh_projects, refresh_projects,
slugify_project_name slugify_project_name,
) )
from twisted.internet import defer, threads
from twisted.python.failure import Failure
class BuildTrigger(Trigger): class BuildTrigger(Trigger):
@ -615,13 +616,15 @@ def config_for_project(
), ),
# allow to manually trigger a nix-build # allow to manually trigger a nix-build
schedulers.ForceScheduler( schedulers.ForceScheduler(
name=f"{project.id}-force", builderNames=[f"{project.name}/nix-eval"], name=f"{project.id}-force",
builderNames=[f"{project.name}/nix-eval"],
properties=[ properties=[
util.StringParameter( util.StringParameter(
name="project", name="project",
label="Name of the GitHub repository.", label="Name of the GitHub repository.",
default=project.name) default=project.name,
] )
],
), ),
# allow to manually update flakes # allow to manually update flakes
schedulers.ForceScheduler( schedulers.ForceScheduler(
@ -786,7 +789,9 @@ class NixConfigurator(ConfiguratorBase):
) )
config["www"]["authz"] = util.Authz( config["www"]["authz"] = util.Authz(
roleMatchers=[ roleMatchers=[
util.RolesFromUsername(roles=["admin"], usernames=self.github.admins) util.RolesFromUsername(
roles=["admin"], usernames=self.github.admins
)
], ],
allowRules=[ allowRules=[
util.AnyEndpointMatcher(role="admin", defaultDeny=False), util.AnyEndpointMatcher(role="admin", defaultDeny=False),

View file

@ -143,8 +143,10 @@ def refresh_projects(github_token: str, repo_cache_file: Path) -> None:
github_token, github_token,
): ):
if not repo["permissions"]["admin"]: if not repo["permissions"]["admin"]:
name = repo['full_name'] name = repo["full_name"]
log.msg(f"skipping {name} because we do not have admin privileges, needed for hook management") log.msg(
f"skipping {name} because we do not have admin privileges, needed for hook management"
)
else: else:
repos.append(repo) repos.append(repo)