make topic filter configurable
This commit is contained in:
parent
dd95055cb6
commit
cb35c312c1
|
@ -511,6 +511,7 @@ class GithubConfig:
|
||||||
webhook_secret_name: str = "github-webhook-secret"
|
webhook_secret_name: str = "github-webhook-secret"
|
||||||
token_secret_name: str = "github-token"
|
token_secret_name: str = "github-token"
|
||||||
project_cache_file: Path = Path("github-project-cache.json")
|
project_cache_file: Path = Path("github-project-cache.json")
|
||||||
|
topic_filter: str | None = "build-with-buildbot"
|
||||||
|
|
||||||
def token(self) -> str:
|
def token(self) -> str:
|
||||||
return read_secret_file(self.token_secret_name)
|
return read_secret_file(self.token_secret_name)
|
||||||
|
@ -633,7 +634,8 @@ class NixConfigurator(ConfiguratorBase):
|
||||||
|
|
||||||
def configure(self, config: dict[str, Any]) -> None:
|
def configure(self, config: dict[str, Any]) -> None:
|
||||||
projects = load_projects(self.github.token(), self.github.project_cache_file)
|
projects = load_projects(self.github.token(), self.github.project_cache_file)
|
||||||
projects = [p for p in projects if "build-with-buildbot" in p.topics]
|
if self.github.topic_filter is not None:
|
||||||
|
projects = [p for p in projects if self.github.topic_filter in p.topics]
|
||||||
worker_config = json.loads(read_secret_file(self.nix_workers_secret_name))
|
worker_config = json.loads(read_secret_file(self.nix_workers_secret_name))
|
||||||
worker_names = []
|
worker_names = []
|
||||||
config["workers"] = config.get("workers", [])
|
config["workers"] = config.get("workers", [])
|
||||||
|
|
|
@ -29,8 +29,8 @@ in
|
||||||
webhookSecretFile = "/var/lib/secrets/buildbot-nix/github-webhook-secret";
|
webhookSecretFile = "/var/lib/secrets/buildbot-nix/github-webhook-secret";
|
||||||
oauthSecretFile = "/var/lib/secrets/buildbot-nix/github-oauth-secret";
|
oauthSecretFile = "/var/lib/secrets/buildbot-nix/github-oauth-secret";
|
||||||
oauthId = "aaaaaaaaaaaaaaaaaaaa";
|
oauthId = "aaaaaaaaaaaaaaaaaaaa";
|
||||||
githubUser = "mic92-buildbot";
|
user = "mic92-buildbot";
|
||||||
githubAdmins = [ "Mic92" ];
|
admins = [ "Mic92" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
services.nginx.virtualHosts."buildbot2.thalheim.io" = {
|
services.nginx.virtualHosts."buildbot2.thalheim.io" = {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
webhookSecretFile = "/var/lib/secrets/buildbot-nix/github-webhook-secret";
|
webhookSecretFile = "/var/lib/secrets/buildbot-nix/github-webhook-secret";
|
||||||
oauthSecretFile = "/var/lib/secrets/buildbot-nix/github-oauth-secret";
|
oauthSecretFile = "/var/lib/secrets/buildbot-nix/github-oauth-secret";
|
||||||
oauthId = "aaaaaaaaaaaaaaaaaaaa";
|
oauthId = "aaaaaaaaaaaaaaaaaaaa";
|
||||||
githubUser = "mic92-buildbot";
|
user = "mic92-buildbot";
|
||||||
githubAdmins = [ "Mic92" ];
|
admins = [ "Mic92" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,15 +39,23 @@ in
|
||||||
description = "Github oauth id. Used for the login button";
|
description = "Github oauth id. Used for the login button";
|
||||||
};
|
};
|
||||||
# Most likely you want to use the same user as for the buildbot
|
# Most likely you want to use the same user as for the buildbot
|
||||||
githubUser = lib.mkOption {
|
user = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Github user that is used for the buildbot";
|
description = "Github user that is used for the buildbot";
|
||||||
};
|
};
|
||||||
githubAdmins = lib.mkOption {
|
admins = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = "Users that are allowed to login to buildbot, trigger builds and change settings";
|
description = "Users that are allowed to login to buildbot, trigger builds and change settings";
|
||||||
};
|
};
|
||||||
|
topic = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = "build-with-buildbot";
|
||||||
|
description = ''
|
||||||
|
Projects that have this topic will be built by buildbot.
|
||||||
|
If null, all projects that the buildbot github user has access to, are built.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
workersFile = lib.mkOption {
|
workersFile = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
|
@ -97,8 +105,9 @@ in
|
||||||
NixConfigurator(
|
NixConfigurator(
|
||||||
github=GithubConfig(
|
github=GithubConfig(
|
||||||
oauth_id=${builtins.toJSON cfg.github.oauthId},
|
oauth_id=${builtins.toJSON cfg.github.oauthId},
|
||||||
admins=${builtins.toJSON cfg.github.githubAdmins},
|
admins=${builtins.toJSON cfg.github.admins},
|
||||||
buildbot_user=${builtins.toJSON cfg.github.githubUser},
|
buildbot_user=${builtins.toJSON cfg.github.user},
|
||||||
|
topic=${builtins.toJSON cfg.github.topic},
|
||||||
),
|
),
|
||||||
nix_eval_max_memory_size=${builtins.toJSON cfg.evalMaxMemorySize},
|
nix_eval_max_memory_size=${builtins.toJSON cfg.evalMaxMemorySize},
|
||||||
nix_supported_systems=${builtins.toJSON cfg.buildSystems},
|
nix_supported_systems=${builtins.toJSON cfg.buildSystems},
|
||||||
|
|
Loading…
Reference in a new issue