archive

package
v1.7.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 23 Imported by: 246

Documentation

Overview

Package archive provides a Docker and OCI compatible importer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRefPrefix

func AddRefPrefix(image string) func(string) string

AddRefPrefix prepends the given image prefix to tag-only references, while leaving returning full references unmodified.

func DigestTranslator

func DigestTranslator(prefix string) func(digest.Digest) string

DigestTranslator creates a digest reference by adding the digest to an image name

func Export added in v1.3.0

func Export(ctx context.Context, store content.Provider, writer io.Writer, opts ...ExportOpt) error

Export implements Exporter.

func FilterRefPrefix

func FilterRefPrefix(image string) func(string) string

FilterRefPrefix restricts references to having the given image prefix. Tag-only references will have the prefix prepended.

func ImportIndex

func ImportIndex(ctx context.Context, store content.Store, reader io.Reader, opts ...ImportOpt) (ocispec.Descriptor, error)

ImportIndex imports an index from a tar archive image bundle

  • implements Docker v1.1, v1.2 and OCI v1.
  • prefers OCI v1 when provided
  • creates OCI index for Docker formats
  • normalizes Docker references and adds as OCI ref name e.g. alpine:latest -> docker.io/library/alpine:latest
  • existing OCI reference names are untouched

Types

type BlobFilter added in v1.5.0

type BlobFilter func(ocispec.Descriptor) bool

BlobFilter returns false if the blob should not be included in the archive.

type ExportOpt added in v1.3.0

type ExportOpt func(context.Context, *exportOptions) error

ExportOpt defines options for configuring exported descriptors

func WithAllPlatforms added in v1.3.0

func WithAllPlatforms() ExportOpt

WithAllPlatforms exports all manifests from a manifest list. Missing content will fail the export.

func WithBlobFilter added in v1.5.0

func WithBlobFilter(f BlobFilter) ExportOpt

WithBlobFilter specifies BlobFilter.

func WithImage added in v1.3.0

func WithImage(is images.Store, name string) ExportOpt

WithImage adds the provided images to the exported archive.

func WithImages added in v1.7.0

func WithImages(imgs []images.Image) ExportOpt

WithImages adds multiples images to the exported archive.

func WithManifest added in v1.3.0

func WithManifest(manifest ocispec.Descriptor, names ...string) ExportOpt

WithManifest adds a manifest to the exported archive. When names are given they will be set on the manifest in the exported archive, creating an index record for each name. When no names are provided, it is up to caller to put name annotation to on the manifest descriptor if needed.

func WithPlatform added in v1.3.0

func WithPlatform(p platforms.MatchComparer) ExportOpt

WithPlatform defines the platform to require manifest lists have not exporting all platforms. Additionally, platform is used to resolve image configs for Docker v1.1, v1.2 format compatibility.

func WithSkipDockerManifest added in v1.3.0

func WithSkipDockerManifest() ExportOpt

WithSkipDockerManifest skips creation of the Docker compatible manifest.json file.

func WithSkipMissing added in v1.7.12

func WithSkipMissing(store content.InfoReaderProvider) ExportOpt

WithSkipMissing excludes blobs referenced by manifests if not all blobs would be included in the archive. The manifest itself is excluded only if it's not present locally. This allows to export multi-platform images if not all platforms are present while still persisting the multi-platform index.

func WithSkipNonDistributableBlobs added in v1.5.0

func WithSkipNonDistributableBlobs() ExportOpt

WithSkipNonDistributableBlobs excludes non-distributable blobs such as Windows base layers.

type ImportOpt added in v1.3.0

type ImportOpt func(*importOpts) error

ImportOpt is an option for importing an OCI index

func WithImportCompression added in v1.3.0

func WithImportCompression() ImportOpt

WithImportCompression compresses uncompressed layers on import. This is used for import formats which do not include the manifest.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL