Push Docker

This is the main class for the Push Docker workflow, which is the primary workflow for container and operator related content.

class pubtools._quay.push_docker.PushDocker(push_items: List[Any], hub: Any, task_id: str, target_name: str, target_settings: Dict[str, Any])[source]

Handle full Docker push workflow.

run() None[source]

Perform the full push-docker workflow.

The workflow can be summarized as: - Filter out push items to only include container image items - Check if the destination repos may be pushed to (using Pyxis) - Generate backup mapping that will be used for rollback if something goes wrong. - Sign container images using RADAS and upload signatures to Pyxis - Push container images to their destinations - Generate and push container security manifests for pushed images - Fetch digests for missing media types of pushed items - Sign manifests for missing media types (has to be done after pushing) - Filter out push items to only include operator image items - Add operator bundles to index images by using IIB - Sign index images using RADAS and upload signatures to Pyxis - Push the index images to Quay - Remove outdated container signatures - (in case of failure) Rollback destination repos to the pre-push state

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

Initialize.

Args:
push_items ([_PushItem]):

List of push items.

hub (HubProxy):

Instance of XMLRPC pub-hub proxy.

task_id (str):

task id

target_name (str):

Name of the target.

target_settings (dict):

Target settings.

verify_target_settings() None[source]

Verify that target settings contains all the necessary data.

get_docker_push_items() List[Any][source]

Filter push items to only include docker ones.

Also, Check the validity of these items and raise an exception in case of incorrect data.

For items having the same pull_url, only one of them is returned to avoid duplication.

Returns ([ContainerPushItem]):

Docker push items.

get_operator_push_items() List[Any][source]

Filter out push items to only include operator ones.

Also, Check the validity of these items and raise an exception in case of incorrect data.

Returns ([ContainerPushItem]):

Operator push items.

classmethod check_repos_validity(push_items: List[Any], hub: Any, target_settings: Dict[str, Any]) None[source]

Check if specified repos are valid and pushing to them is allowed.

Specifically, this method checks if the repo exists in Comet and if it’s not deprecated If pushing to prod, also check if the repo already exists in stage.

Args:
push_items ([ContainerPushItem]):

Container push items containing the repositories.

hub (HubProxy):

Instance of XMLRPC pub-hub proxy.

target_settings (dict):

Target settings.

generate_backup_mapping(push_items: List[Any], all_arches: bool = False) Tuple[Dict[ImageData, Tuple[str, str]], List[ImageData]][source]

Create resources which will be used for rollback if something goes wrong during the push.

Specifically, create two resources: ‘backup_tags’ and ‘rollback_tags’. - ‘backup_tags’ is a mapping of ImageData->manifest, and consists of images which will be overwritten. During rollback, tag is made to re-reference the old manifest. - ‘rollback_tags’ is a list of ImageData which don’t yet exist. During rollback, they will be removed to preserve pre-push state. If all_arches is set to true, return all arches for v2s2 and v2s1 manifests

ImageData is a namedtuple used to assign and access parts of an image in a formatted way.

Args:
push_items ([ContainerPushItem]):

Container push items.

all_arches: bool

If set to True include all manifests in results. If False only amd64 are included

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

Tuple of backup_tags and rollback_tags

rollback(backup_tags: Dict[ImageData, str], rollback_tags: List[ImageData]) None[source]

Perform a rollback.

Args:
backup_tags ({ImageData: str}):

Dictionary mapping of ImageData and a manifest before it was overwritten.

rollback_tags ([ImageData]):

List of newly added ImageData.