in src/image_builder.py [0:0]
def process_images(pre_push_image_list, pre_push_image_type="Pre-push", buildspec_path=""):
"""
Handles all the tasks related to a particular type of Pre Push images. It takes in the list of
pre push images and then builds it. After the pre-push images have been built, it extracts the
corresponding common stage images for the pre-push images and builds those common stage images.
After the common stage images have been built, it finds outs the docker images that need to be
pushed and pushes them accordingly.
Note that the common stage images should always be built after the pre-push images of a
particular kind. This is because the Common stage images use are built on respective
Standard and Example images.
:param pre_push_image_list: list[DockerImage], list of pre-push images
:param pre_push_image_type: str, used to display the message on the logs
:return: list[DockerImage], images that were supposed to be pushed.
"""
FORMATTER.banner(f"{pre_push_image_type} Build")
build_images(pre_push_image_list)
FORMATTER.banner(f"{pre_push_image_type} Common Build")
common_stage_image_list = [
image.corresponding_common_stage_image
for image in pre_push_image_list
if image.corresponding_common_stage_image is not None
]
build_images(common_stage_image_list, make_dummy_boto_client=True)
FORMATTER.banner(f"{pre_push_image_type} Push Images")
all_images = pre_push_image_list + common_stage_image_list
images_to_push = [image for image in all_images if image.to_push and image.to_build]
if is_autopatch_build_enabled(buildspec_path=buildspec_path):
for image in images_to_push:
patch_helper.retrive_autopatched_image_history_and_upload_to_s3(image_uri=image.ecr_url)
push_images(images_to_push)
FORMATTER.banner(f"{pre_push_image_type} Retagging")
retag_and_push_images(images_to_push)
return images_to_push