diff --git a/buildman/jobutil/buildjob.py b/buildman/jobutil/buildjob.py index 4d85a76c1..bcf2c33c2 100644 --- a/buildman/jobutil/buildjob.py +++ b/buildman/jobutil/buildjob.py @@ -92,16 +92,18 @@ class BuildJob(object): repo_name = repo_build.repository.name current_image = model.get_image(repo_build.repository, base_image_id) + next_image = None if current_image is None: return None # For each cache comment, find a child image that matches the command. for cache_command in cache_commands: full_command = '["/bin/sh", "-c", "%s"]' % cache_command - current_image = model.find_child_image(repo_build.repository, current_image, full_command) - if current_image is None: - return None + next_image = model.find_child_image(repo_build.repository, current_image, full_command) + if next_image is None: + break + current_image = next_image logger.debug('Found cached image %s for comment %s', current_image.id, full_command) # Find a tag associated with the image, if any.