@@ -264,6 +264,7 @@ def get_release() -> Dict:
264264
265265
266266def get_git_release_tag () -> tuple [str , bool ]:
267+ """Returns the git tag of the current run on releases, on non-release returns the patch id."""
267268 release_env_var = os .getenv ("triggered_by_git_tag" )
268269
269270 # that means we are in a release and only return the git_tag; otherwise we want to return the patch_id
@@ -290,22 +291,19 @@ def copy_into_container(client, src, dst):
290291 container .put_archive (os .path .dirname (dst ), fd .read ())
291292
292293
293- """
294- Generates docker manifests by running the following commands:
295- 1. Clear existing manifests
296- docker manifest rm config.repo_url/image:tag
297- 2. Create the manifest
298- docker manifest create config.repo_url/image:tag --amend config.repo_url/image:tag-amd64 --amend config.repo_url/image:tag-arm64
299- 3. Push the manifest
300- docker manifest push config.repo_url/image:tag
301- """
302-
303-
304- # This method calls docker directly on the command line, this is different from the rest of the code which uses
305- # Sonar as an interface to docker. We decided to keep this asymmetry for now, as Sonar will be removed soon.
306-
307-
308294def create_and_push_manifest (image : str , tag : str , architectures : list [str ]) -> None :
295+ """
296+ Generates docker manifests by running the following commands:
297+ 1. Clear existing manifests
298+ docker manifest rm config.repo_url/image:tag
299+ 2. Create the manifest
300+ docker manifest create config.repo_url/image:tag --amend config.repo_url/image:tag-amd64 --amend config.repo_url/image:tag-arm64
301+ 3. Push the manifest
302+ docker manifest push config.repo_url/image:tag
303+
304+ This method calls docker directly on the command line, this is different from the rest of the code which uses
305+ Sonar as an interface to docker. We decided to keep this asymmetry for now, as Sonar will be removed soon.
306+ """
309307 final_manifest = image + ":" + tag
310308
311309 args = [
@@ -343,14 +341,12 @@ def try_get_platform_data(client, image):
343341 return None
344342
345343
346- """
347- Checks if a docker image supports AMD and ARM platforms by inspecting the registry data.
348-
349- :param str image: The image name and tag
350- """
351-
352-
353344def check_multi_arch (image : str , suffix : str ) -> bool :
345+ """
346+ Checks if a docker image supports AMD and ARM platforms by inspecting the registry data.
347+
348+ :param str image: The image name and tag
349+ """
354350 client = docker .from_env ()
355351 platforms = ["linux/amd64" , "linux/arm64" ]
356352
@@ -741,17 +737,6 @@ def submit(self, fn, *args, **kwargs):
741737 return super ().submit (lambda : fn (* args , ** kwargs ))
742738
743739
744- """
745- Starts the daily build process for an image. This function works for all images we support, for community and
746- enterprise operator. The list of supported image_name is defined in get_builder_function_for_image_name.
747- Builds an image for each version listed in ./release.json
748- The registry used to pull base image and output the daily build is configured in the image_config function, it is passed
749- as an argument to the inventories/daily.yaml file.
750-
751- If the context image supports both ARM and AMD architectures, both will be built.
752- """
753-
754-
755740def should_skip_arm64 ():
756741 """
757742 Determines if arm64 builds should be skipped based on environment.
@@ -766,7 +751,15 @@ def build_image_daily(
766751 max_version : str = None ,
767752 operator_version : str = None ,
768753):
769- """Builds a daily image."""
754+ """
755+ Starts the daily build process for an image. This function works for all images we support, for community and
756+ enterprise operator. The list of supported image_name is defined in get_builder_function_for_image_name.
757+ Builds an image for each version listed in ./release.json
758+ The registry used to pull base image and output the daily build is configured in the image_config function, it is passed
759+ as an argument to the inventories/daily.yaml file.
760+
761+ If the context image supports both ARM and AMD architectures, both will be built.
762+ """
770763
771764 def get_architectures_set (build_configuration , args ):
772765 """Determine the set of architectures to build for"""
@@ -992,6 +985,11 @@ def build_image_generic(
992985 multi_arch_args_list : list = None ,
993986 is_run_in_parallel : bool = False ,
994987):
988+ """Build image generic builds context images and is used for triggering release. During releases
989+ it signs and verifies the context image.
990+ The release process uses the daily images build process.
991+ """
992+
995993 if not multi_arch_args_list :
996994 multi_arch_args_list = [extra_args or {}]
997995
@@ -1011,8 +1009,12 @@ def build_image_generic(
10111009 # But since we don't run daily rebuilds on ecr image builds, we can do that step instead here.
10121010 # We only need to push manifests for multi-arch images.
10131011 create_and_push_manifest (registry_address , version , architectures = architectures )
1012+
1013+ # Sign and verify the context image if on releases if requied.
10141014 if config .sign and config .is_release_step_executed ():
10151015 sign_and_verify_context_image (registry , version )
1016+
1017+ # Release step. Release images via the daily image process.
10161018 if config .is_release_step_executed () and version and QUAY_REGISTRY_URL in registry :
10171019 logger .info (
10181020 f"finished building context images, releasing them now via daily builds process for"
@@ -1546,11 +1548,12 @@ def calculate_images_to_build(
15461548
15471549def main ():
15481550 _setup_tracing ()
1551+ _setup_tracing ()
15491552
15501553 parser = argparse .ArgumentParser ()
1551- parser .add_argument ("--include" , action = "append" )
1552- parser .add_argument ("--exclude" , action = "append" )
1553- parser .add_argument ("--builder" , default = "docker" , type = str )
1554+ parser .add_argument ("--include" , action = "append" , help = "list of images to include" )
1555+ parser .add_argument ("--exclude" , action = "append" , help = "list of images to exclude" )
1556+ parser .add_argument ("--builder" , default = "docker" , type = str , help = "docker or podman" )
15541557 parser .add_argument ("--list-images" , action = "store_true" )
15551558 parser .add_argument ("--parallel" , action = "store_true" , default = False )
15561559 parser .add_argument ("--debug" , action = "store_true" , default = False )
0 commit comments