Documentation ¶
Index ¶
- Constants
- Variables
- func GetCredentialSourceValueAndType(cs credentials.Source) (string, string)
- func NewTemplatesBox() *packr.Box
- type ActionInput
- type BuildOptions
- type BundleLifecycleOpts
- type BundlePullOptions
- type BundleResolver
- type CNABProvider
- type CondensedClaim
- type CondensedClaimList
- type CredentialOptions
- type CredentialShowOptions
- type CredentialsFile
- type CredentialsFileList
- type InstallOptions
- type InvokeOptions
- type ListOptions
- type MixinProvider
- type OutputListOptions
- type OutputShowOptions
- type Porter
- func (p *Porter) ApplyBundleOutputs(opts RunOptions, outputs map[string]string) error
- func (p *Porter) Build(opts BuildOptions) error
- func (p *Porter) CopyTemplate(getTemplate func() ([]byte, error), dest string) error
- func (p *Porter) Create() error
- func (p *Porter) CreateMixinFeedTemplate() error
- func (p *Porter) GenerateCredentials(opts CredentialOptions) error
- func (p *Porter) GenerateMixinFeed(opts feed.GenerateOptions) error
- func (p *Porter) GetManifestSchema() (jsonSchema, error)
- func (p *Porter) GetReplacementSchema() (jsonSchema, error)
- func (p *Porter) InstallBundle(opts InstallOptions) error
- func (p *Porter) InstallMixin(opts mixin.InstallOptions) error
- func (p *Porter) InvokeBundle(opts InvokeOptions) error
- func (p *Porter) IsBundleUpToDate(opts bundleFileOptions) (bool, error)
- func (p *Porter) ListBundleOutputs(opts *OutputListOptions) error
- func (p *Porter) ListCredentials(opts ListOptions) error
- func (p *Porter) ListInstances(opts ListOptions) error
- func (p *Porter) PrintManifestSchema() error
- func (p *Porter) PrintMixins(opts PrintMixinsOptions) error
- func (p *Porter) PrintVersion(opts VersionOptions) error
- func (p *Porter) Publish(opts PublishOptions) error
- func (p *Porter) PullBundle(opts BundlePullOptions) (string, error)
- func (p *Porter) Run(opts RunOptions) error
- func (p *Porter) ShowBundleOutput(opts *OutputShowOptions) error
- func (p *Porter) ShowCredential(opts CredentialShowOptions) error
- func (p *Porter) ShowInstances(opts ShowOptions) error
- func (p *Porter) UninstallBundle(opts UninstallOptions) error
- func (p *Porter) UpgradeBundle(opts UpgradeOptions) error
- type PrintMixinsOptions
- type PublishOptions
- type Registry
- type RunOptions
- type ShowOptions
- type Templates
- func (t *Templates) GetDockerfile() ([]byte, error)
- func (t *Templates) GetDockerfileTemplate() ([]byte, error)
- func (t *Templates) GetDockerignore() ([]byte, error)
- func (t *Templates) GetGitignore() ([]byte, error)
- func (t *Templates) GetManifest() ([]byte, error)
- func (t *Templates) GetReadme() ([]byte, error)
- func (t *Templates) GetRunScript() ([]byte, error)
- func (t *Templates) GetSchema() ([]byte, error)
- type TestCNABProvider
- func (t *TestCNABProvider) CreateClaim(claim *claim.Claim) error
- func (t *TestCNABProvider) FetchClaim(name string) (*claim.Claim, error)
- func (t *TestCNABProvider) Install(arguments cnabprovider.ActionArguments) error
- func (t *TestCNABProvider) Invoke(action string, arguments cnabprovider.ActionArguments) error
- func (t *TestCNABProvider) LoadBundle(bundleFile string, insecure bool) (*bundle.Bundle, error)
- func (t *TestCNABProvider) Uninstall(arguments cnabprovider.ActionArguments) error
- func (t *TestCNABProvider) Upgrade(arguments cnabprovider.ActionArguments) error
- type TestMixinProvider
- type TestPorter
- type UninstallOptions
- type UpgradeOptions
- type VersionOptions
Constants ¶
const DefaultDriver = "docker"
Variables ¶
var BUNDLE_DIR string = "/cnab/app"
BUNDLE_DIR is the directory where the bundle is located in the CNAB execution environment.
var DefaultVersionFormat = printer.FormatPlaintext
Functions ¶
func GetCredentialSourceValueAndType ¶
func GetCredentialSourceValueAndType(cs credentials.Source) (string, string)
GetCredentialSourceValueAndType takes a given credentials.Source struct and returns the source value itself as well as source type, e.g., 'Path', 'EnvVar', etc., both in their string forms
func NewTemplatesBox ¶
func NewTemplatesBox() *packr.Box
NewSchemas creates or retrieves the packr box with the porter template files.
Types ¶
type ActionInput ¶
type ActionInput struct { Steps []*config.Step `yaml:"steps"` // contains filtered or unexported fields }
func (*ActionInput) MarshalYAML ¶
func (a *ActionInput) MarshalYAML() (interface{}, error)
MarshalYAML marshals the step nested under the action install:
- helm: ...
Solution from https://stackoverflow.com/a/42547226
type BuildOptions ¶
type BuildOptions struct {
// contains filtered or unexported fields
}
type BundleLifecycleOpts ¶
type BundleLifecycleOpts struct { BundlePullOptions // contains filtered or unexported fields }
func (*BundleLifecycleOpts) ToDuffleArgs ¶
func (o *BundleLifecycleOpts) ToDuffleArgs(deperator *dependencyExecutioner) cnabprovider.ActionArguments
ToDuffleArgs converts this instance of user-provided action options to duffle action arguments.
type BundlePullOptions ¶
type BundleResolver ¶
type BundleResolver struct { Cache cache.BundleCache Registry Registry }
func (*BundleResolver) Resolve ¶
func (r *BundleResolver) Resolve(opts BundlePullOptions) (string, error)
Resolves a bundle from the cache, or pulls it and caches it Returns the location of the bundle or an error
type CNABProvider ¶
type CNABProvider interface { LoadBundle(bundleFile string, insecure bool) (*bundle.Bundle, error) Install(arguments cnabprovider.ActionArguments) error Upgrade(arguments cnabprovider.ActionArguments) error Invoke(action string, arguments cnabprovider.ActionArguments) error Uninstall(arguments cnabprovider.ActionArguments) error FetchClaim(name string) (*claim.Claim, error) }
CNABProvider
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 CredentialOptions ¶
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 Porter's credential show command
type CredentialsFile ¶
CredentialsFile represents a CNAB credentials file and corresponding metadata
type CredentialsFileList ¶
type CredentialsFileList []CredentialsFile
CredentialsFileList is a slice of CredentialsFiles
func (CredentialsFileList) Len ¶
func (l CredentialsFileList) Len() int
func (CredentialsFileList) Less ¶
func (l CredentialsFileList) Less(i, j int) bool
func (CredentialsFileList) Swap ¶
func (l CredentialsFileList) Swap(i, j int)
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.
type ListOptions ¶
type ListOptions struct {
printer.PrintOptions
}
ListOptions represent generic options for use by Porter's list commands
type MixinProvider ¶
type MixinProvider interface { List() ([]mixin.Metadata, error) GetSchema(m mixin.Metadata) (string, error) GetVersion(m mixin.Metadata) (string, error) Install(opts mixin.InstallOptions) (mixin.Metadata, error) }
MixinProvider handles searching, listing and communicating with the mixins.
type OutputListOptions ¶
type OutputListOptions struct { printer.PrintOptions // contains filtered or unexported fields }
OutputListOptions represent options for a bundle output list command
type OutputShowOptions ¶
type OutputShowOptions struct { Output string // contains filtered or unexported fields }
OutputShowOptions represent options for a bundle output show command
type Porter ¶
type Porter struct { *config.Config Cache cache.BundleCache Registry Registry Templates *Templates Mixins MixinProvider CNAB CNABProvider }
Porter is the logic behind the porter client.
func (*Porter) ApplyBundleOutputs ¶
func (p *Porter) ApplyBundleOutputs(opts RunOptions, outputs map[string]string) error
ApplyBundleOutputs writes the provided outputs to the proper location in the execution environment
func (*Porter) Build ¶
func (p *Porter) Build(opts BuildOptions) error
func (*Porter) CopyTemplate ¶
func (*Porter) CreateMixinFeedTemplate ¶
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) GetManifestSchema ¶
func (*Porter) GetReplacementSchema ¶
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) 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 ¶
IsBundleUpToDate checks the hash of the manifest against the hash in cnab/bundle.json.
func (*Porter) ListBundleOutputs ¶
func (p *Porter) ListBundleOutputs(opts *OutputListOptions) error
ListBundleOutputs lists the outputs for a given bundle, according to the provided options
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) PrintManifestSchema ¶
func (*Porter) PrintMixins ¶
func (p *Porter) PrintMixins(opts PrintMixinsOptions) error
func (*Porter) PrintVersion ¶
func (p *Porter) PrintVersion(opts VersionOptions) 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) (string, 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) Run ¶
func (p *Porter) Run(opts RunOptions) error
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) 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) 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 PublishOptions ¶
type PublishOptions struct { InsecureRegistry bool // 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 Registry ¶
type Registry interface { // PullBundle pulls a bundle from an OCI registry. PullBundle(tag string, insecureRegistry bool) (*bundle.Bundle, error) // PushBundle pushes a bundle to an OCI registry. PushBundle(bun *bundle.Bundle, tag string, insecureRegistry bool) error // PushInvocationImage pushes the invocation image from the Docker image cache to the specified location // the expected format of the invocationImage is REGISTRY/NAME:TAG. // Returns the image digest from the registry. PushInvocationImage(invocationImage string) (string, error) }
Registry handles talking with an OCI registry.
type RunOptions ¶
func NewRunOptions ¶
func NewRunOptions(c *config.Config) RunOptions
func (*RunOptions) Validate ¶
func (o *RunOptions) Validate() error
type ShowOptions ¶
type ShowOptions struct { printer.PrintOptions // contains filtered or unexported fields }
ShowOptions represent options for showing a particular claim
type Templates ¶
type Templates struct {
// contains filtered or unexported fields
}
func NewTemplates ¶
func NewTemplates() *Templates
func (*Templates) GetDockerfile ¶
GetDockerfile returns the default Dockerfile for invocation images.
func (*Templates) GetDockerfileTemplate ¶
GetDockerfileTemplate returns a Dockerfile.tmpl file for use in new bundles.
func (*Templates) GetDockerignore ¶
GetDockerignore returns a .dockerignore file for use in new bundles.
func (*Templates) GetGitignore ¶
GetGitignore returns a .gitignore file for use in new bundles.
func (*Templates) GetManifest ¶
GetManifest returns a porter.yaml template file for use in new bundles.
func (*Templates) GetRunScript ¶
GetRunScript returns a run script template for invocation images.
type TestCNABProvider ¶
func NewTestCNABProvider ¶
func NewTestCNABProvider() *TestCNABProvider
func (*TestCNABProvider) CreateClaim ¶
func (t *TestCNABProvider) CreateClaim(claim *claim.Claim) error
func (*TestCNABProvider) FetchClaim ¶
func (t *TestCNABProvider) FetchClaim(name string) (*claim.Claim, error)
func (*TestCNABProvider) Install ¶
func (t *TestCNABProvider) Install(arguments cnabprovider.ActionArguments) error
func (*TestCNABProvider) Invoke ¶
func (t *TestCNABProvider) Invoke(action string, arguments cnabprovider.ActionArguments) error
func (*TestCNABProvider) LoadBundle ¶
func (*TestCNABProvider) Uninstall ¶
func (t *TestCNABProvider) Uninstall(arguments cnabprovider.ActionArguments) error
func (*TestCNABProvider) Upgrade ¶
func (t *TestCNABProvider) Upgrade(arguments cnabprovider.ActionArguments) error
type TestMixinProvider ¶
type TestMixinProvider struct { }
TODO: use this later to not actually execute a mixin during a unit test
func (*TestMixinProvider) GetSchema ¶
func (p *TestMixinProvider) GetSchema(m mixin.Metadata) (string, error)
func (*TestMixinProvider) GetVersion ¶
func (p *TestMixinProvider) GetVersion(m mixin.Metadata) (string, error)
func (*TestMixinProvider) Install ¶
func (p *TestMixinProvider) Install(o mixin.InstallOptions) (mixin.Metadata, error)
type TestPorter ¶
type TestPorter struct { *Porter TestConfig *config.TestConfig // original directory where the test was being executed TestDir 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) SetupIntegrationTest ¶
func (p *TestPorter) SetupIntegrationTest()
func (*TestPorter) T ¶
func (p *TestPorter) T() *testing.T
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 VersionOptions ¶
type VersionOptions struct {
printer.PrintOptions
}
VersionOptions represent generic options for use by Porter's list commands
func (*VersionOptions) Validate ¶
func (o *VersionOptions) Validate() error