From 2cc486eb594976986d252269e3c22521c3a39637 Mon Sep 17 00:00:00 2001 From: Evgenii Alekseev Date: Mon, 16 Feb 2026 22:53:23 +0200 Subject: [PATCH] bug: load gitremote triggers configuration schema from non-standard paths --- docs/configuration.rst | 2 ++ src/ahriman/core/gitremote/remote_pull_trigger.py | 8 +++++--- src/ahriman/core/gitremote/remote_push_trigger.py | 8 +++++--- src/ahriman/core/triggers/trigger.py | 3 --- tests/ahriman/core/triggers/test_trigger.py | 1 - 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 1cc1871a..0e43b5c4 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -250,6 +250,7 @@ Available options are: Remote pull trigger ^^^^^^^^^^^^^^^^^^^ +* ``type`` - type of the pull, string, optional, must be set to ``gitremote`` if exists. * ``pull_url`` - URL of the remote repository from which PKGBUILDs can be pulled before build process, string, required. * ``pull_branch`` - branch of the remote repository from which PKGBUILDs can be pulled before build process, string, optional, default is ``master``. @@ -270,6 +271,7 @@ Available options are: Remote push trigger ^^^^^^^^^^^^^^^^^^^ +* ``type`` - type of the push, string, optional, must be set to ``gitremote`` if exists. * ``commit_email`` - git commit email, string, optional, default is ``ahriman@localhost``. * ``commit_user`` - git commit user, string, optional, default is ``ahriman``. * ``push_url`` - URL of the remote repository to which PKGBUILDs should be pushed after build process, string, required. diff --git a/src/ahriman/core/gitremote/remote_pull_trigger.py b/src/ahriman/core/gitremote/remote_pull_trigger.py index e63a65d1..9472ca1f 100644 --- a/src/ahriman/core/gitremote/remote_pull_trigger.py +++ b/src/ahriman/core/gitremote/remote_pull_trigger.py @@ -48,6 +48,10 @@ class RemotePullTrigger(Trigger): "gitremote": { "type": "dict", "schema": { + "type": { + "type": "string", + "allowed": ["gitremote"], + }, "pull_url": { "type": "string", "required": True, @@ -60,7 +64,6 @@ class RemotePullTrigger(Trigger): }, }, } - CONFIGURATION_SCHEMA_FALLBACK = "gitremote" def __init__(self, repository_id: RepositoryId, configuration: Configuration) -> None: """ @@ -89,7 +92,6 @@ class RemotePullTrigger(Trigger): trigger action which will be called at the start of the application """ for target in self.targets: - section, _ = self.configuration.gettype( - target, self.repository_id, fallback=self.CONFIGURATION_SCHEMA_FALLBACK) + section, _ = self.configuration.gettype(target, self.repository_id, fallback="gitremote") runner = RemotePull(self.repository_id, self.configuration, section) runner.run() diff --git a/src/ahriman/core/gitremote/remote_push_trigger.py b/src/ahriman/core/gitremote/remote_push_trigger.py index dda92087..8cfadb64 100644 --- a/src/ahriman/core/gitremote/remote_push_trigger.py +++ b/src/ahriman/core/gitremote/remote_push_trigger.py @@ -52,6 +52,10 @@ class RemotePushTrigger(Trigger): "gitremote": { "type": "dict", "schema": { + "type": { + "type": "string", + "allowed": ["gitremote"], + }, "commit_email": { "type": "string", "empty": False, @@ -72,7 +76,6 @@ class RemotePushTrigger(Trigger): }, }, } - CONFIGURATION_SCHEMA_FALLBACK = "gitremote" def __init__(self, repository_id: RepositoryId, configuration: Configuration) -> None: """ @@ -111,7 +114,6 @@ class RemotePushTrigger(Trigger): reporter = ctx.get(Client) for target in self.targets: - section, _ = self.configuration.gettype( - target, self.repository_id, fallback=self.CONFIGURATION_SCHEMA_FALLBACK) + section, _ = self.configuration.gettype(target, self.repository_id, fallback="gitremote") runner = RemotePush(reporter, self.configuration, section) runner.run(result) diff --git a/src/ahriman/core/triggers/trigger.py b/src/ahriman/core/triggers/trigger.py index f586d000..8c738480 100644 --- a/src/ahriman/core/triggers/trigger.py +++ b/src/ahriman/core/triggers/trigger.py @@ -34,8 +34,6 @@ class Trigger(LazyLogging): Attributes: CONFIGURATION_SCHEMA(ConfigurationSchema): (class attribute) configuration schema template - CONFIGURATION_SCHEMA_FALLBACK(str | None): (class attribute) optional fallback option for defining - configuration schema type used REQUIRES_REPOSITORY(bool): (class attribute) either trigger requires loaded repository or not configuration(Configuration): configuration instance repository_id(RepositoryId): repository unique identifier @@ -59,7 +57,6 @@ class Trigger(LazyLogging): """ CONFIGURATION_SCHEMA: ClassVar[ConfigurationSchema] = {} - CONFIGURATION_SCHEMA_FALLBACK: ClassVar[str | None] = None REQUIRES_REPOSITORY: ClassVar[bool] = True def __init__(self, repository_id: RepositoryId, configuration: Configuration) -> None: diff --git a/tests/ahriman/core/triggers/test_trigger.py b/tests/ahriman/core/triggers/test_trigger.py index b6658e86..2070d902 100644 --- a/tests/ahriman/core/triggers/test_trigger.py +++ b/tests/ahriman/core/triggers/test_trigger.py @@ -70,7 +70,6 @@ def test_configuration_schema_variables() -> None: must return empty schema """ assert Trigger.CONFIGURATION_SCHEMA == {} - assert Trigger.CONFIGURATION_SCHEMA_FALLBACK is None def test_configuration_sections(configuration: Configuration) -> None: