@@ -55,6 +55,7 @@ Docker repository to use for name-only targets.
55
55
import os
56
56
import sys
57
57
import argparse
58
+ import concurrent .futures
58
59
import datetime
59
60
import json
60
61
import re
@@ -418,6 +419,32 @@ def fill_login_table():
418
419
return login_table
419
420
420
421
422
+ def get_images_info (all_flag , forced_images ):
423
+ """ get information of all images and base images """
424
+ image_list = set ()
425
+ for image in images :
426
+ if "/" in image ["image" ]: # full image name
427
+ base_repos = [None ]
428
+ else : # name-only image name
429
+ base_repos = docker_repositories
430
+ if xor (all_flag , image ["image" ] in forced_images or \
431
+ image ["base" ] in forced_images ):
432
+ continue # no need to get info of forced images
433
+ for repo in base_repos :
434
+ full_name = full_image_name (image ["image" ], repo )
435
+ base_name , _ = expand_base_image (image ["base" ], full_name )
436
+ image_list .add (base_name )
437
+ image_list .add (full_name )
438
+ for image in image_info :
439
+ image_list .discard (image ) # image info already available
440
+
441
+ with concurrent .futures .ThreadPoolExecutor (max_workers = 8 ) as executor :
442
+ futures = {executor .submit (get_time_layers , image ): image
443
+ for image in image_list }
444
+ for future in concurrent .futures .as_completed (futures ):
445
+ image_info [futures [future ]] = future .result ()
446
+
447
+
421
448
def rebuild_images (dry_run , all_flag , forced_images ):
422
449
""" rebuild images """
423
450
for image in images :
@@ -489,4 +516,5 @@ for img in images:
489
516
"Environment variable DOCKER_REPOSITORY is not defined" )
490
517
491
518
# rebuild images
519
+ get_images_info (args .all , args .image )
492
520
rebuild_images (args .dry_run , args .all , args .image )
0 commit comments