Bug 1431193 - Use taskgraph.parameters.load_parameters_file in mach artifact toolchain. r?dustin draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 18 Jan 2018 16:24:19 +0900
changeset 722306 e50454d3c121d054f96c09690198a8f7e2d0d282
parent 721973 ac355333d769a212121b18352be37d3434e8aa9e
child 746595 43d94444b5ec8b6eeeae2712fe6401e1824e4434
push id96130
push userbmo:mh+mozilla@glandium.org
push dateThu, 18 Jan 2018 21:18:27 +0000
reviewersdustin
bugs1431193, 1401199, 1430823
milestone59.0a1
Bug 1431193 - Use taskgraph.parameters.load_parameters_file in mach artifact toolchain. r?dustin Back when the mach artifact toolchain code was written, there was no official way to get a default set of parameters for taskgraph generation. As of bug 1401199, that is not true anymore, so we can now use that instead of manually set parameters and hope that doesn't break, which happened with bug 1430823. This change should make things more future proof. This also reverts the changes from changeset 3a8491857651, which fixed the same issue in a slightly different way.
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1223,17 +1223,16 @@ class PackageFrontend(MachCommandBase):
             unpack_file,
         )
         from requests.adapters import HTTPAdapter
         import redo
         import requests
         import shutil
 
         from taskgraph.generator import load_graph_config, Kind
-        from taskgraph.parameters import Parameters
         from taskgraph.util.taskcluster import (
             get_artifact_url,
             list_artifacts,
         )
         import yaml
 
         self._set_log_level(verbose)
         # Normally, we'd use self.log_manager.enable_unstructured(),
@@ -1330,34 +1329,26 @@ class PackageFrontend(MachCommandBase):
 
         if from_build:
             if 'TASK_ID' in os.environ:
                 self.log(logging.ERROR, 'artifact', {},
                          'Do not use --from-build in automation; all dependencies '
                          'should be determined in the decision task.')
                 return 1
             from taskgraph.optimize import IndexSearch
-            params = {
-                'message': '',
-                'project': '',
-                'level': os.environ.get('MOZ_SCM_LEVEL', '3'),
-                'base_repository': '',
-                'head_repository': '',
-                'head_rev': '',
-                'moz_build_date': '',
-                'build_date': 0,
-                'pushlog_id': 0,
-                'owner': '',
-            }
+            from taskgraph.parameters import Parameters
+            params = Parameters(
+                level=os.environ.get('MOZ_SCM_LEVEL', '3'),
+                strict=False)
 
             # TODO: move to the taskcluster package
             def tasks(kind_name):
                 root_path = mozpath.join(self.topsrcdir, 'taskcluster', 'ci')
                 graph_config = load_graph_config(root_path)
-                tasks = Kind.load(root_path, graph_config, kind_name).load_tasks(Parameters(**params), {})
+                tasks = Kind.load(root_path, graph_config, kind_name).load_tasks(params, {})
                 return {
                     task.task['metadata']['name']: task
                     for task in tasks
                 }
 
             toolchains = tasks('toolchain')
 
             aliases = {}