Bug 1364421 - Allow BBB jobs to be backfilled
MozReview-Commit-ID: 1CWRd4YUISc
--- a/taskcluster/taskgraph/action.py
+++ b/taskcluster/taskgraph/action.py
@@ -70,29 +70,35 @@ def backfill(project, job_id):
* Scheduling backfill jobs from a given treeherder resultset backwards until either
a successful job is found or `N` jobs have been scheduled.
"""
s = requests.Session()
s.headers.update({"User-Agent": "gecko-intree-backfill-task"})
job = s.get(url="{}/project/{}/jobs/{}/".format(TREEHERDER_URL, project, job_id)).json()
- if job["build_system_type"] != "taskcluster":
- logger.warning("Invalid build system type! Must be a Taskcluster job. Aborting.")
- return
+ job_type_name = job['job_type_name']
+
+ if job['build_system_type'] != 'taskcluster':
+ if 'Created by BBB for task' not in job['reason']:
+ logger.warning("Invalid build system type! Must be a Taskcluster job. Aborting.")
+ return
+ task_id = job['reason'].split(' ')[-1]
+ task = requests.get("https://queue.taskcluster.net/v1/task/{}".format(task_id)).json()
+ job_type_name = task['metadata']['name']
filters = dict((k, job[k]) for k in ("build_platform_id", "platform_option", "job_type_id"))
resultset_url = "{}/project/{}/resultset/".format(TREEHERDER_URL, project)
params = {"id__lt": job["result_set_id"], "count": MAX_BACKFILL_RESULTSETS}
results = s.get(url=resultset_url, params=params).json()["results"]
resultsets = [resultset["id"] for resultset in results]
for decision in load_decisions(s, project, resultsets, filters):
- add_tasks(decision, [job["job_type_name"]], '{}-'.format(decision))
+ add_tasks(decision, [job_type_name], '{}-'.format(decision))
def add_talos(decision_task_id, times=1):
"""
Run the add-talos task. This function implements `mach taskgraph add-talos`,
and is responsible for
* Adding all talos jobs to a push.