[Fuego] [PATCH 2/2] add-jobs: add trigger parameter to specify next job
Daniel Sangorrin
daniel.sangorrin at toshiba.co.jp
Fri Nov 9 08:27:20 UTC 2018
This patch adds the option --trigger <next job> to the
add-jobs interface. It allows triggering a new job once it
finishes.
Currently, the next job is triggered not matter whether
the job fails or not (I wrote a comment that shows how
to trigger it only if the job succeeds). Probably, we
need to add a new flag to specify that behavior.
Another thing that could be added is the ability to trigger
more jobs.
Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
engine/scripts/ftc | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index 6f605db..007e5a8 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -102,7 +102,7 @@ command_help = {
"add-jobs": ("Adds jobs to Jenkins.",
"""Usage: ftc add-jobs -b <board>[,board2...] [-p <testplan> | -t <testcase> -s <testspec>]
[--timeout <timeout>] [--rebuild <true|false>] [--reboot <true|false>]
- [--precleanup <true|false>] [--postcleanup <true|false>]
+ [--precleanup <true|false>] [--postcleanup <true|false>] [--trigger <next_job>]
Example: ftc add-jobs -b docker -p testplan_docker
Example: ftc add-jobs -b docker -t Benchmark.Dhrystone --timeout 5m --rebuild false
board,testplan,testpec: use list-board/plans/specs to see the available ones.
@@ -111,6 +111,7 @@ command_help = {
reboot: if true reboot the board before the test.
precleanup: if true clean the board's test folder before the test.
postcleanup: if true clean the board's test folder after the test.
+ trigger: job to trigger next
Note that you can specify more than one board using a comma-separated
list for the <board> argument. e.g.
@@ -1608,6 +1609,8 @@ def do_add_jobs(conf, options):
if '-p' in options and '-t' in options:
error_out('Testplan (-p) and test (-t) options are mutually exclusive.')
+ elif '-p' in options and '--trigger' in options:
+ error_out('Testplan (-p) and --trigger options are mutually exclusive.')
elif '-p' in options:
try:
testplan = options[options.index('-p') + 1]
@@ -1641,10 +1644,23 @@ def do_add_jobs(conf, options):
options.remove(spec)
test_dict["spec"] = spec
+ if '--trigger' in options:
+ try:
+ next_job = options[options.index('--trigger') + 1]
+ except IndexError:
+ error_out('job not provided after --trigger.')
+ jobs = [job['name'] for job in server.get_jobs()]
+ if next_job not in jobs:
+ raise Exception('Job %s not found.' % next_job)
+ options.remove('--trigger')
+ options.remove(next_job)
+ else:
+ next_job = None
+
if test_name:
test = test_class(test_dict)
for board_name in board_names:
- create_job(board_name, test)
+ create_job(board_name, test, next_job)
else:
plan_tests = parse_testplan(testplan, test_dict)
for board_name in board_names:
--
2.7.4
More information about the Fuego
mailing list