Update the build worker to remove all tags from expired images.

This commit is contained in:
jakedt 2014-04-18 18:36:11 -04:00
parent 242d7e3c41
commit 2bc3d24543

View file

@ -352,17 +352,23 @@ class DockerfileBuildContext(object):
# We can forget about this particular tag if it was indeed one of our renamed tags # We can forget about this particular tag if it was indeed one of our renamed tags
self.private_repo_tags.discard(tag) self.private_repo_tags.discard(tag)
verify_removed.add(image_id) try:
self._build_cl.remove_image(tag)
except APIError:
# Sometimes an upstream image removed this one
pass
try: try:
self._build_cl.remove_image(image_id) self._build_cl.remove_image(image_id)
except APIError: except APIError:
# Sometimes an upstream image removed this one # Sometimes an upstream image removed this one
pass pass
verify_removed.add(image_id)
# Verify that our images were actually removed # Verify that our images were actually removed
for image in self._build_cl.images(): for image in self._build_cl.images():
if image['Id'] in verify_removed: if image['Id'] in verify_removed:
raise RuntimeError('Image was not removed: %s' % image['Id']) logger.warning('Image was not removed: %s' % image['Id'])
def __cleanup(self): def __cleanup(self):
# Iterate all of the images and rename the ones that aren't public. This should preserve # Iterate all of the images and rename the ones that aren't public. This should preserve