From f6f42d4f182eb13e5c7dccc44b5cc462f395cb25 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 27 Jan 2017 16:18:02 +0900 Subject: [PATCH] Bug 1334401 - Prefer docker images from higher levels. r=jonasfj Considering docker images contents depend very much on the moment they were built, it is possible that two images with the same hash in the taskcluster index (at different levels) have different contents. When this happens, the build or test results could be significantly different between e.g. try and mozilla-central, possibly leading to misleading results at landing time. So if for some reason multiple levels have images for the same hash, the one used at the highest level should be prefered, such that try uses the same as mozilla-central once mozilla-central generates the image for that hash, even if there is an image previously generated for try. --HG-- extra : rebase_source : 57f593a530da02f9f576872404915c26af544688 --- taskcluster/taskgraph/task/docker_image.py | 4 ++-- taskcluster/taskgraph/test/test_taskgraph.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/taskcluster/taskgraph/task/docker_image.py b/taskcluster/taskgraph/task/docker_image.py index 0de5e5ece944..60aac27a7bfd 100644 --- a/taskcluster/taskgraph/task/docker_image.py +++ b/taskcluster/taskgraph/task/docker_image.py @@ -87,7 +87,7 @@ class DockerImageTask(base.Task): # the same image per branch. index_paths = ['{}.level-{}.{}.hash.{}'.format( INDEX_PREFIX, level, image_name, context_hash) - for level in range(int(params['level']), 4)] + for level in reversed(range(int(params['level']), 4))] tasks.append(cls(kind, 'build-docker-image-' + image_name, task=image_task['task'], attributes=attributes, @@ -128,7 +128,7 @@ class DockerImageTask(base.Task): context_hash = imgMeta['contextHash'] index_paths = ['{}.level-{}.{}.hash.{}'.format( INDEX_PREFIX, level, image_name, context_hash) - for level in range(int(imgMeta['level']), 4)] + for level in reversed(range(int(imgMeta['level']), 4))] docker_image_task = cls(kind='docker-image', label=task_dict['label'], attributes=task_dict['attributes'], diff --git a/taskcluster/taskgraph/test/test_taskgraph.py b/taskcluster/taskgraph/test/test_taskgraph.py index f8f09bce9816..5eba60dca936 100644 --- a/taskcluster/taskgraph/test/test_taskgraph.py +++ b/taskcluster/taskgraph/test/test_taskgraph.py @@ -28,7 +28,7 @@ class TestTargetTasks(unittest.TestCase): } } index_paths = ["{}.level-{}..hash.".format(INDEX_PREFIX, level) - for level in range(1, 4)] + for level in reversed(range(1, 4))] graph = TaskGraph(tasks={ 'a': TransformTask( kind='fancy',