From abe76cd28bb06babd1624d5b36077fb34343dd1c Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Tue, 7 May 2024 10:01:46 +0300 Subject: [PATCH] config/runtime: Add support for parameter "platforms" We might have limited set of platforms available in certain lab. Lab owners should have option to define such list. As per suggestion: https://github.com/kernelci/kernelci-project/issues/350#issuecomment-2096625245 Signed-off-by: Denys Fedoryshchenko --- kernelci/config/runtime.py | 12 +++++++++++- tests/configs/runtimes.yaml | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/kernelci/config/runtime.py b/kernelci/config/runtime.py index 3c094b5991..71f88be400 100644 --- a/kernelci/config/runtime.py +++ b/kernelci/config/runtime.py @@ -85,7 +85,7 @@ class RuntimeLAVA(Runtime): # pylint: disable=too-many-arguments def __init__(self, url, priority=None, priority_min=None, priority_max=None, queue_timeout=None, notify=None, - **kwargs): + platforms=None, **kwargs): super().__init__(**kwargs) def _set_priority_value(value, default): @@ -97,6 +97,10 @@ def _set_priority_value(value, default): self._priority_max = _set_priority_value(priority_max, self._priority) self._notify = notify or {} self._queue_timeout = queue_timeout + # set platforms is list or None + if platforms and not isinstance(platforms, list): + raise ValueError('platforms must be a list') + self._platforms = platforms @property def url(self): @@ -132,6 +136,11 @@ def notify(self): """Callback parameters for the `notify` part of the jobs""" return self._notify.copy() + @property + def platforms(self): + """List of platforms supported by the lab""" + return self._platforms + @classmethod def _get_yaml_attributes(cls): attrs = super()._get_yaml_attributes() @@ -142,6 +151,7 @@ def _get_yaml_attributes(cls): 'queue_timeout', 'url', 'notify', + 'platforms', }) return attrs diff --git a/tests/configs/runtimes.yaml b/tests/configs/runtimes.yaml index 27f9b0d563..884b376a84 100644 --- a/tests/configs/runtimes.yaml +++ b/tests/configs/runtimes.yaml @@ -25,6 +25,7 @@ runtimes: queue_timeout: days: 1 notify: {} + platforms: filters: - blocklist: tree: @@ -50,6 +51,7 @@ runtimes: callback: token: some-token-name url: https://somewhere.com:12345 + platforms: filters: - blocklist: tree: [android]