registry

package
v1.1.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package registry defines a Registry interface and client for working for imkpkg images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRegistryTrustedRootCertsFileForWindows added in v0.90.0

func AddRegistryTrustedRootCertsFileForWindows(registryCertOpts *CertOptions) error

AddRegistryTrustedRootCertsFileForWindows adds CA certificate to registry options for Windows environments

func GetRegistryName added in v0.90.0

func GetRegistryName(imageName string) (string, error)

GetRegistryName extracts the registry name from the image name with/without image tag (e.g. localhost:9876/tanzu-cli/plugins/central:small => localhost:9876) It also supports a digest format: (e.g. localhost:9876/tanzu-cli/plugins/plugin@sha256:3925a7a0e78ec439529c4bc9e26b4bbe95a01645325a8b2f66334be7e6b37ab6)

func ServeLocalRegistry added in v1.0.0

func ServeLocalRegistry(port string) (string, func(), error)

ServeLocalRegistry start an in-memory localhost registry server at provided port If the port is not provided it uses a random available port to start the registry server It returns the port on which the server is running, the function to shutdown the server, error if any

Types

type CertOptions added in v0.90.0

type CertOptions struct {
	CACertPaths    []string
	SkipCertVerify bool
	Insecure       bool
}

func GetRegistryCertOptions added in v0.90.0

func GetRegistryCertOptions(registryHost string) (*CertOptions, error)

type Registry

type Registry interface {
	// ListImageTags lists all tags of the given image.
	ListImageTags(imageName string) ([]string, error)
	// GetFile gets the file content bundled in the given image:tag.
	// If filename is empty, it will get the first file.
	GetFile(imageWithTag string, filename string) ([]byte, error)
	// GetFiles get all the files content bundled in the given image:tag.
	GetFiles(imageWithTag string) (map[string][]byte, error)
	// DownloadBundle downloads OCI bundle similar to `imgpkg pull -b` command
	// It is recommended to use this function when downloading imgpkg bundle
	DownloadBundle(imageName, outputDir string) error
	// DownloadImage downloads an OCI image similarly to the `imgpkg pull -i` command
	DownloadImage(imageName, outputDir string) error
	// GetImageDigest gets the digest of an OCI image similar to the `imgpkg tag resolve -i` command
	GetImageDigest(imageWithTag string) (string, string, error)
	// CopyImageToTar downloads the image as tar file
	// This is equivalent to `imgpkg copy --image <image> --to-tar <tar-file-path>` command
	CopyImageToTar(sourceImageName, destTarFile string) error
	// CopyImageFromTar publishes the image to destination repository from specified tar file
	// This is equivalent to `imgpkg copy --tar <file> --to-repo <dest-repo>` command
	CopyImageFromTar(sourceTarFile, destImageRepo string) error
	// PushImage publishes the image to the specified location
	// This is equivalent to `imgpkg push -i <image> -f <filepath>`
	PushImage(imageWithTag string, filePaths []string) error
	// ResolveImage invokes `imgpkg tag resolve -i <image>` command
	ResolveImage(imageWithTag string) error
}

Registry defines the Registry interface

func New

func New(opts *ctlimg.Opts) (Registry, error)

New instantiates a new Registry

Jump to

Keyboard shortcuts

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