Bug 1421002: Get tasks for `mach try fuzzy` from the root of the repository; r=ahal

`mach try` pushes the repository containing the current directory. When this is
a comm-central checkout, the taskcluster configuration should also come from that
repository.

MozReview-Commit-ID: KWbNAe4jrHT

--HG--
extra : rebase_source : e40f5038bdd190fb4cb801ba817c31a3e4031354
extra : source : 7164b051c965280aeb3083e47a93c6d4ac44e2ed
This commit is contained in:
Tom Prince 2017-11-21 13:39:21 -07:00
Родитель 3890179b24
Коммит 98988ab6fc
2 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -198,7 +198,7 @@ def run_fuzzy_try(update=False, query=None, templates=None, full=False, paramete
vcs = VCSHelper.create()
vcs.check_working_directory(push)
all_tasks = generate_tasks(parameters, full)
all_tasks = generate_tasks(parameters, full, root=vcs.root)
key_shortcuts = [k + ':' + v for k, v in fzf_shortcuts.iteritems()]
cmd = [

Просмотреть файл

@ -33,11 +33,11 @@ https://firefox-source-docs.mozilla.org/taskcluster/taskcluster/mach.html#parame
"""
def invalidate(cache):
def invalidate(cache, root):
if not os.path.isfile(cache):
return
tc_dir = os.path.join(build.topsrcdir, 'taskcluster')
tc_dir = os.path.join(root, 'taskcluster')
tmod = max(os.path.getmtime(os.path.join(tc_dir, p)) for p, _ in FileFinder(tc_dir))
cmod = os.path.getmtime(cache)
@ -45,14 +45,14 @@ def invalidate(cache):
os.remove(cache)
def generate_tasks(params=None, full=False):
def generate_tasks(params, full, root):
params = params or "project=mozilla-central"
cache_dir = os.path.join(get_state_dir()[0], 'cache', 'taskgraph')
attr = 'full_task_set' if full else 'target_task_set'
cache = os.path.join(cache_dir, attr)
invalidate(cache)
invalidate(cache, root)
if os.path.isfile(cache):
with open(cache, 'r') as fh:
return fh.read().splitlines()
@ -71,7 +71,7 @@ def generate_tasks(params=None, full=False):
cwd = os.getcwd()
os.chdir(build.topsrcdir)
root = os.path.join(build.topsrcdir, 'taskcluster', 'ci')
root = os.path.join(root, 'taskcluster', 'ci')
tg = getattr(TaskGraphGenerator(root_dir=root, parameters=params), attr)
labels = [label for label in tg.graph.visit_postorder()]