Bug 1534283 - filter out tasks when DONT-BUILD is in the message r=aki,tomprince
authorDustin J. Mitchell <dustin@mozilla.com>
Thu, 14 Mar 2019 21:31:09 +0000
changeset 524972 e44be7f40c6daf7a5858aee63626805527427f41
parent 524971 eb2a987c6ba2d2476f6c312085a9e9dda228d507
child 524973 6e05f81a2f8ff603048062f0ac1943d5aa37a4f4
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki, tomprince
bugs1534283
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534283 - filter out tasks when DONT-BUILD is in the message r=aki,tomprince (without the dash, because I want *this* push to build) This filters out all tasks, but that means that several things will still run: * docker images and tasks they depend on (debian packages) * always_run tasks (various python-y things) Differential Revision: https://phabricator.services.mozilla.com/D23020
taskcluster/taskgraph/decision.py
taskcluster/taskgraph/target_tasks.py
--- a/taskcluster/taskgraph/decision.py
+++ b/taskcluster/taskgraph/decision.py
@@ -217,29 +217,30 @@ def get_decision_parameters(config, opti
         'comm_base_repository',
         'comm_head_repository',
         'comm_head_rev',
         'comm_head_ref',
     ):
         if n in options and options[n] is not None:
             parameters[n] = options[n]
 
+    commit_message = get_hg_commit_message(os.path.join(GECKO, product_dir))
+
     # Define default filter list, as most configurations shouldn't need
     # custom filters.
     parameters['filters'] = [
         'target_tasks_method',
     ]
     parameters['optimize_target_tasks'] = True
     parameters['existing_tasks'] = {}
     parameters['do_not_optimize'] = []
     parameters['build_number'] = 1
     parameters['version'] = get_version(product_dir)
     parameters['app_version'] = get_app_version(product_dir)
-    parameters['message'] = try_syntax_from_message(
-            get_hg_commit_message(os.path.join(GECKO, product_dir)))
+    parameters['message'] = try_syntax_from_message(commit_message)
     parameters['hg_branch'] = get_hg_revision_branch(GECKO, revision=parameters['head_rev'])
     parameters['next_version'] = None
     parameters['phabricator_diff'] = None
     parameters['release_type'] = ''
     parameters['release_eta'] = ''
     parameters['release_enable_partners'] = False
     parameters['release_partners'] = []
     parameters['release_partner_config'] = {}
@@ -271,16 +272,22 @@ def get_decision_parameters(config, opti
                        "PER_PROJECT_PARAMETERS in {} to customize behavior "
                        "for this project".format(project, __file__))
         parameters.update(PER_PROJECT_PARAMETERS['default'])
 
     # `target_tasks_method` has higher precedence than `project` parameters
     if options.get('target_tasks_method'):
         parameters['target_tasks_method'] = options['target_tasks_method']
 
+    # ..but can be overridden by the commit message: if it contains the special
+    # string "DONTBUILD" and this is an on-push decision task, then use the
+    # special 'nothing' target task method.
+    if 'DONTBUILD' in commit_message and options['tasks_for'] == 'hg-push':
+        parameters['target_tasks_method'] = 'nothing'
+
     # If the target method is nightly, we should build partials. This means
     # knowing what has been released previously.
     # An empty release_history is fine, it just means no partials will be built
     parameters.setdefault('release_history', dict())
     if 'nightly' in parameters.get('target_tasks_method', ''):
         parameters['release_history'] = populate_release_history('Firefox', project)
 
     if options.get('try_task_config_file'):
--- a/taskcluster/taskgraph/target_tasks.py
+++ b/taskcluster/taskgraph/target_tasks.py
@@ -677,8 +677,14 @@ def target_tasks_codereview(full_task_gr
 
         # Analyzer tasks
         if task.attributes.get('code-review') is True:
             return True
 
         return False
 
     return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]
+
+
+@_target_task('nothing')
+def target_tasks_nothing(full_task_graph, parameters, graph_config):
+    """Select nothing, for DONTBUILD pushes"""
+    return []