Fix issues in cache comment comparison
This commit is contained in:
parent
9b0e43514b
commit
b0e315c332
1 changed files with 4 additions and 2 deletions
|
@ -98,17 +98,19 @@ class BuildJob(object):
|
|||
# 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(repository, current_image, full_command)
|
||||
current_image = model.find_child_image(repo_build.repository, current_image, full_command)
|
||||
if current_image is None:
|
||||
return None
|
||||
|
||||
logger.debug('Found cached image %s for comment %s', current_image.id, full_command)
|
||||
|
||||
# Find a tag associated with the image, if any.
|
||||
# TODO(jschorr): We should just return the image ID instead of a parent tag, OR we should
|
||||
# make this more efficient.
|
||||
for tag in model.list_repository_tags(repo_namespace, repo_name):
|
||||
tag_image = tag.image
|
||||
ancestor_index = '/%s/' % current_image.id
|
||||
if ancestor_index in tag_image.ancestors:
|
||||
if ancestor_index in tag_image.ancestors or tag_image.id == current_image.id:
|
||||
return tag.name
|
||||
|
||||
return None
|
||||
|
|
Reference in a new issue