Bug 1386519 - Make the index path for toolchain jobs vary depending on dependencies. r=dustin

The premise for simply using the dependencies task names is that if the
name of dependencies changes, or their number, that will impact the
index path, forcing a new build. If there is no such change, but one or
several of the dependencies themselves have changes, they will get a new
build, which will force a new build for the job that depends on them.

In that latter case, the index path will be the same as before the
changes, but that is already what's happening today.
This commit is contained in:
Mike Hommey 2017-08-02 20:17:52 +09:00
Родитель 9a97f0c94e
Коммит f13bf5c0f6
1 изменённых файлов: 14 добавлений и 1 удалений

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

@ -7,6 +7,8 @@ Support for running toolchain-building jobs via dedicated scripts
from __future__ import absolute_import, print_function, unicode_literals
import hashlib
from taskgraph.util.schema import Schema
from voluptuous import Optional, Required, Any
@ -57,10 +59,21 @@ def add_optimizations(config, run, taskdesc):
# The script
files.append('taskcluster/scripts/misc/{}'.format(run['script']))
digest = hash_paths(GECKO, files)
# If the task has dependencies, we need those dependencies to influence
# the index path. So take the digest from the files above, add the list
# of its dependencies, and hash the aggregate.
# If the task has no dependencies, just use the digest from above.
deps = taskdesc['dependencies']
if deps:
data = [digest] + sorted(deps.values())
digest = hashlib.sha256('\n'.join(data)).hexdigest()
label = taskdesc['label']
subs = {
'name': label.replace('%s-' % config.kind, ''),
'digest': hash_paths(GECKO, files),
'digest': digest,
}
optimizations = taskdesc.setdefault('optimizations', [])