Bug 1450012: [taskgraph] Disable retrigger action for many tasks; r=dustin

Many tasks (release tasks and cached tasks, in particular) should be re-run rather
than retriggered. Disable retrigger action for those tasks by default.

Differential Revision: https://phabricator.services.mozilla.com/D27206

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Prince 2019-04-16 22:02:46 +00:00
parent c5ce882ccb
commit 34f2b043a9
12 changed files with 82 additions and 3 deletions

View File

@ -15,6 +15,8 @@ transforms:
- taskgraph.transforms.task:transforms
job-defaults:
attributes:
retrigger: true
treeherder:
kind: build
tier: 1

View File

@ -25,3 +25,5 @@ job-template:
- mar-signing
run-on-projects: []
nightly: false
attributes:
retrigger: true

View File

@ -30,6 +30,10 @@ jobs-from:
- wpt-metadata.yml
- wpt-manifest.yml
job-defaults:
attributes:
retrigger: true
# This is used by run-task based tasks to lookup which build task it
# should depend on based on its own platform.
dependent-build-platforms:

View File

@ -16,6 +16,8 @@ transforms:
- taskgraph.transforms.task:transforms
job-defaults:
attributes:
retrigger: true
treeherder:
kind: build
tier: 1

View File

@ -15,6 +15,8 @@ transforms:
- taskgraph.transforms.task:transforms
job-defaults:
attributes:
retrigger: true
index:
product: firefox
worker:

View File

@ -35,8 +35,9 @@ jobs-from:
- web-platform.yml
- xpcshell.yml
job-defaults:
attributes:
retrigger: true
require-signed-extensions:
by-release-type:
release|esr.*: true

View File

@ -14,6 +14,10 @@ transforms:
- taskgraph.transforms.job:transforms
- taskgraph.transforms.task:transforms
job-defaults:
attributes:
retrigger: true
jobs:
linux64-valgrind/opt:
description: "Linux64 Valgrind Opt"

View File

@ -13,6 +13,8 @@ transforms:
- taskgraph.transforms.task:transforms
job-defaults:
attributes:
retrigger: true
run-on-projects: ['mozilla-beta', 'trunk', 'try']
treeherder:
tier: 1

View File

@ -307,3 +307,7 @@ If a task set this boolean attribute to `true`, it will be processed by the code
review bot, the task will ran for every new Phabricator diff.
Any supported and detected issue will be automatically reported on the
Phabricator revision.
retrigger
=========
Whether the task can be retriggered, or if it needs to be re-run.

View File

@ -240,6 +240,7 @@ def register_callback_action(name, title, symbol, description, order=10000,
mem['registered'] = True
callbacks[cb_name] = cb
return cb
return register_callback

View File

@ -6,6 +6,8 @@
from __future__ import absolute_import, print_function, unicode_literals
import sys
import logging
import textwrap
@ -61,7 +63,7 @@ def retrigger_decision_action(parameters, graph_config, input, task_group_id, ta
'Create a clone of the task.'
),
order=19, # must be greater than other orders in this file, as this is the fallback version
context=[{}],
context=[{'retrigger': 'true'}],
schema={
'type': 'object',
'properties': {
@ -84,6 +86,48 @@ def retrigger_decision_action(parameters, graph_config, input, task_group_id, ta
}
}
)
@register_callback_action(
title='Retrigger (disabled)',
name='retrigger',
cb_name='retrigger-disabled',
symbol='rt',
generic=True,
description=(
'Create a clone of the task.\n\n'
'This type of task should typically be re-run instead of re-triggered.'
),
order=20, # must be greater than other orders in this file, as this is the fallback version
context=[{}],
schema={
'type': 'object',
'properties': {
'downstream': {
'type': 'boolean',
'description': (
'If true, downstream tasks from this one will be cloned as well. '
'The dependencies will be updated to work with the new task at the root.'
),
'default': False,
},
'times': {
'type': 'integer',
'default': 1,
'minimum': 1,
'maximum': 100,
'title': 'Times',
'description': 'How many times to run each task.',
},
'force': {
'type': 'boolean',
'default': False,
'description': (
'This task should not be re-triggered. '
'This can be overridden by passing `true` here.'
),
},
}
}
)
def retrigger_action(parameters, graph_config, input, task_group_id, task_id):
decision_task_id, full_task_graph, label_to_taskid = fetch_graph_and_labels(
parameters, graph_config)
@ -94,6 +138,15 @@ def retrigger_action(parameters, graph_config, input, task_group_id, task_id):
with_downstream = ' '
to_run = [label]
if not input.get('force', None) and not full_task_graph[label].attributes.get('retrigger'):
logger.info(
"Not retriggering task {}, task should not be retrigged "
"and force not specified.".format(
label
)
)
sys.exit(1)
if input.get('downstream'):
to_run = full_task_graph.graph.transitive_closure(set(to_run), reverse=True).nodes
to_run = to_run & set(label_to_taskid.keys())

View File

@ -1780,10 +1780,13 @@ def build_task(config, tasks):
task['priority'] = get_default_priority(config.graph_config, config.params['project'])
tags = task.get('tags', {})
attributes = task.get('attributes', {})
tags.update({
'createdForUser': config.params['owner'],
'kind': config.kind,
'label': task['label'],
'retrigger': 'true' if attributes.get('retrigger', False) else 'false'
})
task_def = {
@ -1818,7 +1821,6 @@ def build_task(config, tasks):
# add the payload and adjust anything else as required (e.g., scopes)
payload_builders[task['worker']['implementation']](config, task, task_def)
attributes = task.get('attributes', {})
# Resolve run-on-projects
build_platform = attributes.get('build_platform')
resolve_keyed_by(task, 'run-on-projects', item_name=task['label'],