Skip to content

Commit 98b60a3

Browse files
author
Staging script
committed
Staging PR 3019
1 parent d79e5fe commit 98b60a3

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

kernelci/legacy/config/build.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ class BuildConfig(YAMLConfigObject):
359359

360360
yaml_tag = u'!BuildConfig'
361361

362-
def __init__(self, name, tree, branch, variants, reference=None, architectures=None):
362+
def __init__(self, name, tree, branch, variants, reference=None,
363+
architectures=None, frequency=None):
363364
"""A build configuration defines the actual kernels to be built.
364365
365366
*name* is the name of the build configuration. It is arbitrary and
@@ -378,13 +379,18 @@ def __init__(self, name, tree, branch, variants, reference=None, architectures=N
378379
bisections when no base commit is found for the good and
379380
bad revisions. It can also be None if no reference branch
380381
can be used with this build configuration.
382+
383+
*frequency* is an optional string that limits how often a checkout node
384+
can be created for this tree/branch. Format: [Nd][Nh][Nm]
385+
e.g. "1d" for once per day, "12h" for twice per day.
381386
"""
382387
self._name = name
383388
self._tree = tree
384389
self._branch = branch
385390
self._variants = variants
386391
self._reference = reference
387392
self._architectures = architectures
393+
self._frequency = frequency
388394

389395
@classmethod
390396
def load_from_yaml(cls, config, name, trees, fragments, b_envs, defaults):
@@ -406,6 +412,7 @@ def load_from_yaml(cls, config, name, trees, fragments, b_envs, defaults):
406412
if reference:
407413
kw['reference'] = Reference.load_from_yaml(reference, trees)
408414
kw['architectures'] = config.get('architectures', None)
415+
kw['frequency'] = config.get('frequency', None)
409416
return cls(**kw)
410417

411418
@property
@@ -435,16 +442,21 @@ def get_variant(self, name):
435442
def reference(self):
436443
return self._reference
437444

445+
@property
446+
def frequency(self):
447+
return self._frequency
448+
438449
@classmethod
439450
def to_yaml(cls, dumper, data):
440-
return dumper.represent_mapping(
441-
u'tag:yaml.org,2002:map', {
442-
'tree': data.tree.name,
443-
'branch': data.branch,
444-
'variants': {var.name: var for var in data.variants},
445-
'reference': data.reference,
446-
}
447-
)
451+
result = {
452+
'tree': data.tree.name,
453+
'branch': data.branch,
454+
'variants': {var.name: var for var in data.variants},
455+
'reference': data.reference,
456+
}
457+
if data.frequency:
458+
result['frequency'] = data.frequency
459+
return dumper.represent_mapping(u'tag:yaml.org,2002:map', result)
448460

449461

450462
def from_yaml(data, filters):

0 commit comments

Comments
 (0)