diff --git a/taskcluster/docs/attributes.rst b/taskcluster/docs/attributes.rst index 8fc75ec5fe4a..ee69bcf33b0c 100644 --- a/taskcluster/docs/attributes.rst +++ b/taskcluster/docs/attributes.rst @@ -255,3 +255,14 @@ cron ==== Indicates that a task is meant to be run via cron tasks, and should not be run on push. + +cache_digest +============ +Some tasks generate artifacts that are cached between pushes. This is the unique string used +to identify the current version of the artifacts. See :py:mod:`taskgraph.util.cached_task`. + +cache_type +========== +Some tasks generate artifacts that are cached between pushes. This is the type of cache that is +used for the this task. See :py:mod:`taskgraph.util.cached_task`. + diff --git a/taskcluster/taskgraph/transforms/docker_image.py b/taskcluster/taskgraph/transforms/docker_image.py index bff7002f0c00..681849dea3e1 100644 --- a/taskcluster/taskgraph/transforms/docker_image.py +++ b/taskcluster/taskgraph/transforms/docker_image.py @@ -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 diff --git a/taskcluster/taskgraph/util/cached_tasks.py b/taskcluster/taskgraph/util/cached_tasks.py index 3c9c54055b3f..d29d2c6c77ac 100644 --- a/taskcluster/taskgraph/util/cached_tasks.py +++ b/taskcluster/taskgraph/util/cached_tasks.py @@ -68,6 +68,9 @@ def add_optimization(config, taskdesc, cache_type, cache_name, digest=None, dige for route in EXTRA_CACHE_INDEXES ]) + taskdesc['attributes']['cache_digest'] = digest + taskdesc['attributes']['cache_type'] = cache_type + def cached_index_path(level, trust_domain, cache_type, cache_name, digest=None, digest_data=None): """