porter

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 72 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// DockerDriver is the name of the Docker driver.
	DockerDriver = cnabprovider.DriverNameDocker

	// DebugDriver is the name of the Debug driver.
	DebugDriver = cnabprovider.DriverNameDebug

	// DefaultDriver is the name of the default driver (Docker).
	DefaultDriver = DockerDriver
)

Variables

Functions

This section is empty.

Types

type ArchiveOptions

type ArchiveOptions struct {
	BundleLifecycleOpts
	ArchiveFile string
}

ArchiveOptions defines the valid options for performing an archive operation

func (*ArchiveOptions) Validate

func (o *ArchiveOptions) Validate(args []string, p *Porter) error

Validate performs validation on the publish options

type BuildOptions

type BuildOptions struct {
	NoLint bool
	// contains filtered or unexported fields
}

func (BuildOptions) Apply

func (o BuildOptions) Apply(cxt *context.Context)

type BuildProvider

type BuildProvider interface {
	// BuildInvocationImage using the bundle in the current directory
	BuildInvocationImage(manifest *manifest.Manifest) error
}

type BundleLifecycleOpts

type BundleLifecycleOpts struct {
	BundlePullOptions
	AllowAccessToDockerHost bool
	// contains filtered or unexported fields
}

func (*BundleLifecycleOpts) ToActionArgs

func (o *BundleLifecycleOpts) ToActionArgs(deperator *dependencyExecutioner) cnabprovider.ActionArguments

ToActionArgs converts this instance of user-provided action options.

func (*BundleLifecycleOpts) Validate

func (o *BundleLifecycleOpts) Validate(args []string, porter *Porter) error

type BundlePullOptions

type BundlePullOptions struct {
	Tag              string
	InsecureRegistry bool
	Force            bool
}

type BundleResolver

type BundleResolver struct {
	Cache    cache.BundleCache
	Registry cnabtooci.RegistryProvider
}

func (*BundleResolver) Resolve

Resolves a bundle from the cache, or pulls it and caches it Returns the location of the bundle or an error

type CondensedClaim

type CondensedClaim struct {
	Name     string
	Created  time.Time
	Modified time.Time
	Action   string
	Status   string
}

CondensedClaim holds a subset of pertinent values to be listed from a claim.Claim

type CondensedClaimList

type CondensedClaimList []CondensedClaim

func (CondensedClaimList) Len

func (l CondensedClaimList) Len() int

func (CondensedClaimList) Less

func (l CondensedClaimList) Less(i, j int) bool

func (CondensedClaimList) Swap

func (l CondensedClaimList) Swap(i, j int)

type CopyOpts

type CopyOpts struct {
	Source           string
	Destination      string
	InsecureRegistry bool
}

func (*CopyOpts) Validate

func (c *CopyOpts) Validate() error

Validate performs validation logic on the options specified for a bundle copy

type CredentialDeleteOptions

type CredentialDeleteOptions struct {
	Name string
}

CredentialDeleteOptions represent options for Porter's credential delete command

func (*CredentialDeleteOptions) Validate

func (o *CredentialDeleteOptions) Validate(args []string) error

Validate validates the args provided Porter's credential delete command

type CredentialEditOptions

type CredentialEditOptions struct {
	Name string
}

func (*CredentialEditOptions) Validate

func (o *CredentialEditOptions) Validate(args []string) error

Validate validates the args provided to Porter's credential edit command

type CredentialOptions

type CredentialOptions struct {
	BundleLifecycleOpts
	Silent bool
}

func (*CredentialOptions) Validate

func (g *CredentialOptions) Validate(args []string, cxt *context.Context) error

Validate prepares for an action and validates the options. For example, relative paths are converted to full paths and then checked that they exist and are accessible.

type CredentialShowOptions

type CredentialShowOptions struct {
	printer.PrintOptions
	Name string
}

CredentialShowOptions represent options for Porter's credential show command

func (*CredentialShowOptions) Validate

func (o *CredentialShowOptions) Validate(args []string) error

Validate validates the args provided to Porter's credential show command

type DisplayOutput

type DisplayOutput struct {
	Name       string
	Definition definition.Schema
	Value      string
	Type       string
}

type ExplainOpts

type ExplainOpts struct {
	BundleLifecycleOpts
	printer.PrintOptions
}

func (*ExplainOpts) Validate

func (o *ExplainOpts) Validate(args []string, cxt *context.Context) error

type InspectableBundle

type InspectableBundle struct {
	Name             string                     `json:"name" yaml:"name"`
	Description      string                     `json:"description,omitempty" yaml:"description,omitempty"`
	Version          string                     `json:"version" yaml:"version"`
	InvocationImages []PrintableInvocationImage `json:"invocationImages" yaml:"invocationImages"`
	Images           []PrintableImage           `json:"images,omitempty" yaml:"images,omitempty"`
}

type InstallOptions

type InstallOptions struct {
	BundleLifecycleOpts
}

InstallOptions that may be specified when installing a bundle. Porter handles defaulting any missing values.

type InvokeOptions

type InvokeOptions struct {
	// Action name to invoke
	Action string
	BundleLifecycleOpts
}

InvokeOptions that may be specified when invoking a bundle. Porter handles defaulting any missing values.

func (*InvokeOptions) Validate

func (o *InvokeOptions) Validate(args []string, p *Porter) error

type LintOptions

type LintOptions struct {
	printer.PrintOptions

	// File path to the porter manifest. Defaults to the bundle in the current directory.
	File string
	// contains filtered or unexported fields
}

func (LintOptions) Apply

func (o LintOptions) Apply(cxt *context.Context)

func (*LintOptions) Validate

func (o *LintOptions) Validate(cxt *context.Context) error

type ListOptions

type ListOptions struct {
	printer.PrintOptions
}

ListOptions represent generic options for use by Porter's list commands

type Mixins

type Mixins []mixin.Metadata

func (Mixins) PrintMixinsTable

func (mixins Mixins) PrintMixinsTable() string

type OutputListOptions

type OutputListOptions struct {
	printer.PrintOptions
	// contains filtered or unexported fields
}

OutputListOptions represent options for a bundle output list command

func (*OutputListOptions) Validate

func (o *OutputListOptions) Validate(args []string, cxt *context.Context) error

Validate validates the provided args, using the provided context, setting attributes of OutputListOptions as applicable

type OutputShowOptions

type OutputShowOptions struct {
	Output string
	// contains filtered or unexported fields
}

OutputShowOptions represent options for a bundle output show command

func (*OutputShowOptions) Validate

func (o *OutputShowOptions) Validate(args []string, cxt *context.Context) error

Validate validates the provided args, using the provided context, setting attributes of OutputShowOptions as applicable

type ParameterDeleteOptions

type ParameterDeleteOptions struct {
	Name string
}

ParameterDeleteOptions represent options for Porter's parameter delete command

func (*ParameterDeleteOptions) Validate

func (o *ParameterDeleteOptions) Validate(args []string) error

Validate the args provided to the delete parameter command

type ParameterEditOptions

type ParameterEditOptions struct {
	Name string
}

ParameterEditOptions represent iptions for Porter's parameter edit command

func (*ParameterEditOptions) Validate

func (o *ParameterEditOptions) Validate(args []string) error

Validate validates the args provided to Porter's parameter edit command

type ParameterOptions

type ParameterOptions struct {
	BundleLifecycleOpts
	Silent bool
}

ParameterOptions represent generic/base options for a Porter parameters command

func (*ParameterOptions) Validate

func (g *ParameterOptions) Validate(args []string, cxt *context.Context) error

Validate prepares for an action and validates the options. For example, relative paths are converted to full paths and then checked that they exist and are accessible.

type ParameterShowOptions

type ParameterShowOptions struct {
	printer.PrintOptions
	Name string
}

ParameterShowOptions represent options for Porter's parameter show command

func (*ParameterShowOptions) Validate

func (o *ParameterShowOptions) Validate(args []string) error

Validate validates the args provided to Porter's parameter show command

type Porter

Porter is the logic behind the porter client.

func New

func New() *Porter

New porter client, initialized with useful defaults.

func NewWithConfig

func NewWithConfig(c *config.Config) *Porter

func (*Porter) Archive

func (p *Porter) Archive(opts ArchiveOptions) error

Archive is a composite function that generates a CNAB thick bundle. It will pull the invocation image, and any referenced images locally (if needed), export them to individual layers, generate a bundle.json and then generate a gzipped tar archive containing the bundle.json and the images

func (*Porter) Build

func (p *Porter) Build(opts BuildOptions) error

func (*Porter) CopyBundle

func (p *Porter) CopyBundle(c *CopyOpts) error

CopyBundle copies a bundle from one repository to another

func (*Porter) CopyTemplate

func (p *Porter) CopyTemplate(getTemplate func() ([]byte, error), dest string) error

func (*Porter) Create

func (p *Porter) Create() error

func (*Porter) CreateMixinFeedTemplate

func (p *Porter) CreateMixinFeedTemplate() error

func (*Porter) DeleteCredential

func (p *Porter) DeleteCredential(opts CredentialDeleteOptions) error

DeleteCredential deletes the credential set corresponding to the provided names.

func (*Porter) DeleteParameter

func (p *Porter) DeleteParameter(opts ParameterDeleteOptions) error

DeleteParameter deletes the parameter set corresponding to the provided names.

func (*Porter) EditCredential

func (p *Porter) EditCredential(opts CredentialEditOptions) error

EditCredential edits the credentials of the provided name.

func (*Porter) EditParameter

func (p *Porter) EditParameter(opts ParameterEditOptions) error

EditParameter edits the parameters of the provided name.

func (*Porter) Explain

func (p *Porter) Explain(o ExplainOpts) error

func (*Porter) GenerateCredentials

func (p *Porter) GenerateCredentials(opts CredentialOptions) error

GenerateCredentials builds a new credential set based on the given options. This can be either a silent build, based on the opts.Silent flag, or interactive using a survey. Returns an error if unable to generate credentials

func (*Porter) GenerateMixinFeed

func (p *Porter) GenerateMixinFeed(opts feed.GenerateOptions) error

func (*Porter) GenerateParameters

func (p *Porter) GenerateParameters(opts ParameterOptions) error

GenerateParameters builds a new parameter set based on the given options. This can be either a silent build, based on the opts.Silent flag, or interactive using a survey. Returns an error if unable to generate parameters

func (*Porter) GetManifestSchema

func (p *Porter) GetManifestSchema() (jsonSchema, error)

func (*Porter) GetPlugin

func (p *Porter) GetPlugin(name string) (*plugins.Metadata, error)

func (*Porter) GetReplacementSchema

func (p *Porter) GetReplacementSchema() (jsonSchema, error)

func (*Porter) Inspect

func (p *Porter) Inspect(o ExplainOpts) error

func (*Porter) InstallBundle

func (p *Porter) InstallBundle(opts InstallOptions) error

InstallBundle accepts a set of pre-validated InstallOptions and uses them to install a bundle.

func (*Porter) InstallMixin

func (p *Porter) InstallMixin(opts mixin.InstallOptions) error

func (*Porter) InstallPlugin

func (p *Porter) InstallPlugin(opts plugins.InstallOptions) error

func (*Porter) InvokeBundle

func (p *Porter) InvokeBundle(opts InvokeOptions) error

InvokeBundle accepts a set of pre-validated InvokeOptions and uses them to upgrade a bundle.

func (*Porter) IsBundleUpToDate

func (p *Porter) IsBundleUpToDate(opts bundleFileOptions) (bool, error)

IsBundleUpToDate checks the hash of the manifest against the hash in cnab/bundle.json.

func (*Porter) Lint

func (p *Porter) Lint(opts LintOptions) (linter.Results, error)

Lint porter.yaml for any problems and report the results. This calls the mixins to analyze their sections of the manifest.

func (*Porter) ListBundleOutputs

func (p *Porter) ListBundleOutputs(c claim.Claim, format printer.Format) []DisplayOutput

ListBundleOutputs lists the outputs for a given bundle, according to the provided claim and display format

func (*Porter) ListCredentials

func (p *Porter) ListCredentials(opts ListOptions) error

ListCredentials lists saved credential sets.

func (*Porter) ListInstances

func (p *Porter) ListInstances(opts ListOptions) error

ListInstances lists installed bundles by their claims.

func (*Porter) ListMixins

func (p *Porter) ListMixins() ([]mixin.Metadata, error)

func (*Porter) ListParameters

func (p *Porter) ListParameters(opts ListOptions) error

ListParameters lists saved parameter sets.

func (*Porter) ListPlugins

func (p *Porter) ListPlugins() ([]plugins.Metadata, error)

func (*Porter) LoadManifest

func (p *Porter) LoadManifest() error

func (*Porter) LoadManifestFrom

func (p *Porter) LoadManifestFrom(file string) error

func (*Porter) PrintBundleOutputs

func (p *Porter) PrintBundleOutputs(opts *OutputListOptions) error

func (*Porter) PrintDebugInfo

func (p *Porter) PrintDebugInfo(ctx *context.Context, opts VersionOpts, metadata pkgmgmt.Metadata) error

func (*Porter) PrintLintResults

func (p *Porter) PrintLintResults(opts LintOptions) error

PrintLintResults lints the manifest and prints the results to the attached output.

func (*Porter) PrintManifestSchema

func (p *Porter) PrintManifestSchema() error

func (*Porter) PrintMixins

func (p *Porter) PrintMixins(opts PrintMixinsOptions) error

func (*Porter) PrintPackages

func (p *Porter) PrintPackages(opts SearchOptions, list pkgmgmt.PackageList) error

PrintPackages prints the provided package list according to the provided options

func (*Porter) PrintPlugins

func (p *Porter) PrintPlugins(opts PrintPluginsOptions) error

func (*Porter) PrintVersion

func (p *Porter) PrintVersion(opts VersionOpts) error

func (*Porter) Publish

func (p *Porter) Publish(opts PublishOptions) error

Publish is a composite function that publishes an invocation image, rewrites the porter manifest and then regenerates the bundle.json. Finally it publishes the manifest to an OCI registry.

func (*Porter) PullBundle

func (p *Porter) PullBundle(opts BundlePullOptions) (cache.CachedBundle, error)

PullBundle looks for a given bundle tag in the bundle cache. If it is not found, it is pulled and stored in the cache. The path to the cached bundle is returned.

func (*Porter) ReadBundleOutput

func (p *Porter) ReadBundleOutput(name, claim string) (string, error)

ReadBundleOutput reads a bundle output from a claim

func (*Porter) Run

func (p *Porter) Run(opts RunOptions) error

func (*Porter) RunInternalPlugins

func (p *Porter) RunInternalPlugins(args []string)

func (*Porter) SearchPackages

func (p *Porter) SearchPackages(opts SearchOptions) error

SearchPackages searches the provided package list according to the provided options

func (*Porter) ShowBundleOutput

func (p *Porter) ShowBundleOutput(opts *OutputShowOptions) error

ShowBundleOutput shows a bundle output value, according to the provided options

func (*Porter) ShowCredential

func (p *Porter) ShowCredential(opts CredentialShowOptions) error

ShowCredential shows the credential set corresponding to the provided name, using the provided printer.PrintOptions for display.

func (*Porter) ShowInstances

func (p *Porter) ShowInstances(opts ShowOptions) error

ShowInstances shows a bundle, or more properly a bundle claim, along with any associated outputs

func (*Porter) ShowParameter

func (p *Porter) ShowParameter(opts ParameterShowOptions) error

ShowParameter shows the parameter set corresponding to the provided name, using the provided printer.PrintOptions for display.

func (*Porter) ShowPlugin

func (p *Porter) ShowPlugin(opts ShowPluginOptions) error

func (*Porter) UninstallBundle

func (p *Porter) UninstallBundle(opts UninstallOptions) error

UninstallBundle accepts a set of pre-validated UninstallOptions and uses them to uninstall a bundle.

func (*Porter) UninstallMixin

func (p *Porter) UninstallMixin(opts pkgmgmt.UninstallOptions) error

func (*Porter) UninstallPlugin

func (p *Porter) UninstallPlugin(opts pkgmgmt.UninstallOptions) error

func (*Porter) UpgradeBundle

func (p *Porter) UpgradeBundle(opts UpgradeOptions) error

UpgradeBundle accepts a set of pre-validated UpgradeOptions and uses them to upgrade a bundle.

type PrintMixinsOptions

type PrintMixinsOptions struct {
	printer.PrintOptions
}

PrintMixinsOptions represent options for the PrintMixins function

type PrintPluginsOptions

type PrintPluginsOptions struct {
	printer.PrintOptions
}

PrintPluginsOptions represent options for the PrintPlugins function

type PrintableAction

type PrintableAction struct {
	Name     string `json:"name" yaml:"name"`
	Modifies bool   `json:"modifies" yaml:"modifies"`
	// Stateless indicates that the action is purely informational, that credentials are not required, and that the runtime should not keep track of its invocation
	Stateless bool `json:"stateless" yaml:"stateless"`
	// Description describes the action as a user-readable string
	Description string `json:"description" yaml:"description"`
}

type PrintableBundle

type PrintableBundle struct {
	Name        string                `json:"name" yaml:"name"`
	Description string                `json:"description,omitempty" yaml:"description,omitempty"`
	Version     string                `json:"version" yaml:"version"`
	Parameters  []PrintableParameter  `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Credentials []PrintableCredential `json:"credentials,omitempty" yaml:"credentials,omitempty"`
	Outputs     []PrintableOutput     `json:"outputs,omitempty" yaml:"outputs,omitempty"`
	Actions     []PrintableAction     `json:"customActions,omitempty" yaml:"customActions,omitempty"`
}

PrintableBundle holds a subset of pertinent values to be explained from a bundle.Bundle

type PrintableCredential

type PrintableCredential struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description" yaml:"description"`
	Required    bool   `json:"required" yaml:"required"`
}

type PrintableImage

type PrintableImage struct {
	Name string `json:"name" yaml:"name"`
	bundle.Image
	Original string `json:"originalImage" yaml:"originalImage"`
}

type PrintableInvocationImage

type PrintableInvocationImage struct {
	bundle.InvocationImage
	Original string `json:"originalImage" yaml:"originalImage"`
}

type PrintableOutput

type PrintableOutput struct {
	Name        string      `json:"name" yaml:"name"`
	Type        interface{} `json:"type" yaml:"type"`
	ApplyTo     string      `json:"applyTo" yaml:"applyTo"`
	Description string      `json:"description" yaml:"description"`
}

type PrintableParameter

type PrintableParameter struct {
	Name        string      `json:"name" yaml:"name"`
	Type        interface{} `json:"type" yaml:"type"`
	Default     interface{} `json:"default" yaml:"default"`
	ApplyTo     string      `json:"applyTo" yaml:"applyTo"`
	Description string      `json:"description" yaml:"description"`
	Required    bool        `json:"required" yaml:"required"`
}

type PublishOptions

type PublishOptions struct {
	BundlePullOptions

	InsecureRegistry bool
	ArchiveFile      string
	// contains filtered or unexported fields
}

PublishOptions are options that may be specified when publishing a bundle. Porter handles defaulting any missing values.

func (*PublishOptions) Validate

func (o *PublishOptions) Validate(cxt *portercontext.Context) error

Validate performs validation on the publish options

type RunInternalPluginOpts

type RunInternalPluginOpts struct {
	Key string
	// contains filtered or unexported fields
}

func (*RunInternalPluginOpts) Validate

func (o *RunInternalPluginOpts) Validate(args []string, cfg *config.Config) error

type RunOptions

type RunOptions struct {
	File   string
	Action string
	// contains filtered or unexported fields
}

func NewRunOptions

func NewRunOptions(c *config.Config) RunOptions

func (*RunOptions) Validate

func (o *RunOptions) Validate() error

type SearchOptions

type SearchOptions struct {
	Name string
	Type string
	printer.PrintOptions
}

SearchOptions are options for searching packages

func (*SearchOptions) Validate

func (o *SearchOptions) Validate(args []string) error

Validate validates the arguments provided to a search command

type ShowOptions

type ShowOptions struct {
	printer.PrintOptions
	// contains filtered or unexported fields
}

ShowOptions represent options for showing a particular claim

func (*ShowOptions) Validate

func (so *ShowOptions) Validate(args []string, cxt *context.Context) error

Validate prepares for a show bundle action and validates the args/options.

type ShowPluginOptions

type ShowPluginOptions struct {
	printer.PrintOptions
	Name string
}

ShowPluginOptions represent options for showing a particular plugin.

func (*ShowPluginOptions) Validate

func (o *ShowPluginOptions) Validate(args []string) error

type SortPrintableAction

type SortPrintableAction []PrintableAction

func (SortPrintableAction) Len

func (s SortPrintableAction) Len() int

func (SortPrintableAction) Less

func (s SortPrintableAction) Less(i, j int) bool

func (SortPrintableAction) Swap

func (s SortPrintableAction) Swap(i, j int)

type SortPrintableCredential

type SortPrintableCredential []PrintableCredential

func (SortPrintableCredential) Len

func (s SortPrintableCredential) Len() int

func (SortPrintableCredential) Less

func (s SortPrintableCredential) Less(i, j int) bool

func (SortPrintableCredential) Swap

func (s SortPrintableCredential) Swap(i, j int)

type SortPrintableOutput

type SortPrintableOutput []PrintableOutput

func (SortPrintableOutput) Len

func (s SortPrintableOutput) Len() int

func (SortPrintableOutput) Less

func (s SortPrintableOutput) Less(i, j int) bool

func (SortPrintableOutput) Swap

func (s SortPrintableOutput) Swap(i, j int)

type SortPrintableParameter

type SortPrintableParameter []PrintableParameter

func (SortPrintableParameter) Len

func (s SortPrintableParameter) Len() int

func (SortPrintableParameter) Less

func (s SortPrintableParameter) Less(i, j int) bool

func (SortPrintableParameter) Swap

func (s SortPrintableParameter) Swap(i, j int)

type SystemDebugInfo

type SystemDebugInfo struct {
	Version pkgmgmt.PackageMetadata `json:"version"`
	SysInfo SystemInfo              `json:"system"`
	Mixins  Mixins                  `json:"mixins"`
}

type SystemInfo

type SystemInfo struct {
	OS   string
	Arch string
}

type TestBuildProvider

type TestBuildProvider struct{}

func NewTestBuildProvider

func NewTestBuildProvider() *TestBuildProvider

func (*TestBuildProvider) BuildInvocationImage

func (t *TestBuildProvider) BuildInvocationImage(manifest *manifest.Manifest) error

type TestPorter

type TestPorter struct {
	*Porter
	TestConfig      *config.TestConfig
	TestCredentials *credentials.TestCredentialProvider
	TestParameters  *parameters.TestParameterProvider
	TestCache       *cache.TestCache

	// original directory where the test was being executed
	TestDir string

	// directory where the integration test is being executed
	BundleDir string
	// contains filtered or unexported fields
}

func NewTestPorter

func NewTestPorter(t *testing.T) *TestPorter

NewTestPorter initializes a porter test client, with the output buffered, and an in-memory file system.

func (*TestPorter) CleanupIntegrationTest

func (p *TestPorter) CleanupIntegrationTest()

func (*TestPorter) CreateBundleDir

func (p *TestPorter) CreateBundleDir() string

func (*TestPorter) SetupIntegrationTest

func (p *TestPorter) SetupIntegrationTest()

func (*TestPorter) T

func (p *TestPorter) T() *testing.T

func (*TestPorter) UseFilesystem

func (p *TestPorter) UseFilesystem() string

UseFilesystem has porter's context use the OS filesystem instead of an in-memory filesystem Returns the temp porter home directory created for the test

type UninstallOptions

type UninstallOptions struct {
	BundleLifecycleOpts
}

UninstallOptions that may be specified when uninstalling a bundle. Porter handles defaulting any missing values.

type UpgradeOptions

type UpgradeOptions struct {
	BundleLifecycleOpts
}

UpgradeOptions that may be specified when upgrading a bundle. Porter handles defaulting any missing values.

type VersionOpts

type VersionOpts struct {
	version.Options
	System bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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