oci

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// HelmChartConfigMediaType is the reserved media type for the Helm chart manifest config
	HelmChartConfigMediaType = "application/vnd.cncf.helm.config.v1+json"
	// HelmChartContentLayerMediaType is the reserved media type for Helm chart package content
	HelmChartContentLayerMediaType = "application/vnd.cncf.helm.chart.content.v1.tar+gzip"
	// HelmChartContentLayerMediaTypeDeprecated is the (deprecated) reserved media type for Helm
	// chart package content
	HelmChartContentLayerMediaTypeDeprecated = "application/tar+gzip"
	// ImageManifestMediaType is the reserved media type for OCI manifests
	ImageManifestMediaType = "application/vnd.oci.image.manifest.v1+json"
)

Variables

This section is empty.

Functions

func PrepareOciServer

func PrepareOciServer(t *testing.T, ociRepo *api.Repo)

Starts an OCI compliant server (docker-registry) so our push command based on oras cli works out-of-the-box. This way we don't have to mimic all the low-level HTTP requests made by oras.

func PushFileToOCI

func PushFileToOCI(t *testing.T, filepath string, ref string)

Types

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

Repo allows to operate a chart repository.

func New

func New(repo *api.Repo, c cache.Cacher, insecure bool) (*Repo, error)

New creates a Repo object from an api.Repo object.

func NewRaw

func NewRaw(u *url.URL, user string, pass string, c cache.Cacher, insecure bool, entries map[string][]string, resolver remotes.Resolver) (*Repo, error)

NewRaw creates a Repo object.

func PrepareHttpServer

func PrepareHttpServer(t *testing.T, ociRepo *api.Repo) *Repo

Creates an HTTP server that knows how to reply to all OCI related request except PUSH one.

func PrepareTest

func PrepareTest(t *testing.T, ociRepo *api.Repo) *Repo

func (*Repo) Fetch

func (r *Repo) Fetch(name string, version string) (string, error)

Fetch fetches a chart

func (*Repo) GetChartDetails

func (r *Repo) GetChartDetails(name string, version string) (*types.ChartDetails, error)

GetChartDetails returns the details of a chart

func (*Repo) GetDownloadURL

func (r *Repo) GetDownloadURL(name string, version string) (string, error)

GetDownloadURL returns the URL to download a chart

func (*Repo) Has

func (r *Repo) Has(name string, version string) (bool, error)

Has checks if a repo has a specific chart

func (*Repo) List

func (r *Repo) List() ([]string, error)

List lists all chart names in a repo

func (*Repo) ListChartVersions

func (r *Repo) ListChartVersions(name string) ([]string, error)

ListChartVersions lists all versions of a chart

func (*Repo) Reload

func (r *Repo) Reload() error

Reload reloads the index

func (*Repo) Upload

func (r *Repo) Upload(file string, metadata *chart.Metadata) error

Upload uploads a chart to the repo

type RepoTester

type RepoTester struct {
	// contains filtered or unexported fields
}

RepoTester allows to unit test each repo implementation

func NewTester

func NewTester(t *testing.T, repo *api.Repo) *RepoTester

NewTester creates fake HTTP server to handle requests and return a RepoTester object with useful info for testing

func (*RepoTester) GetChart

func (rt *RepoTester) GetChart(_ http.ResponseWriter, _ *http.Request, _ string)

GetChart returns the chart info from the index

func (*RepoTester) GetChartPackage

func (rt *RepoTester) GetChartPackage(w http.ResponseWriter, r *http.Request, name, digest string)

GetChartPackage returns a packaged helm chart

func (*RepoTester) GetIndex

func (rt *RepoTester) GetIndex(_ http.ResponseWriter, _ *http.Request)

GetIndex returns an index file

func (*RepoTester) GetTagManifest

func (rt *RepoTester) GetTagManifest(w http.ResponseWriter, r *http.Request, name, version string)

GetTagManifest returns the oci manifest of a specific tag

func (*RepoTester) GetTagsList

func (rt *RepoTester) GetTagsList(w http.ResponseWriter, r *http.Request, name string)

GetTagsList returns the list of available tags for the specified asset

func (*RepoTester) GetURL

func (rt *RepoTester) GetURL() string

GetURL returns the URL of the server

func (*RepoTester) HeadManifest200 added in v0.20.0

func (rt *RepoTester) HeadManifest200(w http.ResponseWriter)

HeadManifest200 return if a manifests exists or not

func (*RepoTester) HeadManifest404

func (rt *RepoTester) HeadManifest404(w http.ResponseWriter)

HeadManifest404 return if a manifests exists or not

func (*RepoTester) PostChart

func (rt *RepoTester) PostChart(_ http.ResponseWriter, _ *http.Request)

PostChart push a packaged chart

func (*RepoTester) ReplyPing

func (rt *RepoTester) ReplyPing(w http.ResponseWriter)

ReplyPing reply to a ping operation done by remote.Head to guess some connection parameters https://github.com/google/go-containerregistry/blob/main/pkg/v1/remote/transport/transport.go#L51

func (*RepoTester) ServeHTTP

func (rt *RepoTester) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http Handler type

type Tags

type Tags struct {
	Name string
	Tags []string
}

Tags contains the tags for a specific OCI artifact

Jump to

Keyboard shortcuts

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