def build(self, conf, context, stream):
        """Do a persistence build!"""
        existing_image = None

        # Find an existing image if it exists
        for image in conf.harpoon.docker_context.images():
            if "{0}:latest".format(conf.image_name) in image["RepoTags"]:
                existing_image = image['Id']

        # If we already have an image, then test to see if any of it's commands
        # have changed. If it's all still cached, then no need to remake the image!
        test_image_name = None
        if existing_image:
            log.info("Building test image for persistence image to see if the cache changed")
            cached, test_image_name = self.make_test_image(conf, context, stream)
            if cached:
                log.info("We have determined no change, so will just use existing image {0}".format(existing_image))
                return True

        try:
            self.make_image(conf, context, stream, existing_image)
        except Exception as error:
            exc_info = sys.exc_info()

            # Make sure if we fail that the test image doesn't
            # make a false positive the next time around
            # because failure means we almost certainly want to
            # go through this dance again
            try:
                if test_image_name:
                    conf.harpoon.docker_context.remove_image(test_image_name)
            except Exception as inner_error:
                log.exception(inner_error)

            six.reraise(*exc_info)

        # Image wasn't cached
        return False
dataset/ETHPy150Open realestate-com-au/harpoon/harpoon/ship/builders/persistence.py/PersistenceBuilder.build/original