manifest

package
v0.9.4-193-g2f5e325c Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: BSD-3-Clause Imports: 43 Imported by: 1

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Index

Constants

View Source
const DefaultChannelName = "stable"

DefaultChannelName is the default channel name to use when multiple channels are specified.

View Source
const ManifestFormat pack.PackageFormat = "manifest"

Variables

This section is empty.

Functions

func NewPackageFromManifest

func NewPackageFromManifest(manifest *Manifest, opts ...ManifestOption) (pack.Package, error)

NewPackageFromManifest generates a manifest implementation of the pack.Package construct based on the input Manifest using its default channel

func NewPackageFromManifestWithVersion added in v0.4.0

func NewPackageFromManifestWithVersion(manifest *Manifest, version string, opts ...ManifestOption) (pack.Package, error)

NewPackageFromManifestWithVersion generates a new package based on an input manifest which in itself may contain various versions and channels. With the provided version as a positional parameter, the manifest can be reduced to represent a specific version.

func NewPackageManager

func NewPackageManager(ctx context.Context, opts ...any) (packmanager.PackageManager, error)

NewPackageManager satisfies the `packmanager.NewPackageManager` interface and returns a new `packmanager.PackageManager` for the manifest manager.

func RegisterFlags added in v0.6.7

func RegisterFlags()

func RegisterPackageManager added in v0.6.7

func RegisterPackageManager() func(u *packmanager.UmbrellaManager) error

Types

type DirectoryProvider

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

func (DirectoryProvider) DeleteManifest added in v0.7.0

func (dp DirectoryProvider) DeleteManifest(context.Context) error

func (DirectoryProvider) Manifests

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

func (DirectoryProvider) MarshalJSON added in v0.7.2

func (dp DirectoryProvider) MarshalJSON() ([]byte, error)

func (DirectoryProvider) PullChannel

func (dp DirectoryProvider) PullChannel(ctx context.Context, manifest *Manifest, channel *ManifestChannel, opts ...pack.PullOption) error

func (DirectoryProvider) PullVersion

func (dp DirectoryProvider) PullVersion(ctx context.Context, manifest *Manifest, version *ManifestVersion, opts ...pack.PullOption) error

func (DirectoryProvider) String

func (dp DirectoryProvider) String() string

type GitHubProvider

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

func (GitHubProvider) DeleteManifest added in v0.7.0

func (ghp GitHubProvider) DeleteManifest(context.Context) error

func (GitHubProvider) Manifests

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

func (GitHubProvider) MarshalJSON added in v0.7.2

func (ghp GitHubProvider) MarshalJSON() ([]byte, error)

func (GitHubProvider) PullChannel

func (ghp GitHubProvider) PullChannel(ctx context.Context, manifest *Manifest, channel *ManifestChannel, popts ...pack.PullOption) error

func (GitHubProvider) PullVersion

func (ghp GitHubProvider) PullVersion(ctx context.Context, manifest *Manifest, version *ManifestVersion, popts ...pack.PullOption) error

func (GitHubProvider) String

func (ghp GitHubProvider) String() string

type GitProvider

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

func (*GitProvider) DeleteManifest added in v0.7.0

func (gp *GitProvider) DeleteManifest(context.Context) error

func (*GitProvider) Manifests

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

func (*GitProvider) MarshalJSON added in v0.7.2

func (gp *GitProvider) MarshalJSON() ([]byte, error)

func (*GitProvider) PullChannel

func (gp *GitProvider) PullChannel(ctx context.Context, manifest *Manifest, channel *ManifestChannel, popts ...pack.PullOption) error

func (*GitProvider) PullVersion

func (gp *GitProvider) PullVersion(ctx context.Context, manifest *Manifest, version *ManifestVersion, popts ...pack.PullOption) 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" json:"name"`

	// Type of entity which this manifest represetns
	Type unikraft.ComponentType `yaml:"type" json:"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" json:"manifest,omitempty"`

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

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

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

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

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

func FindManifestsFromSource

func FindManifestsFromSource(ctx context.Context, 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(ctx context.Context, raw []byte, opts ...ManifestOption) (*Manifest, error)

NewManifestFromBytes parses a byte array of a YAML representing a manifest

func NewManifestFromFile

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

NewManifestFromFile reads in a manifest file from a given path

func NewManifestFromURL

func NewManifestFromURL(ctx context.Context, path string, opts ...ManifestOption) (*Manifest, error)

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

func (Manifest) DefaultChannel

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

DefaultChannel returns the default channel of the Manifest

func (Manifest) SaveTo

func (m Manifest) SaveTo(path string) error

Save 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"`
}

type ManifestIndex

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

func NewManifestIndexFromBytes

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

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

func NewManifestIndexFromFile

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

func NewManifestIndexFromURL

func NewManifestIndexFromURL(ctx context.Context, path string, opts ...ManifestOption) (*ManifestIndex, error)

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

func (*ManifestIndex) SaveTo

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

type ManifestIndexProvider

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

func (*ManifestIndexProvider) DeleteManifest added in v0.7.0

func (mip *ManifestIndexProvider) DeleteManifest(context.Context) error

func (*ManifestIndexProvider) Manifests

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

func (*ManifestIndexProvider) MarshalJSON added in v0.7.2

func (mip *ManifestIndexProvider) MarshalJSON() ([]byte, error)

func (*ManifestIndexProvider) PullChannel

func (*ManifestIndexProvider) PullVersion

func (*ManifestIndexProvider) String

func (mip *ManifestIndexProvider) String() string

type ManifestManager

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

func NewManifestManager added in v0.4.0

func NewManifestManager(ctx context.Context, opts ...ManifestManagerOption) (*ManifestManager, error)

NewManifestManager instantiates a new package manager which manipulates Unikraft manifests.

func (*ManifestManager) AddSource

func (m *ManifestManager) AddSource(ctx context.Context, source string) error

func (*ManifestManager) Catalog

func (m *ManifestManager) Catalog(ctx context.Context, qopts ...packmanager.QueryOption) ([]pack.Package, error)

func (*ManifestManager) Delete

func (m *ManifestManager) Delete(ctx context.Context, qopts ...packmanager.QueryOption) error

Delete implements packmanager.PackageManager.

func (*ManifestManager) Format

func (m *ManifestManager) Format() pack.PackageFormat

func (*ManifestManager) From

func (*ManifestManager) Index

Index retrieves and returns a cache of the upstream manifest registry

func (*ManifestManager) IsCompatible

func (m *ManifestManager) IsCompatible(ctx context.Context, source string, qopts ...packmanager.QueryOption) (packmanager.PackageManager, bool, error)

func (*ManifestManager) LocalManifestIndex

func (m *ManifestManager) LocalManifestIndex(ctx context.Context) string

LocalManifestIndex returns the user configured path to the manifest index

func (*ManifestManager) LocalManifestsDir

func (m *ManifestManager) LocalManifestsDir(ctx context.Context) string

LocalManifestDir returns the user configured path to all the manifests

func (*ManifestManager) Pack

func (*ManifestManager) RemoveSource

func (m *ManifestManager) RemoveSource(ctx context.Context, source string) error

func (*ManifestManager) SetSources

func (m *ManifestManager) SetSources(_ context.Context, sources ...string) error

func (*ManifestManager) Unpack

func (*ManifestManager) Update

func (m *ManifestManager) Update(ctx context.Context) error

type ManifestManagerOption added in v0.6.0

type ManifestManagerOption func(context.Context, *ManifestManager) error

ManifestManagerOption represents a specific configuration that can be used for the Manifest Package Manager.

func WithManagerAuths

func WithManagerAuths(auths map[string]config.AuthConfig) ManifestManagerOption

Set the default set of auths to initialize the manager with.

func WithManagerCacheDir

func WithManagerCacheDir(dir string) ManifestManagerOption

Set the location of component archives which are stored locally.

func WithManagerDefaultChannelName

func WithManagerDefaultChannelName(name string) ManifestManagerOption

Sets the default channel name to use when multiple channels are specified.

func WithManagerLocalManifestDir

func WithManagerLocalManifestDir(dir string) ManifestManagerOption

Set the local directory where the manifests are stored.

func WithManagerManifests

func WithManagerManifests(manifests ...string) ManifestManagerOption

Set the default set of source manifests to initialize the manager with. Not setting anything will result in defaults.

type ManifestOption

type ManifestOption func(*ManifestOptions)

func WithAuthConfig

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

WithAuthConfig sets any required authentication necessary for accessing the manifest.

func WithCacheDir added in v0.6.0

func WithCacheDir(dir string) ManifestOption

WithCacheDir 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.

func WithDefaultChannelName

func WithDefaultChannelName(name string) ManifestOption

WithDefaultChannelName sets the default channel name to use when multiple channels are specified.

func WithUpdate added in v0.7.0

func WithUpdate(update bool) ManifestOption

WithUpdate is an option to indicate that remote network connections can be made when instantiating a Manifest(Index) or to allow probing remote sources to determine versions, etc.

type ManifestOptions added in v0.6.0

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

ManifestOptions contains a set of additional configuration necessary for the underlying ManifestProvider implementation that are not attributes of the provider itself.

func NewManifestOptions added in v0.6.0

func NewManifestOptions(opts ...ManifestOption) *ManifestOptions

NewManifestOptions returns an instantiated ManifestOptions based on variable input number of ManifestOption methods.

type ManifestProvider

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

func (*ManifestProvider) DeleteManifest added in v0.7.0

func (mp *ManifestProvider) DeleteManifest(ctx context.Context) error

func (*ManifestProvider) Manifests

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

func (*ManifestProvider) MarshalJSON added in v0.7.2

func (mp *ManifestProvider) MarshalJSON() ([]byte, error)

func (*ManifestProvider) PullChannel

func (mp *ManifestProvider) PullChannel(ctx context.Context, manifest *Manifest, channel *ManifestChannel, opts ...pack.PullOption) error

func (*ManifestProvider) PullVersion

func (mp *ManifestProvider) PullVersion(ctx context.Context, manifest *Manifest, version *ManifestVersion, opts ...pack.PullOption) 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"`
}

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)

	// PullChannel a specific channel from the provider.
	PullChannel(context.Context, *Manifest, *ManifestChannel, ...pack.PullOption) error

	// PullVersion a specific version from the provider.
	PullVersion(context.Context, *Manifest, *ManifestVersion, ...pack.PullOption) error

	// DeleteManifest deletes the artifact based on the provider's implementation.
	DeleteManifest(context.Context) error

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

	json.Marshaler
}

func NewDirectoryProvider

func NewDirectoryProvider(ctx context.Context, path string, opts ...ManifestOption) (Provider, error)

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

func NewGitHubProvider

func NewGitHubProvider(ctx context.Context, path string, opts ...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(ctx context.Context, path string, opts ...ManifestOption) (Provider, error)

NewGitProvider attempts to parse a provided path as a Git repository

func NewManifestIndexProvider

func NewManifestIndexProvider(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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 NewProviderFromString added in v0.2.0

func NewProviderFromString(ctx context.Context, provider, path string, entity any, mopts ...ManifestOption) (Provider, error)

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

func NewTarballProvider

func NewTarballProvider(ctx context.Context, path string, opts ...ManifestOption) (Provider, error)

type TarballProvider

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

func (TarballProvider) DeleteManifest

func (provider TarballProvider) DeleteManifest(context.Context) error

func (TarballProvider) Manifests

func (provider TarballProvider) Manifests() ([]*Manifest, error)

func (TarballProvider) MarshalJSON

func (provider TarballProvider) MarshalJSON() ([]byte, error)

func (TarballProvider) PullChannel

func (provider TarballProvider) PullChannel(ctx context.Context, manifest *Manifest, _ *ManifestChannel, opts ...pack.PullOption) error

func (TarballProvider) PullVersion

func (provider TarballProvider) PullVersion(ctx context.Context, manifest *Manifest, _ *ManifestVersion, opts ...pack.PullOption) error

func (TarballProvider) String

func (provider TarballProvider) String() string

Jump to

Keyboard shortcuts

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