buildbot: further Gerritification

- `BuildTrigger` still depends on `github` properties.

Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
raito 2024-03-02 17:34:52 +01:00
parent 5f7b3e0cdb
commit 7ace78107c

View file

@ -49,6 +49,7 @@ class BuildbotNixError(Exception):
@dataclass @dataclass
class GerritProject: class GerritProject:
# `project` field.
name: str name: str
class BuildTrigger(Trigger): class BuildTrigger(Trigger):
@ -322,7 +323,6 @@ def nix_eval_config(
# check out the source # check out the source
factory.addStep( factory.addStep(
steps.Gerrit( steps.Gerrit(
repourl=project.url,
mode="full", mode="full",
retry=[60, 60], retry=[60, 60],
timeout=3600 timeout=3600
@ -536,28 +536,28 @@ def config_for_project(
config["projects"].append(Project(project.name)) config["projects"].append(Project(project.name))
config["schedulers"].extend( config["schedulers"].extend(
[ [
# build all pull requests # build everything pertaining to a project
# TODO(raito): will this catch also post-merge? we don't really care about that… do we?
schedulers.SingleBranchScheduler( schedulers.SingleBranchScheduler(
name=f"{project.project_id}-prs", name=f"{project.name}-changes",
change_filter=util.ChangeFilter( change_filter=util.ChangeFilter(
repository=project.url, project=project.name,
category="pull",
), ),
builderNames=[f"{project.name}/nix-eval"], builderNames=[f"{project.name}/nix-eval"],
), ),
# this is triggered from `nix-eval` # this is triggered from `nix-eval`
schedulers.Triggerable( schedulers.Triggerable(
name=f"{project.project_id}-nix-build", name=f"{project.name}-nix-build",
builderNames=[f"{project.name}/nix-build"], builderNames=[f"{project.name}/nix-build"],
), ),
# this is triggered from `nix-eval` when the build is skipped # this is triggered from `nix-eval` when the build is skipped
schedulers.Triggerable( schedulers.Triggerable(
name=f"{project.project_id}-nix-skipped-build", name=f"{project.name}-nix-skipped-build",
builderNames=[f"{project.name}/nix-skipped-build"], builderNames=[f"{project.name}/nix-skipped-build"],
), ),
# allow to manually trigger a nix-build # allow to manually trigger a nix-build
schedulers.ForceScheduler( schedulers.ForceScheduler(
name=f"{project.project_id}-force", name=f"{project.name}-force",
builderNames=[f"{project.name}/nix-eval"], builderNames=[f"{project.name}/nix-eval"],
properties=[ properties=[
util.StringParameter( util.StringParameter(
@ -710,18 +710,18 @@ class GerritNixConfigurator(ConfiguratorBase):
eval_lock = util.MasterLock("nix-eval") eval_lock = util.MasterLock("nix-eval")
# TODO: initialize Lix # Configure the Lix project.
# config_for_project( config_for_project(
# config, config,
# project, GerritProject(name="lix"),
# worker_names, worker_names,
# self.nix_supported_systems, self.nix_supported_systems,
# self.nix_eval_worker_count or multiprocessing.cpu_count(), self.nix_eval_worker_count or multiprocessing.cpu_count(),
# self.nix_eval_max_memory_size, self.nix_eval_max_memory_size,
# eval_lock, eval_lock,
# self.cachix, self.cachix,
# self.outputs_path, self.outputs_path,
# ) )
config["change_source"] = self.gerrit_change_source config["change_source"] = self.gerrit_change_source
config["workers"].append(worker.LocalWorker(SKIPPED_BUILDER_NAME)) config["workers"].append(worker.LocalWorker(SKIPPED_BUILDER_NAME))