aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorLoys Ollivier <lollivier@baylibre.com>2018-12-05 14:08:25 +0100
committerLoys Ollivier <lollivier@baylibre.com>2018-12-05 14:29:46 +0100
commit054523569896178e4939766bbd70b34472945441 (patch)
treec77ed2cc8567257b462658a4600e290f7b4c613c /utils
parentbbf18387cdc9ab10f6b9f4f277bbd2790af30190 (diff)
templates: callbacks: support multiple callback targets
LAVA jobs can now submit multiple callbacks per job. Update the create-jobs tool and its underlying templates to support this feature. - Callback templates are now split in two file and follow LAVA specification: 'section' and 'subsection'. - create-jobs tool supports multiple arguments for the '--callback-to' option. - Default configuration for callback targets can now be a list of targets. Change-Id: I36c502c0bb5b54010ce32a53ba78a6be5e6a1642 Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/agljobtemplate.py10
-rwxr-xr-xutils/create-jobs.py2
2 files changed, 7 insertions, 5 deletions
diff --git a/utils/agljobtemplate.py b/utils/agljobtemplate.py
index 8597fee..2307ffc 100644
--- a/utils/agljobtemplate.py
+++ b/utils/agljobtemplate.py
@@ -31,7 +31,10 @@ def parse_callback_file(template_path, lava_callback, kci_callback):
cfg.read(callback_file_path)
if kci_callback is None:
kci_callback = cfg.get('default', 'section')
- cb_data = dict(cfg.items(kci_callback))
+ kci_callback = kci_callback.split(',')
+ cb_data = []
+ for callback_target in kci_callback:
+ cb_data.append(dict(cfg.items(callback_target)))
return cb_data
except (ConfigParser.NoSectionError) as err:
str_err = "'--callback-to {}': must correspond to a section [{}] in the file '{}.cfg'".format(
@@ -161,7 +164,7 @@ class Agljobtemplate(object):
job['kernel_version'] = kernel_version
elif build_version_default:
job['kernel_version'] = build_version_default
-
+
if url_branch:
vcs_branch = url_branch
# if this is an 'int', then it was --changeid
@@ -188,8 +191,7 @@ class Agljobtemplate(object):
if lava_callback:
job['do_callback'] = True
- callback_data = parse_callback_file(self._template_path, lava_callback, kci_callback)
- job.update(callback_data)
+ job['callback_to_list'] = parse_callback_file(self._template_path, lava_callback, kci_callback)
env = jinja2.Environment(loader=jinja2.FileSystemLoader(self._template_path))
env.filters['get_extension'] = get_extension
diff --git a/utils/create-jobs.py b/utils/create-jobs.py
index 384d935..10a26b6 100755
--- a/utils/create-jobs.py
+++ b/utils/create-jobs.py
@@ -30,7 +30,7 @@ def parse_cmdline(machines, tests, rfs_types):
parser.add_argument('--callback-from', action='store', dest='callback_from',
help='The LAVA lab (name) that will be responsible of doing the callback. '
'Please read: ./templates/callback/callback_readme.txt')
- parser.add_argument('--callback-to', action='store', dest='callback_to',
+ parser.add_argument('--callback-to', nargs='+', action='store', dest='callback_to',
help='The KernelCI instance (name) that will receive the callback from LAVA. '
'Please read: ./templates/callback/callback_readme.txt')
parser.add_argument('--test', dest='tests', action='store', choices=tests + ['all'],