Bug 1249078 - Support grouping and running tasks by tag; r=garndt

We can now define a list of "tags" for a task. Specifying "-j <tag>"
in Try syntax will run all tasks having that tag.

MozReview-Commit-ID: Ih9Z0tRZ5VA
This commit is contained in:
Gregory Szorc 2016-02-17 11:12:40 -08:00
parent 7b7f74dcc1
commit 8ce05975a4
2 changed files with 21 additions and 2 deletions

View File

@ -175,6 +175,11 @@ when
*optional* Dictionary of conditions that must be met for this task
to run. See the section below for more details.
tags
*optional* List of string labels attached to the task. Multiple tasks
with the same tag can all be scheduled at once by specifying the tag
with the ``-j <tag>`` try syntax.
Conditional Execution
---------------------

View File

@ -332,9 +332,23 @@ def parse_commit(message, jobs):
})
# Process miscellaneous tasks.
for name, task in sorted(jobs.get('tasks', {}).items()):
def filtertask(name, task):
# args.jobs == None implies all tasks.
if args.jobs is not None and name not in args.jobs:
if args.jobs is None:
return True
if name in args.jobs:
return True
for tag in task.get('tags', []):
if tag in args.jobs:
return True
return False
for name, task in sorted(jobs.get('tasks', {}).items()):
if not filtertask(name, task):
continue
# TODO support tasks that are defined as dependent on another one.