Skip to content

Commit

Permalink
Skip building multi-arch binary-less image
Browse files Browse the repository at this point in the history
This commit allows IIB to process a single build for binaryless images
with a generic architecture labeled as "linux-amd64"

Refers to CLOUDDST-23383
  • Loading branch information
JAVGan committed Mar 10, 2025
1 parent 5fd4a49 commit 2b4e48f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions iib/workers/tasks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1165,12 +1165,6 @@ def prepare_request_for_build(
build_request_config,
[("from_index", "v4.5"), ("source_from_index", "v4.5"), ("target_index", "v4.6")],
)
arches = gather_index_image_arches(build_request_config, index_info)
if not arches:
raise IIBError('No arches were provided to build the index image')

arches_str = ', '.join(sorted(arches))
log.debug('Set to build the index image for the following arches: %s', arches_str)

# Use the distribution_scope of the from_index as the resolved distribution scope for `Add`,
# and 'Rm' requests, but use the distribution_scope of the target_index as the resolved
Expand All @@ -1191,9 +1185,11 @@ def prepare_request_for_build(

binary_image = build_request_config.binary_image(request_index, distribution_scope)
if binary_image == "scratch": # binaryless image mode
arches = set(["amd64"])
binary_image_resolved = binary_image
binary_image_arches = arches
else:
arches = gather_index_image_arches(build_request_config, index_info)
binary_image_resolved = get_resolved_image(binary_image)
binary_image_arches = get_image_arches(binary_image_resolved)

Expand All @@ -1204,6 +1200,9 @@ def prepare_request_for_build(
)
)

arches_str = ', '.join(sorted(arches))
log.debug('Set to build the index image for the following arches: %s', arches_str)

bundle_mapping: Dict[str, Any] = {}
for bundle in bundles:
operator = get_image_label(bundle, 'operators.operatorframework.io.bundle.package.v1')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_workers/test_tasks/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ def test_prepare_request_for_build_binaryless(
_binary_image=binary_image,
from_index=from_index,
overwrite_from_index_token=None,
add_arches=["amd64"],
add_arches=["s390x"],
bundles=bundles,
distribution_scope="prod",
binary_image_config=binary_image_config,
Expand Down

0 comments on commit 2b4e48f

Please sign in to comment.