Bug 1383880: use a vcs-compatible reader in decision tasks; r=gps
authorDustin J. Mitchell <dustin@mozilla.com>
Thu, 07 Sep 2017 18:28:22 +0000
changeset 435459 817f14e03e814e2db177c7840217ddd782f800d0
parent 435458 e62999cee1cdb9b8536e79c37a9770423d10d5a4
child 435460 e3190ac566b7d41ec3d3c70e3bcbc0e8e49d61c5
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1383880
milestone58.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 1383880: use a vcs-compatible reader in decision tasks; r=gps This continues to use a file-based reader when run locally. MozReview-Commit-ID: CJuYKDj2E3n
taskcluster/taskgraph/optimize.py
--- a/taskcluster/taskgraph/optimize.py
+++ b/taskcluster/taskgraph/optimize.py
@@ -21,17 +21,17 @@ from collections import defaultdict
 from .graph import Graph
 from . import files_changed
 from .taskgraph import TaskGraph
 from .util.seta import is_low_value_task
 from .util.taskcluster import find_task_id
 from .util.parameterization import resolve_task_references
 from mozbuild.util import memoize
 from slugid import nice as slugid
-from mozbuild.frontend import reader
+from mozbuild.base import MozbuildObject
 
 logger = logging.getLogger(__name__)
 
 TOPSRCDIR = os.path.abspath(os.path.join(__file__, '../../../'))
 
 
 def optimize_task_graph(target_task_graph, params, do_not_optimize,
                         existing_tasks=None, strategies=None):
@@ -353,18 +353,22 @@ class SkipUnlessChanged(OptimizationStra
 
 
 class SkipUnlessSchedules(OptimizationStrategy):
 
     @memoize
     def scheduled_by_push(self, repository, revision):
         changed_files = files_changed.get_changed_files(repository, revision)
 
-        config = reader.EmptyConfig(TOPSRCDIR)
-        rdr = reader.BuildReader(config)
+        mbo = MozbuildObject.from_environment()
+        # the decision task has a sparse checkout, so, mozbuild_reader will use
+        # a MercurialRevisionFinder with revision '.', which should be the same
+        # as `revision`; in other circumstances, it will use a default reader
+        rdr = mbo.mozbuild_reader(config_mode='empty')
+
         components = set()
         for p, m in rdr.files_info(changed_files).items():
             components |= set(m['SCHEDULES'].components)
 
         return components
 
     def should_remove_task(self, task, params, conditions):
         if params.get('pushlog_id') == -1: