manifest

package
v0.1.0-24-ga60fd7e Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: BSD-3-Clause Imports: 30 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ManifestContext pack.ContextKey = "manifest"
)

Variables

This section is empty.

Functions

func NewPackageFromManifest

func NewPackageFromManifest(ctx context.Context, manifest *Manifest, popts ...pack.PackageOption) (pack.Package, error)

NewPackageFromManifest generates a manifest implementation of the pack.Package construct based on the input Manifest

func NewPackageFromOptions

func NewPackageFromOptions(ctx context.Context, opts *pack.PackageOptions, provider Provider) (pack.Package, error)

NewPackageFromOptions generates a manifest implementation of the pack.Package construct based on the input options

func NewPackageWithVersion

func NewPackageWithVersion(ctx context.Context, manifest *Manifest, version string, popts ...pack.PackageOption) (pack.Package, error)

NewPackageWithVersion generates a manifest implementation of the pack.Package construct based on the input Manifest for a particular version

Types

type DirectoryProvider

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

func (DirectoryProvider) Manifests

func (dp DirectoryProvider) Manifests() ([]*Manifest, error)

func (DirectoryProvider) PullPackage

func (dp DirectoryProvider) PullPackage(manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error

func (DirectoryProvider) String

func (dp DirectoryProvider) String() string

type GitHubProvider

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

func (GitHubProvider) Manifests

func (ghp GitHubProvider) Manifests() ([]*Manifest, error)

func (GitHubProvider) PullPackage

func (ghp GitHubProvider) PullPackage(manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error

func (GitHubProvider) String

func (ghp GitHubProvider) String() string

type GitProvider

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

func (GitProvider) Manifests

func (gp GitProvider) Manifests() ([]*Manifest, error)

func (GitProvider) PullPackage

func (gp GitProvider) PullPackage(manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error

func (GitProvider) String

func (gp GitProvider) String() string

type Manifest

type Manifest struct {
	// Name of the entity which this manifest represents
	Name string `yaml:"name"`

	// Type of entity which this manifest represetns
	Type unikraft.ComponentType `yaml:"type"`

	// Manifest is used to point to remote manifest, allowing the manifest itself
	// to be retrieved by indirection.  Manifest is XOR with Versions and should
	// be back-propagated.
	Manifest string `yaml:"manifest,omitempty"`

	// Description of what this manifest represents
	Description string `yaml:"description,omitempty"`

	// Origin represents where (and therefore how) this manifest was populated
	Origin string `yaml:"origin,omitempty"`

	// Provider is the string name of the underlying implementation providing the
	// contents of this manifest
	Provider Provider `yaml:"provider,omitempty"`

	// Channels provides multiple ways to retrieve versions.  Classically this is
	// a separation between "staging" and "stable"
	Channels []ManifestChannel `yaml:"channels,omitempty"`

	// Versions
	Versions []ManifestVersion `yaml:"versions,omitempty"`
	// contains filtered or unexported fields
}

func FindManifestsFromSource

func FindManifestsFromSource(source string, mopts ...ManifestOption) ([]*Manifest, error)

FindManifestsFromSource is a recursive method which follows a given source and attempts to instantiate a Provider which matches the given source. If the source is recognised by a provider, it is traversed to return all the known Manifests.

func NewManifestFromBytes

func NewManifestFromBytes(raw []byte, mopts ...ManifestOption) (*Manifest, error)

NewManifestFromBytes parses a byte array of a YAML representing a manifest

func NewManifestFromFile

func NewManifestFromFile(path string, mopts ...ManifestOption) (*Manifest, error)

NewManifestFromFile reads in a manifest file from a given path

func NewManifestFromURL

func NewManifestFromURL(path string, mopts ...ManifestOption) (*Manifest, error)

NewManifestFromURL retrieves a provided path as a Manifest from a remote location over HTTP

func (Manifest) Auths

func (m Manifest) Auths() map[string]config.AuthConfig

Auths returns the map of provided authentication configuration passed as an option to the Manifest

func (Manifest) DefaultChannel

func (m Manifest) DefaultChannel() (*ManifestChannel, error)

DefaultChannel returns the default channel of the Manifest

func (Manifest) WriteToFile

func (m Manifest) WriteToFile(path string) error

WriteToFile saves the manifest as a YAML format file at the given path

type ManifestChannel

type ManifestChannel struct {
	Name     string `yaml:"name"`
	Default  bool   `yaml:"default,omitempty"`
	Latest   string `yaml:"latest,omitempty"`
	Manifest string `yaml:"manifest,omitempty"`
	Resource string `yaml:"resource"`
	Sha256   string `yaml:"sha256,omitempty"`
	Local    string `yaml:"-"`
}

type ManifestIndex

type ManifestIndex struct {
	Name        string      `yaml:"name,omitempty"`
	LastUpdated time.Time   `yaml:"last_updated"`
	Manifests   []*Manifest `yaml:"manifests"`
}

func NewManifestIndexFromBytes

func NewManifestIndexFromBytes(raw []byte, mopts ...ManifestOption) (*ManifestIndex, error)

NewManifestIndexFromBytes parses a byte array of a YAML representing a manifest index

func NewManifestIndexFromFile

func NewManifestIndexFromFile(path string, mopts ...ManifestOption) (*ManifestIndex, error)

func NewManifestIndexFromURL

func NewManifestIndexFromURL(path string, mopts ...ManifestOption) (*ManifestIndex, error)

NewManifestFromURL retrieves a provided path as a ManifestIndex from a remote location over HTTP

func (*ManifestIndex) WriteToFile

func (mi *ManifestIndex) WriteToFile(path string) error

type ManifestIndexProvider

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

func (ManifestIndexProvider) Manifests

func (mip ManifestIndexProvider) Manifests() ([]*Manifest, error)

func (ManifestIndexProvider) PullPackage

func (mip ManifestIndexProvider) PullPackage(manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error

func (ManifestIndexProvider) String

func (mip ManifestIndexProvider) String() string

type ManifestManager

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

func (ManifestManager) AddSource

func (mm ManifestManager) AddSource(source string) error

func (ManifestManager) ApplyOptions

func (mm ManifestManager) ApplyOptions(pmopts ...packmanager.PackageManagerOption) error

func (ManifestManager) Catalog

func (mm ManifestManager) Catalog(query packmanager.CatalogQuery, popts ...pack.PackageOption) ([]pack.Package, error)

func (ManifestManager) Format

func (mm ManifestManager) Format() string

func (ManifestManager) From

func (ManifestManager) IsCompatible

func (mm ManifestManager) IsCompatible(source string) (packmanager.PackageManager, error)

func (ManifestManager) LocalManifestIndex

func (mm ManifestManager) LocalManifestIndex() string

LocalManifestIndex returns the user configured path to the manifest index

func (ManifestManager) LocalManifestsDir

func (mm ManifestManager) LocalManifestsDir() string

LocalManifestDir returns the user configured path to all the manifests

func (ManifestManager) NewPackageFromOptions

func (mm ManifestManager) NewPackageFromOptions(ctx context.Context, opts *pack.PackageOptions) ([]pack.Package, error)

NewPackage initializes a new package

func (ManifestManager) Options

Options allows you to view the current options.

func (ManifestManager) Pull

func (mm ManifestManager) Pull(path string, opts *pack.PullPackageOptions) ([]pack.Package, error)

Pull a package from the support registry of the implementation.

func (ManifestManager) Push

func (mm ManifestManager) Push(path string) error

Push the resulting package to the supported registry of the implementation.

func (ManifestManager) RemoveSource

func (mm ManifestManager) RemoveSource(source string) error

func (ManifestManager) Update

func (mm ManifestManager) Update() error

type ManifestOption

type ManifestOption func(m *Manifest) error

func WithAuthConfig

func WithAuthConfig(auths map[string]config.AuthConfig) ManifestOption

func WithLogger

func WithLogger(l log.Logger) ManifestOption

func WithSourcesRootDir

func WithSourcesRootDir(dir string) ManifestOption

WithSourcesRootDir is an option which helps find cached Manifest Channel or Version resources. When set to a directory, the fixed structure of this directory should allow us to look up (and also store) resources here for later use.

type ManifestPackage

type ManifestPackage struct {
	*pack.PackageOptions
	Provider
	// contains filtered or unexported fields
}

func (ManifestPackage) ApplyOptions

func (mp ManifestPackage) ApplyOptions(opts ...pack.PackageOption) error

func (ManifestPackage) CanonicalName

func (mp ManifestPackage) CanonicalName() string

func (ManifestPackage) Compatible

func (mp ManifestPackage) Compatible(ref string) bool

func (ManifestPackage) Format

func (mp ManifestPackage) Format() string

func (ManifestPackage) Name

func (mp ManifestPackage) Name() string

func (ManifestPackage) Options

func (mp ManifestPackage) Options() *pack.PackageOptions

func (ManifestPackage) Pack

func (mp ManifestPackage) Pack() error

func (ManifestPackage) Pull

func (mp ManifestPackage) Pull(opts ...pack.PullPackageOption) error

type ManifestProvider

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

func (ManifestProvider) Manifests

func (mp ManifestProvider) Manifests() ([]*Manifest, error)

func (ManifestProvider) PullPackage

func (mp ManifestProvider) PullPackage(manifest *Manifest, popts *pack.PackageOptions, ppopts *pack.PullPackageOptions) error

func (ManifestProvider) String

func (mp ManifestProvider) String() string

type ManifestVersion

type ManifestVersion struct {
	Version  string              `yaml:"version"`
	Resource string              `yaml:"resource"`
	Sha256   string              `yaml:"sha256,omitempty"`
	Type     ManifestVersionType `yaml:"type,omitempty"`
	Unikraft string              `yaml:"unikraft,omitempty"`
	Local    string              `yaml:"-"`
}

func (*ManifestVersion) ShortGitSha

func (mv *ManifestVersion) ShortGitSha() (string, error)

type ManifestVersionType

type ManifestVersionType string
const (
	ManifestVersionSemver ManifestVersionType = "semver"
	ManifestVersionGitSha ManifestVersionType = "gitsha"
)

type Provider

type Provider interface {
	// Manifests returns a slice of Manifests which can be returned by this
	// Provider
	Manifests() ([]*Manifest, error)

	// Pull from the provider
	PullPackage(*Manifest, *pack.PackageOptions, *pack.PullPackageOptions) error

	// String returns the name of the provider
	fmt.Stringer
}

func NewDirectoryProvider

func NewDirectoryProvider(path string, mopts ...ManifestOption) (Provider, error)

NewDirectoryProvider attempts to parse a provided path as a Unikraft "microlibirary" directory

func NewGitHubProvider

func NewGitHubProvider(path string, mopts ...ManifestOption) (Provider, error)

NewGitHubProvider attempts to parse the input path as a location provided on GitHub. Additional context for authentication is necessary to use this provider if the location is held within a private repository. Otherwise we can both probe GitHub's API as well as exploit the fact that it is a Git repository to retrieve information and deliver information as a Manifest format.

func NewGitProvider

func NewGitProvider(path string, mopts ...ManifestOption) (Provider, error)

NewGitProvider attempts to parse a provided path as a Git repository

func NewManifestIndexProvider

func NewManifestIndexProvider(path string, mopts ...ManifestOption) (Provider, error)

NewManifestIndexProvider accepts an input path which is checked against first a local file on disk and then a remote URL. If either of these checks pass, the Provider is instantiated since the path does indeed represent a ManifestIndex.

func NewManifestProvider

func NewManifestProvider(path string, mopts ...ManifestOption) (Provider, error)

NewManifestProvider accepts an input path which is checked against a local file on disk and a remote URL. If populating a Manifest struct is possible given the path, then this provider is able to return list of exactly 1 manifest.

func NewProvider

func NewProvider(path string, mopts ...ManifestOption) (Provider, error)

NewProvider ultimately returns one of the supported manifest providers by attempting an ordered instantiation based on the input source. For the provider which does not return an error is indicator that it is supported and thus the return of NewProvider a compatible interface Provider able to gather information about the manifest.

func NewProvidersFromString

func NewProvidersFromString(provider, path string, mopts ...ManifestOption) (Provider, error)

NewProvidersFromString returns a provider based on a giving string which identifies the provider

Jump to

Keyboard shortcuts

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