Bug 1245953 - Support defining non-build/test Task Cluster tasks; r=garndt
Currently, tasks are either "build" or "test" tasks. And "test" tasks are dependent on "build" tasks, so they are effectively an extension of "build" tasks. Not everything is a "build" task. Not everything is associated with a specific platform. This commit introduces support for defining non-build "tasks" under the "tasks" top-level element of a jobs YAML file. Interally, they are treated as "build" tasks but are declared differently. By default, all these tasks run. The -j/--job argument has been added to the try syntax parser. It specifies an opt-in list of these non-build tasks to run. By default, it runs all of them. The eslint-gecko "build" task has been moved to this new mechanism. Documentation for the new task type have been added. There is definitely some wonkiness in this implementation. For example, there are references to "build_name," "build_type," and "build_product," which arguably are no longer relevant to generic tasks. However, they appear to be so integrated into task processing (including route names) that I'm a bit scared to change them. MozReview-Commit-ID: BY219tLFb6Z
This commit is contained in:
@@ -258,13 +258,25 @@ def parse_commit(message, jobs):
|
||||
parser.add_argument('-p', '--platform', nargs='?', dest='platforms', const='all', default='all')
|
||||
parser.add_argument('-u', '--unittests', nargs='?', dest='tests', const='all', default='all')
|
||||
parser.add_argument('-i', '--interactive', dest='interactive', action='store_true', default=False)
|
||||
parser.add_argument('-j', '--job', dest='jobs', action='append')
|
||||
# In order to run test jobs multiple times
|
||||
parser.add_argument('--trigger-tests', dest='trigger_tests', type=int, default=1)
|
||||
args, unknown = parser.parse_known_args(parts[try_idx:])
|
||||
|
||||
# Normalize default value to something easier to detect.
|
||||
if args.jobs == ['all']:
|
||||
args.jobs = None
|
||||
|
||||
# Expand commas.
|
||||
if args.jobs:
|
||||
expanded = []
|
||||
for job in args.jobs:
|
||||
expanded.extend(j.strip() for j in job.split(','))
|
||||
args.jobs = expanded
|
||||
|
||||
# Then builds...
|
||||
if args.build_types is None:
|
||||
return []
|
||||
args.build_types = []
|
||||
|
||||
build_types = [ BUILD_TYPE_ALIASES.get(build_type, build_type) for
|
||||
build_type in args.build_types ]
|
||||
@@ -319,6 +331,27 @@ def parse_commit(message, jobs):
|
||||
'interactive': args.interactive,
|
||||
})
|
||||
|
||||
# Process miscellaneous tasks.
|
||||
for name, task in sorted(jobs.get('tasks', {}).items()):
|
||||
# args.jobs == None implies all tasks.
|
||||
if args.jobs is not None and name not in args.jobs:
|
||||
continue
|
||||
|
||||
# TODO support tasks that are defined as dependent on another one.
|
||||
if not task.get('root', False):
|
||||
continue
|
||||
|
||||
result.append({
|
||||
'task': task['task'],
|
||||
'post-build': [],
|
||||
'dependents': [],
|
||||
'additional-parameters': task.get('additional-parameters', {}),
|
||||
'build_name': name,
|
||||
# TODO support declaring a different build type
|
||||
'build_type': name,
|
||||
'interactive': args.interactive,
|
||||
})
|
||||
|
||||
# Times that test jobs will be scheduled
|
||||
trigger_tests = args.trigger_tests
|
||||
|
||||
|
||||
Reference in New Issue
Block a user