Bug 1433975: Error out if a parent docker image isn't present in the configuration; r=dustin

MozReview-Commit-ID: ASeCAXLzOEZ

--HG--
extra : rebase_source : f8aabee33e98bc7e76310a24d4cc5ca908b38814
This commit is contained in:
Tom Prince 2018-01-29 11:03:06 -07:00
parent 1559fd3d00
commit d0a8cfbb8a

View File

@ -63,9 +63,10 @@ def validate(config, tasks):
yield task
def order_image_tasks(tasks):
def order_image_tasks(config, tasks):
"""Iterate image tasks in an order where parent images come first."""
pending = deque(tasks)
task_names = {task['name'] for task in pending}
emitted = set()
while True:
try:
@ -74,6 +75,9 @@ def order_image_tasks(tasks):
break
parent = task.get('parent')
if parent and parent not in emitted:
if parent not in task_names:
raise Exception('Missing parant image for {}-{}: {}'.format(
config.kind, task['name'], parent))
pending.append(task)
continue
emitted.add(task['name'])
@ -97,7 +101,7 @@ def fill_template(config, tasks):
context_hashes = {}
for task in order_image_tasks(tasks):
for task in order_image_tasks(config, tasks):
image_name = task.pop('name')
job_symbol = task.pop('symbol')
args = task.pop('args', {})