Bug 1506920: [taskgraph] Track parent images in docker image digests; r=dustin

The digest for a docker image task did not include the digest for the parent
image in it, and so in particular did not depend on the versions of packages
included in a parent image.

If two branches have a docker image with identical docker files, but different
parents, this would lead to them both getting the same digest, leading to
unexpected interference between the branches.

This fixes things by including the digest of the parent image as input into the
digest of child images.

Differential Revision: https://phabricator.services.mozilla.com/D11807
This commit is contained in:
Tom Prince
2018-11-14 14:29:26 +00:00
parent 60f659543a
commit 04309cb221
3 changed files with 21 additions and 7 deletions

View File

@@ -91,15 +91,10 @@ def fill_template(config, tasks):
if task.kind != 'packages':
continue
name = task.label.replace('packages-', '')
for route in task.task.get('routes', []):
if route.startswith('index.') and '.hash.' in route:
# Only keep the hash part of the route.
h = route.rsplit('.', 1)[1]
assert DIGEST_RE.match(h)
available_packages[name] = h
break
available_packages[name] = task.attributes['cache_digest']
context_hashes = {}
image_digests = {}
for task in order_image_tasks(config, tasks):
image_name = task.pop('name')
@@ -130,6 +125,9 @@ def fill_template(config, tasks):
digest_data = [context_hash]
context_hashes[image_name] = context_hash
if parent:
digest_data += [image_digests[parent]]
description = 'Build the docker image {} for use by dependent tasks'.format(
image_name)
@@ -247,4 +245,6 @@ def fill_template(config, tasks):
**kwargs
)
image_digests[image_name] = taskdesc['attributes']['cache_digest']
yield taskdesc