Operator Pusher

This class handles all the operator-related parts of the full Push Docker workflow.

class pubtools._quay.operator_pusher.OperatorPusher(push_items: List[Any], task_id: str, target_settings: Dict[str, Any])[source]

Add operator bundles to index images and push them to Quay.

No validation is performed, push items are expected to be correct.

build_index_images() Dict[str, Dict[Any, Any]][source]

Perform the ‘build’ part of the operator workflow.

This workflow is a part of push-docker operation. The workflow can be summarized as: - Use Pyxis to parse ‘com.redhat.openshift.versions’ - Filter out push items which opted in to FBC and shouldn’t be pushed - Set extra attributes or push items are for prerelease or for hotfix - Get deprecation list for a given version (list of bundles to be deprecated) - Create mapping of which bundles should be pushed to which index image versions - Contact IIB to add the bundles to the index images with multiple threads

Returns ({str:dict}):

Dictionary containing IIB results and signing keys for all OPM versions. Data will be used in operator signing. Dictionary structure: { <target_tag>: { “iib_result”: (…) (object returned by iiblib) “signing_keys”: […] (list of signing keys to be used for signing) “destination_tags”: […] (list of destination tags) } }

push_index_images(iib_results: Dict[Any, Any], tag_suffix: Optional[str] = None) None[source]

Push index images which were built in the previous stage to Quay.

Args:
iib_results (dict):

IIB results returned by the build stage

tag_suffix (str):

extra tag suffix applied to iib version tags if specified

__init__(push_items: List[Any], task_id: str, target_settings: Dict[str, Any]) None[source]

Initialize.

Args:
push_items ([ContainerPushItem]):

List of push items.

task_id (str):

task id

target_settings (dict):

Target settings.

static _get_immutable_tag(push_item: Any) Union[str, Any][source]

Return immutable tag from operator push item production tags.

Args:
push_item (ContainerPushItem):

Operator push item.

Returns (str):

Immutable tag

public_bundle_ref(push_item: Any) str[source]

Get public reference of a bundle image.

It will be used by IIB to access the bundle image.

Args:
push_item (ContainerPushItem):

Operator push item.

Returns (str):

Customer-visible bundle reference.

pyxis_get_ocp_versions(push_item: Any) List[str][source]

Get a list of supported ocp versions from Pyxis.

Args:
push_item: (ContainerPushItem)

Push item for which the OCP version range will be found out.

Returns ([str]):

Supported OCP versions as returned by Pyxis.

version_items_mapping()

Generate mapping of OCP version -> push_items.

The mapping describes which operator bundles should be added to which index images.

Returns ({str: [ContainerPushItem]})

Mapping of OCP version -> Push items

get_deprecation_list(version: str) Optional[List[str]][source]

Get bundles to be deprecated in the index image.

If deprecation list URL isn’t in the target settings, None is returned.

Args:
version: (str)

version for which deprecation list will be fetched.

Returns:
list(str)|None: list of bundles to be deprecated in the index image. or None if

deprecation list URL was not specified.

classmethod pubtools_iib_get_common_args(target_settings: Dict[str, Any]) Tuple[List[str], Dict[str, str]][source]

Create an argument list common for all pubtools-iib operations.

Target settings are used to set the values of the arguments

Args:
target_settings (dict):

Settings used for setting the value of pubtools-iib parameters.

Returns (([str]), {str:str}):

Tuple of arguments and environment variables to be used when calling pubtools-iib.

classmethod iib_add_bundles(bundles: Optional[List[str]] = None, archs: Optional[List[str]] = None, index_image: Optional[str] = None, deprecation_list: Optional[Union[List[str], str]] = None, build_tags: Optional[List[str]] = None, target_settings: Dict[str, Any] = {}) Any[source]

Construct and execute pubtools-iib command to add bundles to index image.

Args:
bundles ([str]):

External URLs to bundle images to be added to the index image.

archs ([str]):

Architectures to build for.

index_image (str):

Index image to add the bundles to.

deprecation_list ([str]|str):

List of bundles to be deprecated. Accepts both str (csv) and a list.

build_tags ([str]):

Extra tags that the new index image should be tagged with.

target_settings (dict):

Settings used for setting the value of pubtools-iib parameters.

Returns (dict):

Build details provided by IIB.

classmethod iib_remove_operators(operators: Optional[List[str]] = None, archs: Optional[List[str]] = None, index_image: Optional[str] = None, build_tags: Optional[List[str]] = None, target_settings: Dict[str, Any] = {}) Any[source]

Construct and execute pubtools-iib command to remove operators from index image.

Args:
operators ([str]):

Operator names to be removed from the index image.

archs ([str]):

Architectures to build for.

index_image (str):

Index image to remove the operators from.

build_tags ([str]):

Extra tags that the new index image should be tagged with.

target_settings (dict):

Settings used for setting the value of pubtools-iib parameters.

Returns (dict):

Build details provided by IIB.

get_existing_index_images(quay_client: QuayClient) List[Tuple[str, str, str]][source]

Return existing index images for non-fbc push items.

Args:

quay_client (QuayClient): quay_client_instance

Returns [(digest, tag, repo)]:

List of tuples containing digest and tag of existing index image