Bug 1395717 - Use filename source-test tasks are defined in as part of their label, r=dustin

This creates a new "job-from" field that contains the relative filename the job was defined
in. The filename is relative to 'config.path'. If the task came from the 'jobs' key defined
in kind.yml, this field will be set to 'kind.yml'.

MozReview-Commit-ID: 9e1tEb6XuZT
This commit is contained in:
Andrew Halberstadt
2017-08-31 16:38:08 -04:00
parent d821eebb36
commit ada64d6ce5
11 changed files with 69 additions and 55 deletions

View File

@@ -10,6 +10,7 @@ treeherder configuration and attributes for that platform.
from __future__ import absolute_import, print_function, unicode_literals
import copy
import os
from taskgraph.transforms.base import TransformSequence
from taskgraph.transforms.job import job_description_schema
@@ -68,9 +69,13 @@ def validate(config, jobs):
@transforms.add
def set_job_try_name(config, jobs):
def set_job_name(config, jobs):
for job in jobs:
job.setdefault('attributes', {}).setdefault('job_try_name', job['name'])
if 'job-from' in job and job['job-from'] != 'kind.yml':
from_name = os.path.splitext(job['job-from'])[0]
job['name'] = '{}-{}'.format(from_name, job['name'])
yield job