fix: load gitremote triggers configuration schema from non-standard

paths
This commit is contained in:
2026-02-16 22:53:23 +02:00
parent 93c36fb429
commit c8f7fa8c51
5 changed files with 12 additions and 10 deletions

View File

@@ -250,6 +250,7 @@ Available options are:
Remote pull trigger 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_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``. * ``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 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_email`` - git commit email, string, optional, default is ``ahriman@localhost``.
* ``commit_user`` - git commit user, string, optional, default is ``ahriman``. * ``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. * ``push_url`` - URL of the remote repository to which PKGBUILDs should be pushed after build process, string, required.

View File

@@ -48,6 +48,10 @@ class RemotePullTrigger(Trigger):
"gitremote": { "gitremote": {
"type": "dict", "type": "dict",
"schema": { "schema": {
"type": {
"type": "string",
"allowed": ["gitremote"],
},
"pull_url": { "pull_url": {
"type": "string", "type": "string",
"required": True, "required": True,
@@ -60,7 +64,6 @@ class RemotePullTrigger(Trigger):
}, },
}, },
} }
CONFIGURATION_SCHEMA_FALLBACK = "gitremote"
def __init__(self, repository_id: RepositoryId, configuration: Configuration) -> None: 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 trigger action which will be called at the start of the application
""" """
for target in self.targets: for target in self.targets:
section, _ = self.configuration.gettype( section, _ = self.configuration.gettype(target, self.repository_id, fallback="gitremote")
target, self.repository_id, fallback=self.CONFIGURATION_SCHEMA_FALLBACK)
runner = RemotePull(self.repository_id, self.configuration, section) runner = RemotePull(self.repository_id, self.configuration, section)
runner.run() runner.run()

View File

@@ -52,6 +52,10 @@ class RemotePushTrigger(Trigger):
"gitremote": { "gitremote": {
"type": "dict", "type": "dict",
"schema": { "schema": {
"type": {
"type": "string",
"allowed": ["gitremote"],
},
"commit_email": { "commit_email": {
"type": "string", "type": "string",
"empty": False, "empty": False,
@@ -72,7 +76,6 @@ class RemotePushTrigger(Trigger):
}, },
}, },
} }
CONFIGURATION_SCHEMA_FALLBACK = "gitremote"
def __init__(self, repository_id: RepositoryId, configuration: Configuration) -> None: def __init__(self, repository_id: RepositoryId, configuration: Configuration) -> None:
""" """
@@ -111,7 +114,6 @@ class RemotePushTrigger(Trigger):
reporter = ctx.get(Client) reporter = ctx.get(Client)
for target in self.targets: for target in self.targets:
section, _ = self.configuration.gettype( section, _ = self.configuration.gettype(target, self.repository_id, fallback="gitremote")
target, self.repository_id, fallback=self.CONFIGURATION_SCHEMA_FALLBACK)
runner = RemotePush(reporter, self.configuration, section) runner = RemotePush(reporter, self.configuration, section)
runner.run(result) runner.run(result)

View File

@@ -34,8 +34,6 @@ class Trigger(LazyLogging):
Attributes: Attributes:
CONFIGURATION_SCHEMA(ConfigurationSchema): (class attribute) configuration schema template 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 REQUIRES_REPOSITORY(bool): (class attribute) either trigger requires loaded repository or not
configuration(Configuration): configuration instance configuration(Configuration): configuration instance
repository_id(RepositoryId): repository unique identifier repository_id(RepositoryId): repository unique identifier
@@ -59,7 +57,6 @@ class Trigger(LazyLogging):
""" """
CONFIGURATION_SCHEMA: ClassVar[ConfigurationSchema] = {} CONFIGURATION_SCHEMA: ClassVar[ConfigurationSchema] = {}
CONFIGURATION_SCHEMA_FALLBACK: ClassVar[str | None] = None
REQUIRES_REPOSITORY: ClassVar[bool] = True REQUIRES_REPOSITORY: ClassVar[bool] = True
def __init__(self, repository_id: RepositoryId, configuration: Configuration) -> None: def __init__(self, repository_id: RepositoryId, configuration: Configuration) -> None:

View File

@@ -70,7 +70,6 @@ def test_configuration_schema_variables() -> None:
must return empty schema must return empty schema
""" """
assert Trigger.CONFIGURATION_SCHEMA == {} assert Trigger.CONFIGURATION_SCHEMA == {}
assert Trigger.CONFIGURATION_SCHEMA_FALLBACK is None
def test_configuration_sections(configuration: Configuration) -> None: def test_configuration_sections(configuration: Configuration) -> None: