Skip to content

Commit

Permalink
config/runtime: Add support for parameter "platforms"
Browse files Browse the repository at this point in the history
We might have limited set of platforms available in certain lab.
Lab owners should have option to define such list.
As per suggestion: kernelci/kernelci-project#350 (comment)

Signed-off-by: Denys Fedoryshchenko <[email protected]>
  • Loading branch information
nuclearcat committed May 7, 2024
1 parent 19f65ab commit e86ca17
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion kernelci/config/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -132,6 +136,12 @@ 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()
Expand All @@ -142,6 +152,7 @@ def _get_yaml_attributes(cls):
'queue_timeout',
'url',
'notify',
'platforms',
})
return attrs

Expand Down
2 changes: 2 additions & 0 deletions tests/configs/runtimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ runtimes:
queue_timeout:
days: 1
notify: {}
platforms:
filters:
- blocklist:
tree:
Expand All @@ -50,6 +51,7 @@ runtimes:
callback:
token: some-token-name
url: https://somewhere.com:12345
platforms:
filters:
- blocklist:
tree: [android]
Expand Down

0 comments on commit e86ca17

Please sign in to comment.