def can_check_mission(slug): folder = Folder(slug) docker = DockerClient() try: docker.images.get(folder.image_name()) docker.images.get(folder.image_name_cli()) except ImageNotFound: return False else: return True
def rebuild_mission(slug): cleanup_containers() folder = Folder(slug) docker = DockerClient() verification_folder_path = folder.container_verification_folder_path() logging.info("[mission] Build docker image %s from %s", folder.image_name(), verification_folder_path) if os.path.exists(verification_folder_path): shutil.rmtree(verification_folder_path) copy_tree(folder.verification_folder_path(), verification_folder_path) try: docker.build( name_image=folder.image_name(), path=verification_folder_path) except BuildError as e: logging.warning('Build Error:') for item in e.build_log: logging.warning(item.get('stream')) logging.warning(list(e.build_log)) logging.warning(e.msg) return rebuild_cli_interface(slug)