Bug 1524358 - get commit message locally, rather than from task parameters r=tomprince
authorDustin J. Mitchell <dustin@mozilla.com>
Fri, 01 Feb 2019 23:27:48 +0000
changeset 456620 5b3dfdf7012637dbe652898d1e5d35dd99905b64
parent 456619 7fb53ad56f8539f82f0d0cee4124a4e4847e796f
child 456621 4bce8221996f7b61c7aa77c69c5ed672b2c33b1d
push id35496
push userbtara@mozilla.com
push dateMon, 04 Feb 2019 17:36:40 +0000
treeherdermozilla-central@be1beccfb86d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstomprince
bugs1524358
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 1524358 - get commit message locally, rather than from task parameters r=tomprince Differential Revision: https://phabricator.services.mozilla.com/D18288
.taskcluster.yml
taskcluster/mach_commands.py
taskcluster/taskgraph/cron/decision.py
taskcluster/taskgraph/decision.py
taskcluster/taskgraph/test/test_decision.py
taskcluster/taskgraph/util/hg.py
--- a/.taskcluster.yml
+++ b/.taskcluster.yml
@@ -8,17 +8,17 @@
 #     now,
 #     as_slugid: // function
 #     ownTaskId: // taskId of the task that will be created
 #   }
 #
 # - cron tasks - See taskcluster/taskgraph/cron/decision.py
 #   {
 #     tasks_for: 'cron',
-#     push: {revision, pushlog_id, pushdate, owner, comment}
+#     push: {revision, pushlog_id, pushdate, owner}
 #     repository: {url, project, level},
 #     cron: {task_id, job_name, job_symbol, quoted_args},
 #     now,
 #     ownTaskId: // taskId of the task that will be created
 #   }
 #
 # - action tasks - See:
 #   * taskcluster/taskgraph/actions/registry.py,
@@ -186,17 +186,16 @@ tasks:
           env:
             # checkout-gecko uses these to check out the source; the inputs
             # to `mach taskgraph decision` are all on the command line.
             $merge:
               - GECKO_BASE_REPOSITORY: 'https://hg.mozilla.org/mozilla-unified'
                 GECKO_HEAD_REPOSITORY: '${repoUrl}'
                 GECKO_HEAD_REF: '${push.revision}'
                 GECKO_HEAD_REV: '${push.revision}'
-                GECKO_COMMIT_MSG: {$if: 'tasks_for != "action"', then: '${push.comment}'}
                 HG_STORE_PATH: /builds/worker/checkouts/hg-store
                 TASKCLUSTER_CACHES: /builds/worker/checkouts
                 # someday, these will be provided by the worker - Bug 1492664
                 TASKCLUSTER_ROOT_URL: https://taskcluster.net
                 TASKCLUSTER_PROXY_URL: http://taskcluster
               - $if: 'tasks_for == "action"'
                 then:
                   ACTION_TASK_GROUP_ID: '${action.taskGroupId}'     # taskGroupId of the target task
@@ -235,17 +234,16 @@ tasks:
                   ./mach --log-no-times taskgraph action-callback
                 else: >
                   cd /builds/worker/checkouts/gecko &&
                   ln -s /builds/worker/artifacts artifacts &&
                   ./mach --log-no-times taskgraph decision
                   --pushlog-id='${push.pushlog_id}'
                   --pushdate='${push.pushdate}'
                   --project='${repository.project}'
-                  --message="$GECKO_COMMIT_MSG"
                   --owner='${ownerEmail}'
                   --level='${repository.level}'
                   --base-repository="$GECKO_BASE_REPOSITORY"
                   --head-repository="$GECKO_HEAD_REPOSITORY"
                   --head-ref="$GECKO_HEAD_REF"
                   --head-rev="$GECKO_HEAD_REV"
                   ${extraArgs}
 
--- a/taskcluster/mach_commands.py
+++ b/taskcluster/mach_commands.py
@@ -144,19 +144,16 @@ class MachCommands(MachCommandBase):
                      required=False,
                      help='URL for "head" comm-* repository to fetch revision from')
     @CommandArgument('--comm-head-ref',
                      required=False,
                      help='comm-* Reference (this is same as rev usually for hg)')
     @CommandArgument('--comm-head-rev',
                      required=False,
                      help='Commit revision to use from head comm-* repository')
-    @CommandArgument('--message',
-                     required=True,
-                     help='Commit message to be parsed. Example: "try: -b do -p all -u all"')
     @CommandArgument('--project',
                      required=True,
                      help='Project to use for creating task graph. Example: --project=try')
     @CommandArgument('--pushlog-id',
                      dest='pushlog_id',
                      required=True,
                      default=0)
     @CommandArgument('--pushdate',
--- a/taskcluster/taskgraph/cron/decision.py
+++ b/taskcluster/taskgraph/cron/decision.py
@@ -54,17 +54,16 @@ def make_decision_task(params, root, sym
             'level': params['level'],
         },
         'push': {
             'revision': params['head_rev'],
             # remainder are fake values, but the decision task expects them anyway
             'pushlog_id': push_info['pushid'],
             'pushdate': push_info['pushdate'],
             'owner': 'cron',
-            'comment': '',
         },
         'cron': {
             'task_id': os.environ.get('TASK_ID', '<cron task id>'),
             'job_name': params['job_name'],
             'job_symbol': symbol,
             # args are shell-quoted since they are given to `bash -c`
             'quoted_args': ' '.join(pipes.quote(a) for a in arguments),
         },
--- a/taskcluster/taskgraph/decision.py
+++ b/taskcluster/taskgraph/decision.py
@@ -15,17 +15,17 @@ import yaml
 from . import GECKO
 from .actions import render_actions_json
 from .create import create_tasks
 from .generator import TaskGraphGenerator
 from .parameters import Parameters, get_version, get_app_version
 from .taskgraph import TaskGraph
 from .try_option_syntax import parse_message
 from .util.schema import validate_schema, Schema
-from taskgraph.util.hg import get_hg_revision_branch
+from taskgraph.util.hg import get_hg_revision_branch, get_hg_commit_message
 from taskgraph.util.partials import populate_release_history
 from taskgraph.util.yaml import load_yaml
 from voluptuous import Required, Optional
 
 
 logger = logging.getLogger(__name__)
 
 ARTIFACTS_DIR = 'artifacts'
@@ -188,17 +188,16 @@ def get_decision_parameters(config, opti
     """
     product_dir = config['product-dir']
 
     parameters = {n: options[n] for n in [
         'base_repository',
         'head_repository',
         'head_rev',
         'head_ref',
-        'message',
         'project',
         'pushlog_id',
         'pushdate',
         'owner',
         'level',
         'target_tasks_method',
     ] if n in options}
 
@@ -217,16 +216,17 @@ def get_decision_parameters(config, opti
         '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'] = get_hg_commit_message(GECKO)
     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
--- a/taskcluster/taskgraph/test/test_decision.py
+++ b/taskcluster/taskgraph/test/test_decision.py
@@ -82,18 +82,19 @@ class TestGetDecisionParameters(unittest
     @patch('taskgraph.decision.get_hg_revision_branch')
     def test_no_email_owner(self, _):
         self.options['owner'] = 'ffxbld'
         with MockedOpen({self.ttc_file: None}):
             params = decision.get_decision_parameters(FAKE_GRAPH_CONFIG, self.options)
         self.assertEqual(params['owner'], 'ffxbld@noreply.mozilla.org')
 
     @patch('taskgraph.decision.get_hg_revision_branch')
-    def test_try_options(self, _):
-        self.options['message'] = 'try: -b do -t all'
+    @patch('taskgraph.decision.get_hg_commit_message')
+    def test_try_options(self, mock_get_hg_commit_message, _):
+        mock_get_hg_commit_message.return_value = 'try: -b do -t all'
         self.options['project'] = 'try'
         with MockedOpen({self.ttc_file: None}):
             params = decision.get_decision_parameters(FAKE_GRAPH_CONFIG, self.options)
         self.assertEqual(params['try_mode'], 'try_option_syntax')
         self.assertEqual(params['try_options']['build_types'], 'do')
         self.assertEqual(params['try_options']['unittests'], 'all')
         self.assertEqual(params['try_task_config'], None)
 
--- a/taskcluster/taskgraph/util/hg.py
+++ b/taskcluster/taskgraph/util/hg.py
@@ -42,13 +42,17 @@ def get_hg_revision_branch(root, revisio
     relbranch) of the revision."""
     return subprocess.check_output([
         'hg', 'identify',
         '-T', '{branch}',
         '--rev', revision,
     ], cwd=root)
 
 
+# For these functions, we assume that run-task has correctly checked out the
+# revision indicated by GECKO_HEAD_REF, so all that remains is to see what the
+# current revision is.  Mercurial refers to that as `.`.
+def get_hg_commit_message(root):
+    return subprocess.check_output(['hg', 'log', '-r', '.', '-T', '{desc}'], cwd=root)
+
+
 def calculate_head_rev(root):
-    # we assume that run-task has correctly checked out the revision indicated by
-    # GECKO_HEAD_REF, so all that remains is to see what the current revision is.
-    # Mercurial refers to that as `.`.
     return subprocess.check_output(['hg', 'log', '-r', '.', '-T', '{node}'], cwd=root)