oci

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 30 Imported by: 8

Documentation

Index

Constants

View Source
const (
	OciErrorCodeNameUnknown  = "NAME_UNKNOWN"
	OciErrorCodeRepoNotFound = "NOT_FOUND"
)
View Source
const (
	MediaTypeConfig           = "application/vnd.docker.container.image.v1+json"
	MediaTypeManifestList     = "application/vnd.docker.distribution.manifest.list.v2+json"
	MediaTypeManifest         = "application/vnd.docker.distribution.manifest.v2+json"
	MediaTypeForeignLayer     = "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip"
	MediaTypeArtifactManifest = "application/vnd.oci.artifact.manifest.v1+json"
)
View Source
const DEFAULT_LIMIT_STORE_SIZE = 64 * 1024 * 1024

The default limit of the store size is 64 MiB.

View Source
const DEFAULT_OCI_ARTIFACT_TYPE = "application/vnd.oci.image.layer.v1.tar"
View Source
const OCI_SCHEME = "oci"

Variables

This section is empty.

Functions

func GetAllImageTags added in v0.8.7

func GetAllImageTags(imageName string) ([]string, error)

func Login

func Login(hostname, username, password string, setting *settings.Settings) error

Login will login 'hostname' by 'username' and 'password'.

func Logout

func Logout(hostname string, setting *settings.Settings) error

Logout will logout from registry.

func ParsePlatform added in v0.8.6

func ParsePlatform(platform string) (*v1.Platform, error)

func Pull

func Pull(localPath, hostName, repoName, tag string, settings *settings.Settings) error

Pull will pull the oci artifacts from oci registry to local path.

func Push

func Push(localPath, hostName, repoName, tag string, settings *settings.Settings) error

Push will push the oci artifacts to oci registry from local path

func RepoIsNotExist added in v0.8.0

func RepoIsNotExist(err error) bool

RepoIsNotExist will check if the error is caused by the repo not found.

Types

type OciClient

type OciClient struct {
	PullOciOptions *PullOciOptions
	// contains filtered or unexported fields
}

OciClient is mainly responsible for interacting with OCI registry

func NewOciClient

func NewOciClient(regName, repoName string, settings *settings.Settings) (*OciClient, error)

NewOciClient will new an OciClient. regName is the registry. e.g. ghcr.io or docker.io. repoName is the repo name on registry. Deprecated: use NewOciClientWithOpts instead.

func NewOciClientWithOpts added in v0.9.1

func NewOciClientWithOpts(opts ...OciClientOption) (*OciClient, error)

NewOciClientWithOpts will new an OciClient with options.

func (*OciClient) ContainsTag added in v0.3.4

func (ociClient *OciClient) ContainsTag(tag string) (bool, *reporter.KpmEvent)

ContainsTag will check if the tag exists in the repo.

func (*OciClient) FetchManifestIntoJsonStr added in v0.3.7

func (ociClient *OciClient) FetchManifestIntoJsonStr(opts opt.OciFetchOptions) (string, error)

FetchManifestIntoJsonStr will fetch the manifest and return it into json string.

func (*OciClient) GetReference added in v0.3.7

func (ociClient *OciClient) GetReference() string

func (*OciClient) Pull

func (ociClient *OciClient) Pull(localPath, tag string) error

Pull will pull the oci artifacts from oci registry to local path.

func (*OciClient) Push

func (ociClient *OciClient) Push(localPath, tag string) *reporter.KpmEvent

Push will push the oci artifacts to oci registry from local path

func (*OciClient) PushWithOciManifest added in v0.3.7

func (ociClient *OciClient) PushWithOciManifest(localPath, tag string, opts *opt.OciManifestOptions) *reporter.KpmEvent

PushWithManifest will push the oci artifacts to oci registry from local path

func (*OciClient) SetLogWriter added in v0.3.7

func (ociClient *OciClient) SetLogWriter(writer io.Writer)

func (*OciClient) TheLatestTag

func (ociClient *OciClient) TheLatestTag() (string, error)

TheLatestTag will return the latest tag of the kcl packages.

type OciClientOption added in v0.9.1

type OciClientOption func(*OciClient) error

OciClientOption configures how we set up the OciClient

func WithCredential added in v0.9.1

func WithCredential(credential *remoteauth.Credential) OciClientOption

WithCredential sets the credential of the OciClient

func WithInsecureSkipTLSverify added in v0.10.0

func WithInsecureSkipTLSverify(insecureSkipTLSverify bool) OciClientOption

WithInsecureSkipTLSverify is an option to set the skip TLS verification flag.

func WithPlainHttp added in v0.9.1

func WithPlainHttp(plainHttp bool) OciClientOption

WithPlainHttp sets the plain http of the OciClient

func WithRepoPath added in v0.9.1

func WithRepoPath(repoPath string) OciClientOption

WithRepoPath sets the repo path of the OciClient

func WithSettings added in v0.9.3

func WithSettings(settings *settings.Settings) OciClientOption

WithSettings sets the kpm settings of the OciClient

type PullOciOptions added in v0.8.6

type PullOciOptions struct {
	Platform string
	CopyOpts *oras.CopyOptions
}

func (*PullOciOptions) Successors added in v0.8.6

func (popts *PullOciOptions) Successors(ctx context.Context, fetcher content.Fetcher, node v1.Descriptor) ([]v1.Descriptor, error)

Successors returns the nodes directly pointed by the current node. In other words, returns the "children" of the current descriptor.

Jump to

Keyboard shortcuts

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