Closed Bug 1451370 Opened 7 years ago Closed 3 years ago

Ability to apply try_task_config.json templates conditionally

Categories

(Firefox Build System :: Task Configuration, task)

3 Branch
task
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: ahal, Unassigned)

Details

Often, we only want templates to apply to certain tasks. For example, the 'artifact' template, should only apply to build tasks and nothing else. At the moment, this is handled in the template itself: https://searchfox.org/mozilla-central/source/taskcluster/taskgraph/templates/artifact.yml#4 And for simple cases like this, this method works just fine. However, when trying to build a more complicated template, handling everything with json-e becomes *very* complex. I was trying to design a generic 'command.yml' template, which took as input a set of command line arguments, and appended them to the task's command. On the surface this is simple, but the commands that are accepted are very different from one task to the next. We'll also want to support multiple different command templates (each of which could apply to a different subset of tasks) in the same push. Doing this entirely in json-e is theoretically possible, but it'll be really convoluted and unreadable. Plus, we'll want to do similar stuff for future templates as well which means lots of duplication. Instead, I'd like to propose a new format to the 'templates' in try_task_config.json. Right now it looks like: templates: { 'name1': <input1>, 'name2': <input2>, ... } Instead, I propose: templates: [ {'name': '<name1>', 'input': <input1>, 'condition': <condition1>}, {'name': '<name2>', 'input': <input2>}, ... ] This adds an optional 'condition' key which morph.py would use to pre-filter a list of tasks. I.e, if the condition doesn't match a task, we don't even call jsone.render() on it. If the condition is missing, the template applies to all tasks (like the current behaviour). I'm not sure what the condition should be yet. Maybe a regex over the task label? Maybe a dict which must be a subset of the Task attributes? Something else? Another change this makes is that multiple of the same template can be applied. For example, we could apply one environment variable to 'mochitest' tasks, and another to 'reftest' tasks. I think this change will result in cleaner yet more powerful templates and be a building block for cool things.
Version: Version 3 → 3 Branch

These template files don't exist anymore.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.