artifacts

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package artifacts implements support to pushing and pulling artifacts to an OCI registry

Index

Constants

View Source
const (
	// HelmArtifactsFolder defines the path of the chart artifacts, relative to the bundle root
	HelmArtifactsFolder = "artifacts"

	// HelmChartArtifactMetadataDir defines the relative path to the chart metadata inside the chart root
	HelmChartArtifactMetadataDir = HelmArtifactsFolder + "/chart/metadata"
)

Variables

View Source
var (
	// ErrTagDoesNotExist defines an error locating a remote tag because it does not exist
	ErrTagDoesNotExist = errors.New("tag does not exist")
	// ErrLocalArtifactNotExist defines an error locating a local artifact because it does not exist
	ErrLocalArtifactNotExist = errors.New("local artifact does not exist")
)

Functions

func FetchChartMetadata

func FetchChartMetadata(ctx context.Context, url string, destination string, opts ...Option) error

FetchChartMetadata retrieves the chart metadata artifact from the registry

func Insecure

func Insecure(c *RegistryClientConfig)

Insecure asks the tool to allow insecure HTTPS connections to the remote server.

func ListTags

func ListTags(ctx context.Context, src string, opts ...crane.Option) ([]string, error)

ListTags lists the defined tags in the repository

func PullChart

func PullChart(chartURL, version string, destDir string, opts ...RegistryClientOption) (string, error)

PullChart retrieves the specified chart

func PullImageMetadata

func PullImageMetadata(ctx context.Context, image *imagelock.ChartImage, destDir string, opts ...Option) error

PullImageMetadata pulls the image metadata and stores it locally as an oci-layout

func PullImageSignatures

func PullImageSignatures(ctx context.Context, image *imagelock.ChartImage, destDir string, opts ...Option) error

PullImageSignatures pulls the image signature and stores it locally as an oci-layout

func PushChart

func PushChart(tarFile string, pushChartURL string, opts ...RegistryClientOption) error

PushChart pushes the local chart tarFile to the remote URL provided

func PushChartMetadata

func PushChartMetadata(ctx context.Context, url string, chartDir string, opts ...Option) error

PushChartMetadata pushes the chart metadata artifact to the registry

func PushImageMetadata

func PushImageMetadata(ctx context.Context, image *imagelock.ChartImage, destDir string, opts ...Option) error

PushImageMetadata pushes a oci-layout directory to the registry as the image metadata

func PushImageSignatures

func PushImageSignatures(ctx context.Context, image *imagelock.ChartImage, destDir string, opts ...Option) error

PushImageSignatures pushes a oci-layout directory to the registry as the image signature

func RemoteChartExist

func RemoteChartExist(chartURL string, version string, opts ...RegistryClientOption) bool

RemoteChartExist checks if the provided chart exists

func TagExist

func TagExist(ctx context.Context, src string, tag string, o crane.Options) (bool, error)

TagExist checks if a given tag exist in the provided repository

func WithAuth added in v0.4.0

func WithAuth(username, password string) func(cfg *Config)

WithAuth configures the Auth

func WithInsecure

func WithInsecure(insecure bool) func(c *RegistryClientConfig)

WithInsecure configures the InsecureMode of the Config

func WithInsecureMode added in v0.3.1

func WithInsecureMode(insecure bool) func(cfg *Config)

WithInsecureMode configures Insecure transport

func WithPlainHTTP

func WithPlainHTTP(usePlain bool) func(c *RegistryClientConfig)

WithPlainHTTP configures the InsecureMode of the Config

func WithRegistryAuth added in v0.4.0

func WithRegistryAuth(username, password string) func(c *RegistryClientConfig)

WithRegistryAuth configures the Auth of the RegistryClientConfig

func WithResolveReference

func WithResolveReference(v bool) func(cfg *Config)

WithResolveReference configures the ResolveReference setting

func WithTempDir added in v0.4.0

func WithTempDir(dir string) func(c *RegistryClientConfig)

WithTempDir configures the directory in which to place the temporary credentials file

Types

type Auth added in v0.4.0

type Auth struct {
	Username string
	Password string
}

Auth defines the authentication information to access the container registry

type Config

type Config struct {
	ResolveReference bool
	InsecureMode     bool
	Auth             Auth
}

Config defines the configuration when pulling/pushing artifacts to a registry

func NewConfig

func NewConfig(opts ...Option) *Config

NewConfig creates a new Config

type Option

type Option func(*Config)

Option defines a Config option

type RegistryClientConfig

type RegistryClientConfig struct {
	UsePlainHTTP     bool
	UseInsecureHTTPS bool
	Auth             Auth
	TempDir          string
}

RegistryClientConfig defines how the client communicates with the remote server

func NewRegistryClientConfig

func NewRegistryClientConfig(opts ...RegistryClientOption) *RegistryClientConfig

NewRegistryClientConfig returns a new RegistryClientConfig with default values

type RegistryClientOption

type RegistryClientOption func(*RegistryClientConfig)

RegistryClientOption defines a RegistryClientConfig setting

Jump to

Keyboard shortcuts

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