def prefetch_cached_images(tags): if docker_tags.running_on_azure_pipelines(): print(print_separator) print(Fore.YELLOW + "PREFETCHING IMAGE") print(print_separator) tags.image_tag_to_use_for_cache = None api_client = docker.APIClient(base_url="unix://var/run/docker.sock") for image_tag in tags.image_tags: print(Fore.YELLOW + "trying to prefetch {}:{}".format( tags.docker_full_image_name, image_tag)) try: for line in api_client.pull( tags.docker_full_image_name, image_tag, stream=True, auth_config=auth_config, ): print_filtered_docker_line(line) tags.image_tag_to_use_for_cache = image_tag print( Fore.GREEN + "Found {}. Using this for image cache".format(image_tag)) return except docker.errors.APIError: print(Fore.YELLOW + "Image not found in repository")
def prefetch_cached_images(tags): if docker_tags.running_on_azure_pipelines(): print(print_separator) print(Fore.YELLOW + "PREFETCHING IMAGE") print(print_separator) tags.image_tag_to_use_for_cache = None api_client = docker.APIClient(base_url="unix://var/run/docker.sock") for image_tag in tags.image_tags: print( Fore.YELLOW + "trying to prefetch {}:{}".format( tags.docker_full_image_name, image_tag ) ) try: for line in api_client.pull( tags.docker_full_image_name, image_tag, stream=True, auth_config=auth_config, ): print_filtered_docker_line(line) tags.image_tag_to_use_for_cache = image_tag print( Fore.GREEN + "Found {}. Using this for image cache".format(image_tag) ) return except docker.errors.APIError: print(Fore.YELLOW + "Image not found in repository")
tags.docker_full_image_name, image_tag)) try: for line in api_client.pull( tags.docker_full_image_name, image_tag, stream=True, auth_config=auth_config, ): print_filtered_docker_line(line) tags.image_tag_to_use_for_cache = image_tag print( Fore.GREEN + "Found {}. Using this for image cache".format(image_tag)) return except docker.errors.APIError: print(Fore.YELLOW + "Image not found in repository") tags = docker_tags.get_docker_tags_from_commit(args.language, args.repo, args.commit, args.variant) prefetch_cached_images(tags) build_image(tags) tag_images(tags) push_images(tags) if not docker_tags.running_on_azure_pipelines(): print(Fore.GREEN + "Done. Deploy with the following command:") print(Fore.GREEN + "./deploy-test-containers.sh --{} {}:{}".format( tags.language, tags.docker_full_image_name, tags.image_tags[0]))