manifest

package
v0.5.1-30-gffe5abd Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: BSD-3-Clause Imports: 40 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 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 ManifestFormat pack.PackageFormat = "manifest"

Variables

This section is empty.

Functions

func NewManifestManager added in v0.4.0

func NewManifestManager(ctx context.Context) (packmanager.PackageManager, error)

NewManifestManager returns a `packmanager.PackageManager` which manipulates Unikraft manifests.

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.

Types

type DirectoryProvider

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

func (DirectoryProvider) Manifests

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

func (DirectoryProvider) PullManifest added in v0.4.0

func (dp DirectoryProvider) PullManifest(ctx context.Context, manifest *Manifest, opts ...pack.PullOption) 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) PullManifest added in v0.4.0

func (ghp GitHubProvider) PullManifest(ctx context.Context, manifest *Manifest, popts ...pack.PullOption) 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) PullManifest added in v0.4.0

func (gp GitProvider) PullManifest(ctx context.Context, manifest *Manifest, 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"`

	// 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(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, mopts ...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, 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"`
	Origin      string      `yaml:"-"`
}

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(ctx context.Context, 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) PullManifest added in v0.4.0

func (mip ManifestIndexProvider) PullManifest(ctx context.Context, manifest *Manifest, opts ...pack.PullOption) error

func (ManifestIndexProvider) String

func (mip ManifestIndexProvider) String() string

type ManifestOption

type ManifestOption func(m *Manifest) error

func WithAuthConfig

func WithAuthConfig(auths map[string]config.AuthConfig) 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 ManifestProvider

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

func (ManifestProvider) Manifests

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

func (ManifestProvider) PullManifest added in v0.4.0

func (mp ManifestProvider) PullManifest(ctx context.Context, manifest *Manifest, 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"`
	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)

	// PullManifest from the provider.
	PullManifest(context.Context, *Manifest, ...pack.PullOption) error

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

func NewDirectoryProvider

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

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

func NewGitHubProvider

func NewGitHubProvider(ctx context.Context, 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(ctx context.Context, path string, mopts ...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

Jump to

Keyboard shortcuts

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