From 2bc3d2454358728b6393442adce6d736ebec7708 Mon Sep 17 00:00:00 2001 From: jakedt Date: Fri, 18 Apr 2014 18:36:11 -0400 Subject: [PATCH] Update the build worker to remove all tags from expired images. --- workers/dockerfilebuild.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/workers/dockerfilebuild.py b/workers/dockerfilebuild.py index 2d7d31d84..66910fc92 100644 --- a/workers/dockerfilebuild.py +++ b/workers/dockerfilebuild.py @@ -352,17 +352,23 @@ class DockerfileBuildContext(object): # We can forget about this particular tag if it was indeed one of our renamed tags 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: self._build_cl.remove_image(image_id) except APIError: # Sometimes an upstream image removed this one pass + verify_removed.add(image_id) # Verify that our images were actually removed for image in self._build_cl.images(): 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): # Iterate all of the images and rename the ones that aren't public. This should preserve