Bug 1534283 - filter out tasks when DONT-BUILD is in the message r=aki,tomprince, a=tomprince
authorDustin J. Mitchell <dustin@mozilla.com>
Thu, 14 Mar 2019 21:31:09 +0000
changeset 516382 2f877e90ff57511ad04cb5b40e7fbd04a9ecd820
parent 516381 1936822aea92d858b08bfe7f54addcbb54493435
child 516383 98032105900762a69c9ba195ceca5b280bc7315c
push id1973
push userdmitchell@mozilla.com
push dateFri, 15 Mar 2019 14:41:25 +0000
treeherdermozilla-release@980321059007 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki, tomprince, tomprince
bugs1534283
milestone66.0
Bug 1534283 - filter out tasks when DONT-BUILD is in the message r=aki,tomprince, a=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['release_type'] = ''
     parameters['release_eta'] = ''
     parameters['release_enable_partners'] = False
     parameters['release_partners'] = []
     parameters['release_partner_config'] = {}
     parameters['release_partner_build_number'] = 1
@@ -270,16 +271,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
@@ -653,8 +653,14 @@ def target_tasks_release_simulation(full
             return False
         return True
 
     return [l for l, t in full_task_graph.tasks.iteritems()
             if filter_release_tasks(t, parameters)
             and filter_out_cron(t, parameters)
             and filter_for_target_project(t)
             and filter_out_android_on_esr(t)]
+
+
+@_target_task('nothing')
+def target_tasks_nothing(full_task_graph, parameters, graph_config):
+    """Select nothing, for DONTBUILD pushes"""
+    return []