Documentation ¶
Overview ¶
Package archive provides a Docker and OCI compatible importer
Index ¶
- func AddRefPrefix(image string) func(string) string
- func DigestTranslator(prefix string) func(digest.Digest) string
- func Export(ctx context.Context, store content.Provider, writer io.Writer, ...) error
- func FilterRefPrefix(image string) func(string) string
- func ImportIndex(ctx context.Context, store content.Store, reader io.Reader, opts ...ImportOpt) (ocispec.Descriptor, error)
- type BlobFilter
- type ExportOpt
- func WithAllPlatforms() ExportOpt
- func WithBlobFilter(f BlobFilter) ExportOpt
- func WithImage(is images.Store, name string) ExportOpt
- func WithManifest(manifest ocispec.Descriptor, names ...string) ExportOpt
- func WithPlatform(p platforms.MatchComparer) ExportOpt
- func WithSkipDockerManifest() ExportOpt
- func WithSkipNonDistributableBlobs() ExportOpt
- type ImportOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRefPrefix ¶
AddRefPrefix prepends the given image prefix to tag-only references, while leaving returning full references unmodified.
func DigestTranslator ¶
DigestTranslator creates a digest reference by adding the digest to an image name
func FilterRefPrefix ¶
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 ¶
type BlobFilter func(ocispec.Descriptor) bool
BlobFilter returns false if the blob should not be included in the archive.
type ExportOpt ¶
ExportOpt defines options for configuring exported descriptors
func WithAllPlatforms ¶
func WithAllPlatforms() ExportOpt
WithAllPlatforms exports all manifests from a manifest list. Missing content will fail the export.
func WithBlobFilter ¶
func WithBlobFilter(f BlobFilter) ExportOpt
WithBlobFilter specifies BlobFilter.
func WithManifest ¶
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 ¶
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 ¶
func WithSkipDockerManifest() ExportOpt
WithSkipDockerManifest skips creation of the Docker compatible manifest.json file.
func WithSkipNonDistributableBlobs ¶
func WithSkipNonDistributableBlobs() ExportOpt
WithSkipNonDistributableBlobs excludes non-distributable blobs such as Windows base layers.
type ImportOpt ¶
type ImportOpt func(*importOpts) error
ImportOpt is an option for importing an OCI index
func WithImportCompression ¶
func WithImportCompression() ImportOpt
WithImportCompression compresses uncompressed layers on import. This is used for import formats which do not include the manifest.