gloci

gloci.cli

gloci.oras

gloci.oras.registry

class gloci.oras.registry.GlociRegistry(container_name: str, token: str | None = None, insecure: bool = False, private_key: str | None = None, public_key: str | None = None, config_path: str | None = None)

Bases: Registry

attach_layer(cname: str, version: str, architecture: str, file_path: str, media_type: str)
change_state(cname: str, version: str, architecture: str, new_state: str)
create_layer(file_path: str, cname: str, version: str, architecture: str, media_type: str)
get_digest(**kwargs)
get_index(allowed_media_type: list[str] | None = None)

Returns the manifest for a cname+arch combination of a container Will return None if no result was found

TODO: refactor: use get_manifest_json and call it with index mediatype.

get_manifest_by_cname(**kwargs)
get_manifest_by_digest(**kwargs)
get_manifest_json(**kwargs)
get_manifest_meta_data_by_cname(**kwargs)
get_manifest_size(**kwargs)
push_image_manifest(architecture: str, cname: str, version: str, info_yaml: str)

creates and pushes an image manifest

remove_container(**kwargs)
sign_layer(layer: dict, cname: str, version: str, architecture: str, checksum_sha256: str, media_type: str)
sign_manifest_entry(new_manifest_metadata: dict, version: str, architecture: str, cname: str)
status_all()

Validate if container is valid - all manifests require a info.yaml in the layers - info.yaml needs to be signed (TODO) - all layers listed in info.yaml must exist - all mediatypes of layers listed in info.yaml must be set correctly

update_index(old_digest: str | None, manifest_meta_data: dict)

replaces an old manifest entry with a new manifest entry

upload_index(index: dict) Response
verify_manifest_meta_signature(manifest_meta: dict)
verify_manifest_signature(manifest: dict)
class gloci.oras.registry.ManifestState(value)

Bases: Enum

An enumeration.

Complete = 2
Final = 3
Incomplete = 1
gloci.oras.registry.NewIndex() dict
gloci.oras.registry.NewManifestMetadata(digest: str, size: int, annotaions: dict, platform_data: dict) dict
gloci.oras.registry.NewPlatform(architecture: str, version: str) dict
gloci.oras.registry.attach_state(d: dict, state: str)
gloci.oras.registry.construct_layer_signed_data_string(cname: str, version: str, architecture: str, media_type: str, checksum_sha256: str) str
gloci.oras.registry.construct_manifest_entry_signed_data_string(cname: str, version: str, new_manifest_metadata: dict, architecture: str) str
gloci.oras.registry.create_config_from_dict(conf: dict, annotations: dict) Tuple[dict, str]

Write a new OCI configuration to file, and generate oci meta data for it For reference see https://github.com/opencontainers/image-spec/blob/main/config.md annotations, mediatrype, size, digest are not part of digest and size calculation, and therefore must be attached to the output dict and not written to the file.

Parameters:
  • conf – dict with custom configuration (the payload of the configuration)

  • annotations – dict with custom annotations to be attached to metadata part of config

gloci.oras.registry.get_image_state(manifest: dict) str

gloci.oras.crypto

gloci.oras.crypto.calculate_sha256(file_path: str) str

Calculate the SHA256 checksum of a file.

gloci.oras.crypto.sign_data(data_str: str, private_key_file_path: str) str
gloci.oras.crypto.verify_sha256(checksum: str, data: bytes)
gloci.oras.crypto.verify_signature(data_str: str, signature: str, public_key_file_path: str)

gloci.commands

gloci.commands.image

gloci.commands.image.setup_registry(container_name: str, private_key: str | None = None, insecure: bool = False, public_key: str | None = None)

gloci.commands.ocm