From 862d7484c2d73a5e85b4e1c2ac66c45954cc43e8 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Thu, 14 Mar 2019 21:31:09 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- taskcluster/taskgraph/decision.py | 11 +++++++++-- taskcluster/taskgraph/target_tasks.py | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/taskcluster/taskgraph/decision.py b/taskcluster/taskgraph/decision.py index 333f7feb1045..a9e5d3d4c0eb 100644 --- a/taskcluster/taskgraph/decision.py +++ b/taskcluster/taskgraph/decision.py @@ -222,6 +222,8 @@ def get_decision_parameters(config, options): 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'] = [ @@ -233,8 +235,7 @@ def get_decision_parameters(config, options): 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 @@ -276,6 +277,12 @@ def get_decision_parameters(config, options): 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 diff --git a/taskcluster/taskgraph/target_tasks.py b/taskcluster/taskgraph/target_tasks.py index 56cb17400984..cf1286093ba1 100644 --- a/taskcluster/taskgraph/target_tasks.py +++ b/taskcluster/taskgraph/target_tasks.py @@ -682,3 +682,9 @@ def target_tasks_codereview(full_task_graph, parameters, graph_config): 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 [] -- 2.11.4.GIT