@@ -264,6 +264,7 @@ def get_release() -> Dict:
264
264
265
265
266
266
def 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."""
267
268
release_env_var = os .getenv ("triggered_by_git_tag" )
268
269
269
270
# 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):
290
291
container .put_archive (os .path .dirname (dst ), fd .read ())
291
292
292
293
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
-
308
294
def 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
+ """
309
307
final_manifest = image + ":" + tag
310
308
311
309
args = [
@@ -343,14 +341,12 @@ def try_get_platform_data(client, image):
343
341
return None
344
342
345
343
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
-
353
344
def 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
+ """
354
350
client = docker .from_env ()
355
351
platforms = ["linux/amd64" , "linux/arm64" ]
356
352
@@ -741,17 +737,6 @@ def submit(self, fn, *args, **kwargs):
741
737
return super ().submit (lambda : fn (* args , ** kwargs ))
742
738
743
739
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
-
755
740
def should_skip_arm64 ():
756
741
"""
757
742
Determines if arm64 builds should be skipped based on environment.
@@ -766,7 +751,15 @@ def build_image_daily(
766
751
max_version : str = None ,
767
752
operator_version : str = None ,
768
753
):
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
+ """
770
763
771
764
def get_architectures_set (build_configuration , args ):
772
765
"""Determine the set of architectures to build for"""
@@ -992,6 +985,11 @@ def build_image_generic(
992
985
multi_arch_args_list : list = None ,
993
986
is_run_in_parallel : bool = False ,
994
987
):
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
+
995
993
if not multi_arch_args_list :
996
994
multi_arch_args_list = [extra_args or {}]
997
995
@@ -1011,8 +1009,12 @@ def build_image_generic(
1011
1009
# But since we don't run daily rebuilds on ecr image builds, we can do that step instead here.
1012
1010
# We only need to push manifests for multi-arch images.
1013
1011
create_and_push_manifest (registry_address , version , architectures = architectures )
1012
+
1013
+ # Sign and verify the context image if on releases if requied.
1014
1014
if config .sign and config .is_release_step_executed ():
1015
1015
sign_and_verify_context_image (registry , version )
1016
+
1017
+ # Release step. Release images via the daily image process.
1016
1018
if config .is_release_step_executed () and version and QUAY_REGISTRY_URL in registry :
1017
1019
logger .info (
1018
1020
f"finished building context images, releasing them now via daily builds process for"
@@ -1546,11 +1548,12 @@ def calculate_images_to_build(
1546
1548
1547
1549
def main ():
1548
1550
_setup_tracing ()
1551
+ _setup_tracing ()
1549
1552
1550
1553
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" )
1554
1557
parser .add_argument ("--list-images" , action = "store_true" )
1555
1558
parser .add_argument ("--parallel" , action = "store_true" , default = False )
1556
1559
parser .add_argument ("--debug" , action = "store_true" , default = False )
0 commit comments