mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-02-24 21:59:48 +00:00
fix: load gitremote triggers configuration schema from non-standard
paths
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user