Documentation ¶
Index ¶
- Constants
- Variables
- func GetCoreActions() []string
- func GetParameterSourceForDependency(ref DependencyOutputReference) string
- func GetParameterSourceForOutput(outputName string) string
- func IsCoreAction(value string) bool
- func ParamToEnvVar(name string) string
- func ReadManifestData(cxt *portercontext.Context, path string) ([]byte, error)
- func ResolvePath(value string) string
- type BundleCriteria
- type BundleOutput
- type CredentialDefinition
- type CredentialDefinitions
- type CustomActionDefinition
- type CustomDefinitions
- type Dependencies
- type Dependency
- type DependencyOutputReference
- type DependencyOutputReferences
- type Location
- type MaintainerDefinition
- type Manifest
- func (m *Manifest) GetTemplatePrefix() string
- func (m *Manifest) GetTemplatedDependencyOutputs() DependencyOutputReferences
- func (m *Manifest) GetTemplatedOutputs() OutputDefinitions
- func (m *Manifest) SetDefaults() error
- func (m *Manifest) SetInvocationImageAndReference(ref string) error
- func (m *Manifest) Validate(cxt *portercontext.Context, strategy schema.CheckStrategy) error
- type MappedImage
- type MixinDeclaration
- type OutputDefinition
- type OutputDefinitions
- type ParameterDefinition
- type ParameterDefinitions
- type ParameterSource
- type RequiredExtension
- type StateBag
- type StateVariable
- type Step
- type Steps
Constants ¶
const ( // TemplateDelimiterPrefix must be present at the beginning of any porter.yaml // that wants to use ${} as the template delimiter instead of the mustache // default of {{}}. TemplateDelimiterPrefix = "{{=${ }=}}\n" )
Variables ¶
var (
// SupportedSchemaVersions is the Porter manifest (porter.yaml) schema
// versions supported by this version of Porter, specified as a semver range.
// When the Manifest structure is changed, this field should be incremented.
SupportedSchemaVersions, _ = semver.NewConstraint("1.0.0-alpha.1 || 1.0.0")
// DefaultSchemaVersion is the most recently supported schema version.
// When the Manifest structure is changed, this field should be incremented.
DefaultSchemaVersion = semver.MustParse("1.0.0")
)
Functions ¶
func GetCoreActions ¶
func GetCoreActions() []string
func GetParameterSourceForDependency ¶ added in v0.28.0
func GetParameterSourceForDependency(ref DependencyOutputReference) string
GetParameterSourceForDependency builds the parameter source name used by Porter internally for wiring up an dependency's output to a parameter.
func GetParameterSourceForOutput ¶ added in v0.28.0
GetParameterSourceForOutput builds the parameter source name used by Porter internally for wiring up an output to a parameter.
func IsCoreAction ¶
IsCoreAction determines if the value is a core action from the CNAB spec.
func ParamToEnvVar ¶ added in v0.28.0
Convert a parameter name to an environment variable. Anything more complicated should define the variable explicitly.
func ReadManifestData ¶
func ReadManifestData(cxt *portercontext.Context, path string) ([]byte, error)
func ResolvePath ¶ added in v1.0.1
ResolvePath resolves a path specified in the Porter manifest into an absolute path, assuming the current directory is /cnab/app. Returns an empty string when the specified value is empty.
Types ¶
type BundleCriteria ¶ added in v1.0.1
type BundleCriteria struct { // Reference is the full bundle reference for the dependency // in the format REGISTRY/NAME:TAG Reference string `yaml:"reference"` // "When constraint checking is used for checks or validation // it will follow a different set of rules that are common for ranges with tools like npm/js and Rust/Cargo. // This includes considering prereleases to be invalid if the ranges does not include one. // If you want to have it include pre-releases a simple solution is to include -0 in your range." // https://github.com/Masterminds/semver/blob/master/README.md#checking-version-constraints Version string `yaml:"version,omitempty"` }
type BundleOutput ¶
type CredentialDefinition ¶
type CredentialDefinition struct { Name string `yaml:"name"` Description string `yaml:"description,omitempty"` // Required specifies if the credential must be specified for applicable actions. Defaults to true. Required bool `yaml:"required,omitempty"` // ApplyTo lists the actions to which the credential applies. When unset, defaults to all actions. ApplyTo []string `yaml:"applyTo,omitempty"` Location `yaml:",inline"` }
CredentialDefinition represents the structure or fields of a credential parameter
func (*CredentialDefinition) UnmarshalYAML ¶
func (cd *CredentialDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
type CredentialDefinitions ¶ added in v0.28.0
type CredentialDefinitions map[string]CredentialDefinition
CredentialDefinitions allows us to represent credentials as a list in the YAML and work with them as a map internally
func (CredentialDefinitions) MarshalYAML ¶ added in v0.28.0
func (cd CredentialDefinitions) MarshalYAML() (interface{}, error)
func (*CredentialDefinitions) UnmarshalYAML ¶ added in v0.28.0
func (cd *CredentialDefinitions) UnmarshalYAML(unmarshal func(interface{}) error) error
type CustomActionDefinition ¶
type CustomDefinitions ¶ added in v0.35.0
type CustomDefinitions map[string]interface{}
func (*CustomDefinitions) UnmarshalYAML ¶ added in v0.35.0
func (cd *CustomDefinitions) UnmarshalYAML(unmarshal func(interface{}) error) error
type Dependencies ¶ added in v1.0.1
type Dependencies struct {
Requires []*Dependency `yaml:"requires,omitempty"`
}
type Dependency ¶
type Dependency struct { Name string `yaml:"name"` Bundle BundleCriteria `yaml:"bundle"` Parameters map[string]string `yaml:"parameters,omitempty"` }
func (*Dependency) Validate ¶
func (d *Dependency) Validate(cxt *portercontext.Context) error
type DependencyOutputReference ¶ added in v0.28.0
func (DependencyOutputReference) String ¶ added in v0.28.0
func (r DependencyOutputReference) String() string
type DependencyOutputReferences ¶ added in v0.28.0
type DependencyOutputReferences map[string]DependencyOutputReference
type Location ¶
type Location struct { Path string `yaml:"path,omitempty"` EnvironmentVariable string `yaml:"env,omitempty"` }
Location represents a Parameter or Credential location in an InvocationImage
type MaintainerDefinition ¶ added in v1.0.1
type Manifest ¶
type Manifest struct { // ManifestPath is location to the original, user-supplied manifest, such as the path on the filesystem or a url ManifestPath string `yaml:"-"` // TemplateVariables are the variables used in the templating, e.g. bundle.parameters.NAME, or bundle.outputs.NAME TemplateVariables []string `yaml:"-"` // SchemaVersion is a semver value that indicates which version of the porter.yaml schema is used in the file. SchemaVersion string `yaml:"schemaVersion"` Name string `yaml:"name,omitempty"` Description string `yaml:"description,omitempty"` Version string `yaml:"version,omitempty"` Maintainers []MaintainerDefinition `yaml:"maintainers,omitempty"` // Registry is the OCI registry and org/subdomain for the bundle Registry string `yaml:"registry,omitempty"` // Reference is the optional, full bundle reference // in the format REGISTRY/NAME or REGISTRY/NAME:TAG Reference string `yaml:"reference,omitempty"` // DockerTag is the Docker tag portion of the published invocation // image and bundle. It will only be set at time of publishing. DockerTag string `yaml:"-"` // Image is the name of the invocation image in the format REGISTRY/NAME:TAG // It doesn't map to any field in the manifest as it has been deprecated // and isn't meant to be user-specified Image string `yaml:"-"` // Dockerfile is the relative path to the Dockerfile template for the invocation image Dockerfile string `yaml:"dockerfile,omitempty"` Mixins []MixinDeclaration `yaml:"mixins,omitempty"` Install Steps `yaml:"install"` Uninstall Steps `yaml:"uninstall"` Upgrade Steps `yaml:"upgrade"` Custom CustomDefinitions `yaml:"custom,omitempty"` CustomActions map[string]Steps `yaml:"-"` CustomActionDefinitions map[string]CustomActionDefinition `yaml:"customActions,omitempty"` StateBag StateBag `yaml:"state,omitempty"` Parameters ParameterDefinitions `yaml:"parameters,omitempty"` Credentials CredentialDefinitions `yaml:"credentials,omitempty"` Dependencies Dependencies `yaml:"dependencies,omitempty"` Outputs OutputDefinitions `yaml:"outputs,omitempty"` // ImageMap is a map of images referenced in the bundle. If an image relocation mapping is later provided, that // will be mounted at as a file at runtime to /cnab/app/relocation-mapping.json. ImageMap map[string]MappedImage `yaml:"images,omitempty"` Required []RequiredExtension `yaml:"required,omitempty"` }
func LoadManifestFrom ¶
LoadManifestFrom reads and validates the manifest at the specified location, and returns a populated Manifest structure.
func ReadManifest ¶
func ReadManifest(cxt *portercontext.Context, path string) (*Manifest, error)
ReadManifest determines if specified path is a URL or a filepath. After reading the data in the path it returns a Manifest and any errors
func UnmarshalManifest ¶
func UnmarshalManifest(cxt *portercontext.Context, manifestData []byte) (*Manifest, error)
func (*Manifest) GetTemplatePrefix ¶ added in v1.0.1
func (*Manifest) GetTemplatedDependencyOutputs ¶ added in v0.28.0
func (m *Manifest) GetTemplatedDependencyOutputs() DependencyOutputReferences
GetTemplatedOutputs returns the output definitions for any bundle level outputs that have been templated, keyed by "DEPENDENCY.OUTPUT".
func (*Manifest) GetTemplatedOutputs ¶ added in v0.28.0
func (m *Manifest) GetTemplatedOutputs() OutputDefinitions
GetTemplatedOutputs returns the output definitions for any bundle level outputs that have been templated, keyed by the output name.
func (*Manifest) SetDefaults ¶
SetDefaults updates the manifest with default values where not populated
func (*Manifest) SetInvocationImageAndReference ¶ added in v0.30.0
SetInvocationImageAndReference sets the invocation image name and the bundle reference on the manifest per the provided reference or via the registry or name values on the manifest.
func (*Manifest) Validate ¶
func (m *Manifest) Validate(cxt *portercontext.Context, strategy schema.CheckStrategy) error
type MappedImage ¶
type MappedImage struct { Description string `yaml:"description"` ImageType string `yaml:"imageType"` Repository string `yaml:"repository"` Digest string `yaml:"digest,omitempty"` Size uint64 `yaml:"size,omitempty"` MediaType string `yaml:"mediaType,omitempty"` Labels map[string]string `yaml:"labels,omitempty"` Tag string `yaml:"tag,omitempty"` }
func (*MappedImage) ToOCIReference ¶ added in v1.0.1
func (mi *MappedImage) ToOCIReference() (cnab.OCIReference, error)
func (*MappedImage) Validate ¶
func (mi *MappedImage) Validate() error
type MixinDeclaration ¶
type MixinDeclaration struct { Name string Config interface{} }
func (MixinDeclaration) MarshalYAML ¶
func (m MixinDeclaration) MarshalYAML() (interface{}, error)
MarshalYAML allows mixin declarations to either be a normal list of strings mixins: - exec - helm3 or allow some entries to have config data defined
- az: extensions:
- iot
func (*MixinDeclaration) UnmarshalYAML ¶
func (m *MixinDeclaration) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML allows mixin declarations to either be a normal list of strings mixins: - exec - helm3 or allow some entries to have config data defined
- az: extensions:
- iot
type OutputDefinition ¶
type OutputDefinition struct { Name string `yaml:"name"` ApplyTo []string `yaml:"applyTo,omitempty"` Sensitive bool `yaml:"sensitive"` // This is not in the CNAB spec, but it allows a mixin to create a file // and porter will take care of making it a proper output. Path string `yaml:"path,omitempty"` definition.Schema `yaml:",inline"` // IsState identifies if the output was generated from a state variable IsState bool `yaml:"-"` }
OutputDefinition defines a single output for a CNAB
func (*OutputDefinition) DeepCopy ¶
func (od *OutputDefinition) DeepCopy() *OutputDefinition
DeepCopy copies a ParameterDefinition and returns the copy
func (*OutputDefinition) Validate ¶
func (od *OutputDefinition) Validate() error
type OutputDefinitions ¶ added in v0.28.0
type OutputDefinitions map[string]OutputDefinition
OutputDefinitions allows us to represent parameters as a list in the YAML and work with them as a map internally
func (OutputDefinitions) MarshalYAML ¶ added in v0.28.0
func (od OutputDefinitions) MarshalYAML() (interface{}, error)
func (*OutputDefinitions) UnmarshalYAML ¶ added in v0.28.0
func (od *OutputDefinitions) UnmarshalYAML(unmarshal func(interface{}) error) error
type ParameterDefinition ¶
type ParameterDefinition struct { Name string `yaml:"name"` Sensitive bool `yaml:"sensitive"` Source ParameterSource `yaml:"source,omitempty"` // These fields represent a subset of bundle.Parameter as defined in cnabio/cnab-go, // minus the 'Description' field (definition.Schema's will be used) and `Definition` field ApplyTo []string `yaml:"applyTo,omitempty"` Destination Location `yaml:",inline,omitempty"` definition.Schema `yaml:",inline"` // IsState identifies if the parameter was generated from a state variable IsState bool `yaml:"-"` }
ParameterDefinition defines a single parameter for a CNAB bundle
func (*ParameterDefinition) AppliesTo ¶
func (pd *ParameterDefinition) AppliesTo(action string) bool
AppliesTo returns a boolean value specifying whether or not the Parameter applies to the provided action
func (*ParameterDefinition) DeepCopy ¶
func (pd *ParameterDefinition) DeepCopy() *ParameterDefinition
DeepCopy copies a ParameterDefinition and returns the copy
func (*ParameterDefinition) GetApplyTo ¶ added in v0.38.4
func (pd *ParameterDefinition) GetApplyTo() []string
func (*ParameterDefinition) UpdateApplyTo ¶ added in v0.28.0
func (pd *ParameterDefinition) UpdateApplyTo(m *Manifest)
UpdateApplyTo updates a parameter definition's applyTo section based on the provided manifest
func (*ParameterDefinition) Validate ¶
func (pd *ParameterDefinition) Validate() error
type ParameterDefinitions ¶ added in v0.28.0
type ParameterDefinitions map[string]ParameterDefinition
ParameterDefinitions allows us to represent parameters as a list in the YAML and work with them as a map internally
func (ParameterDefinitions) MarshalYAML ¶ added in v0.28.0
func (pd ParameterDefinitions) MarshalYAML() (interface{}, error)
func (*ParameterDefinitions) UnmarshalYAML ¶ added in v0.28.0
func (pd *ParameterDefinitions) UnmarshalYAML(unmarshal func(interface{}) error) error
type ParameterSource ¶ added in v0.28.0
type RequiredExtension ¶
RequiredExtension represents a custom extension that is required in order for a bundle to work correctly
func (*RequiredExtension) UnmarshalYAML ¶
func (r *RequiredExtension) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML allows required extensions to either be a normal list of strings required: - docker or allow some entries to have config data defined
- vpn: name: mytrustednetwork
type StateBag ¶ added in v1.0.1
type StateBag []StateVariable
StateBag is the set of state files and variables that Porter should track between bundle executions.
type StateVariable ¶ added in v1.0.1
type StateVariable struct { // Name of the state variable Name string `yaml:"name"` // Description of the state variable and how it's used by the bundle Description string `yaml:"description,omitempty"` // Mixin is the name of the mixin that manages the state variable. Mixin string `yaml:"mixin,omitempty"` // Location defines where the state variable is located in the bundle. Location `yaml:",inline"` }
type Step ¶
type Step struct {
Data map[string]interface{} `yaml:",inline"`
}
func (*Step) GetDescription ¶
GetDescription returns a description of the step. Every step must have this property.