Documentation ¶
Index ¶
- Constants
- Variables
- func CNABSchemaVersion() schema.Version
- func DockerExtensionReader(bun ExtendedBundle) (interface{}, error)
- func FileParameterReader(b ExtendedBundle) (interface{}, error)
- func ParameterSourcesReader(bun ExtendedBundle) (interface{}, error)
- func WriteParameterToString(paramName string, value interface{}) (string, error)
- type BundleReference
- type Claim
- type DependencyLock
- type DependencyOutputParameterSource
- type DependencySolver
- type Docker
- type ExtendedBundle
- func (b ExtendedBundle) ConvertParameterValue(key string, value interface{}) (interface{}, error)
- func (b ExtendedBundle) DependencyV1Reader() (interface{}, error)
- func (b ExtendedBundle) DockerExtensionReader() (interface{}, error)
- func (b ExtendedBundle) FileParameterReader() (interface{}, error)
- func (b ExtendedBundle) GetParameterType(def *definition.Schema) string
- func (b ExtendedBundle) HasDependenciesV1() bool
- func (b ExtendedBundle) HasParameterSources() bool
- func (b ExtendedBundle) IsFileType(def *definition.Schema) bool
- func (b ExtendedBundle) IsInternalOutput(name string) bool
- func (b ExtendedBundle) IsInternalParameter(name string) bool
- func (b ExtendedBundle) IsPorterBundle() bool
- func (b ExtendedBundle) IsSensitiveParameter(param string) bool
- func (b ExtendedBundle) ParameterHasSource(paramName string) bool
- func (b ExtendedBundle) ParameterSourcesReader() (interface{}, error)
- func (b ExtendedBundle) ProcessRequiredExtensions() (ProcessedExtensions, error)
- func (b ExtendedBundle) ReadDependenciesV1() (depsv1.Dependencies, error)
- func (b ExtendedBundle) ReadParameterSources() (ParameterSources, error)
- func (b ExtendedBundle) SupportsDependenciesV1() bool
- func (b ExtendedBundle) SupportsDocker() bool
- func (b ExtendedBundle) SupportsExtension(key string) bool
- func (b ExtendedBundle) SupportsFileParameters() bool
- func (b ExtendedBundle) SupportsParameterSources() bool
- func (b ExtendedBundle) WriteParameterToString(paramName string, value interface{}) (string, error)
- type Installation
- type OCIReference
- func (r OCIReference) Digest() digest.Digest
- func (r OCIReference) HasDigest() bool
- func (r OCIReference) HasTag() bool
- func (r OCIReference) HasVersion() bool
- func (r OCIReference) IsRepositoryOnly() bool
- func (r OCIReference) MarshalJSON() ([]byte, error)
- func (r OCIReference) ParseRepositoryInfo() (*registry.RepositoryInfo, error)
- func (r OCIReference) Registry() string
- func (r OCIReference) Repository() string
- func (r OCIReference) String() string
- func (r OCIReference) Tag() string
- func (r *OCIReference) UnmarshalJSON(bytes []byte) error
- func (r OCIReference) Version() string
- func (r OCIReference) WithDigest(digest digest.Digest) (OCIReference, error)
- func (r OCIReference) WithTag(tag string) (OCIReference, error)
- func (r OCIReference) WithVersion(version string) (OCIReference, error)
- type Output
- type OutputMetadata
- type OutputParameterSource
- type Outputs
- type ParameterSource
- type ParameterSourceDefinition
- type ParameterSourceMap
- type ParameterSources
- type ProcessedExtensions
- type RequiredExtension
- type Result
Constants ¶
const ( ActionInstall = cnabclaims.ActionInstall ActionUpgrade = cnabclaims.ActionUpgrade ActionUninstall = cnabclaims.ActionUninstall ActionUnknown = cnabclaims.ActionUnknown StatusSucceeded = cnabclaims.StatusSucceeded StatusCanceled = cnabclaims.StatusCanceled StatusFailed = cnabclaims.StatusFailed StatusRunning = cnabclaims.StatusRunning StatusPending = cnabclaims.StatusPending StatusUnknown = cnabclaims.StatusUnknown OutputInvocationImageLogs = cnabclaims.OutputInvocationImageLogs )
const ( // DependenciesV1ExtensionShortHand is the short suffix of the DependenciesV1ExtensionKey DependenciesV1ExtensionShortHand = "dependencies" // DependenciesV1ExtensionKey represents the full key for the DependenciesV1Extension. DependenciesV1ExtensionKey = OfficialExtensionsPrefix + DependenciesV1ExtensionShortHand // DependenciesV1Schema represents the schema for the Dependencies Extension DependenciesV1Schema = "https://cnab.io/v1/dependencies.schema.json" )
const ( // DockerExtensionShortHand is the short suffix of the DockerExtensionKey. DockerExtensionShortHand = "docker" // DockerExtensionKey represents the full key for the Docker Extension DockerExtensionKey = OfficialExtensionsPrefix + DockerExtensionShortHand // DockerExtensionSchema represents the schema for the Docker Extension DockerExtensionSchema = "schema/io-cnab-docker.schema.json" )
const ( // PorterExtension is the key for all Porter configuration stored the the custom section of bundles. PorterExtension = "sh.porter" // PorterExtensionsPrefix is the prefix applied to any custom CNAB extensions developed by Porter. PorterExtensionsPrefix = PorterExtension + "." // OfficialExtensionsPrefix is the prefix applied to extensions defined in the CNAB spec. OfficialExtensionsPrefix = "io.cnab." // PorterInternal is the identifier that we put in the $comment of fields in bundle.json // to indicate that it's just for Porter and shouldn't be visible to the end users. PorterInternal = "porter-internal" )
const ( // FileParameterExtensionShortHand is the short suffix of the FileParameterExtensionKey. FileParameterExtensionShortHand = "file-parameters" // FileParameterExtensionKey represents the full key for the File Parameter extension. FileParameterExtensionKey = PorterExtensionsPrefix + FileParameterExtensionShortHand )
const ( // ParameterSourcesExtensionShortHand is the short suffix of the ParameterSourcesExtensionKey. ParameterSourcesExtensionShortHand = "parameter-sources" // ParameterSourcesExtensionKey represents the full key for the Parameter Sources Extension. ParameterSourcesExtensionKey = OfficialExtensionsPrefix + ParameterSourcesExtensionShortHand // ParameterSourcesExtensionSchema represents the schema for the Docker Extension. ParameterSourcesSchema = "https://cnab.io/v1/parameter-sources.schema.json" // ParameterSourceTypeOutput defines a type of parameter source that is provided by a bundle output. ParameterSourceTypeOutput = "output" // ParameterSourceTypeDependencyOutput defines a type of parameter source that is provided by a bundle's dependency // output. ParameterSourceTypeDependencyOutput = "dependencies.output" )
Variables ¶
var DependenciesV1Extension = RequiredExtension{ Shorthand: DependenciesV1ExtensionShortHand, Key: DependenciesV1ExtensionKey, Schema: DependenciesV1Schema, Reader: func(b ExtendedBundle) (interface{}, error) { return b.DependencyV1Reader() }, }
DependenciesV1Extension represents the required extension to enable dependencies
var DockerExtension = RequiredExtension{ Shorthand: DockerExtensionShortHand, Key: DockerExtensionKey, Schema: "schema/io-cnab-docker.schema.json", Reader: DockerExtensionReader, }
DockerExtension represents a required extension enabling access to the host Docker daemon
var FileParameterExtension = RequiredExtension{ Shorthand: FileParameterExtensionShortHand, Key: FileParameterExtensionKey, Reader: FileParameterReader, }
FileParameterExtension represents a required extension that indicates that the bundle requires support for parameters of type "file"
var NewULID = cnabclaims.MustNewULID
var ParameterSourcesExtension = RequiredExtension{ Shorthand: ParameterSourcesExtensionShortHand, Key: ParameterSourcesExtensionKey, Schema: ParameterSourcesSchema, Reader: ParameterSourcesReader, }
ParameterSourcesExtension represents a required extension that specifies how to default parameter values.
var SupportedExtensions = []RequiredExtension{ DependenciesV1Extension, DockerExtension, FileParameterExtension, ParameterSourcesExtension, }
SupportedExtensions represent a listing of the current required extensions that Porter supports
Functions ¶
func CNABSchemaVersion ¶
CNABSchemaVersion is the schemaVersion value for CNAB documents such as claims.
func DockerExtensionReader ¶ added in v1.0.1
func DockerExtensionReader(bun ExtendedBundle) (interface{}, error)
DockerExtensionReader is a Reader for the DockerExtension, which reads from the applicable section in the provided bundle and returns the raw data in the form of an interface
func FileParameterReader ¶ added in v1.0.1
func FileParameterReader(b ExtendedBundle) (interface{}, error)
FileParameterReader is a Reader for the FileParameterExtension. The extension does not have any data, its presence indicates that parameters of type "file" should be supported by the tooling.
func ParameterSourcesReader ¶ added in v1.0.1
func ParameterSourcesReader(bun ExtendedBundle) (interface{}, error)
ParameterSourcesReader is a Reader for the ParameterSourcesExtension, which reads from the applicable section in the provided bundle and returns the raw data in the form of an interface
func WriteParameterToString ¶ added in v1.0.1
WriteParameterToString changes a parameter's value from its type as defined by the bundle to its runtime string representation. The value should have already been converted to its bundle representation by calling ConvertParameterValue.
Types ¶
type BundleReference ¶ added in v1.0.1
type BundleReference struct { Reference OCIReference Digest digest.Digest Definition ExtendedBundle RelocationMap relocation.ImageRelocationMap }
func (BundleReference) AddToTrace ¶ added in v1.0.1
func (r BundleReference) AddToTrace(cxt context.Context)
AddToTrace appends the bundle reference attributes to the current span.
func (BundleReference) String ¶ added in v1.0.1
func (r BundleReference) String() string
type Claim ¶ added in v1.0.1
type Claim = cnabclaims.Claim
type DependencyLock ¶ added in v1.0.1
type DependencyOutputParameterSource ¶ added in v1.0.1
type DependencyOutputParameterSource struct { Dependency string `json:"dependency" mapstructure:"dependency"` OutputName string `json:"name" mapstructure:"name"` }
DependencyOutputParameterSource represents a parameter that is set using the value from a bundle's dependency output.
type DependencySolver ¶ added in v1.0.1
type DependencySolver struct { }
TODO: move this logic onto the new ExtendedBundle struct
func (*DependencySolver) ResolveDependencies ¶ added in v1.0.1
func (s *DependencySolver) ResolveDependencies(bun ExtendedBundle) ([]DependencyLock, error)
func (*DependencySolver) ResolveVersion ¶ added in v1.0.1
func (s *DependencySolver) ResolveVersion(name string, dep depsv1.Dependency) (OCIReference, error)
ResolveVersion returns the bundle name, its version and any error.
type Docker ¶ added in v1.0.1
type Docker struct { // Privileged represents whether or not the Docker container should run as --privileged Privileged bool `json:"privileged,omitempty"` }
Docker describes the set of custom extension metadata associated with the Docker extension
type ExtendedBundle ¶ added in v1.0.1
ExtendedBundle is a bundle that has typed access to extensions declared in the bundle, allowing quick type-safe access to custom extensions from the CNAB spec.
func LoadBundle ¶
func LoadBundle(c *portercontext.Context, bundleFile string) (ExtendedBundle, error)
LoadBundle from the specified filepath.
func NewBundle ¶ added in v1.0.1
func NewBundle(bundle bundle.Bundle) ExtendedBundle
NewBundle creates an ExtendedBundle from a given bundle.
func ReadTestBundle ¶
func ReadTestBundle(t *testing.T, path string) ExtendedBundle
func (ExtendedBundle) ConvertParameterValue ¶ added in v1.0.1
func (b ExtendedBundle) ConvertParameterValue(key string, value interface{}) (interface{}, error)
ConvertParameterValue converts a parameter's value from an unknown type, it could be a string from stdin or another Go type, into the type of the parameter as defined in the bundle.
func (ExtendedBundle) DependencyV1Reader ¶ added in v1.0.1
func (b ExtendedBundle) DependencyV1Reader() (interface{}, error)
DependencyV1Reader is a Reader for the DependenciesV1Extension, which reads from the applicable section in the provided bundle and returns the raw data in the form of an interface
func (ExtendedBundle) DockerExtensionReader ¶ added in v1.0.1
func (b ExtendedBundle) DockerExtensionReader() (interface{}, error)
DockerExtensionReader is a Reader for the DockerExtension, which reads from the applicable section in the provided bundle and returns the raw data in the form of an interface
func (ExtendedBundle) FileParameterReader ¶ added in v1.0.1
func (b ExtendedBundle) FileParameterReader() (interface{}, error)
FileParameterReader is a Reader for the FileParameterExtension. The extension does not have any data, its presence indicates that parameters of type "file" should be supported by the tooling.
func (ExtendedBundle) GetParameterType ¶ added in v1.0.1
func (b ExtendedBundle) GetParameterType(def *definition.Schema) string
GetParameterType determines the type of parameter accounting for Porter-specific parameter types like file.
func (ExtendedBundle) HasDependenciesV1 ¶ added in v1.0.1
func (b ExtendedBundle) HasDependenciesV1() bool
HasDependenciesV1 returns whether the bundle has parameter sources defined.
func (ExtendedBundle) HasParameterSources ¶ added in v1.0.1
func (b ExtendedBundle) HasParameterSources() bool
HasParameterSources returns whether or not the bundle has parameter sources defined.
func (ExtendedBundle) IsFileType ¶ added in v1.0.1
func (b ExtendedBundle) IsFileType(def *definition.Schema) bool
IsFileType determines if the parameter/credential is of type "file".
func (ExtendedBundle) IsInternalOutput ¶ added in v1.0.1
func (b ExtendedBundle) IsInternalOutput(name string) bool
IsInternalOutput determines if the provided output is internal to Porter after analyzing the provided bundle.
func (ExtendedBundle) IsInternalParameter ¶ added in v1.0.1
func (b ExtendedBundle) IsInternalParameter(name string) bool
IsInternalParameter determines if the provided parameter is internal to Porter after analyzing the provided bundle.
func (ExtendedBundle) IsPorterBundle ¶ added in v1.0.1
func (b ExtendedBundle) IsPorterBundle() bool
IsPorterBundle determines if the bundle was created by Porter.
func (ExtendedBundle) IsSensitiveParameter ¶ added in v1.0.1
func (b ExtendedBundle) IsSensitiveParameter(param string) bool
IsSensitiveParameter determines if the parameter contains a sensitive value.
func (ExtendedBundle) ParameterHasSource ¶ added in v1.0.1
func (b ExtendedBundle) ParameterHasSource(paramName string) bool
ParameterHasSource determines if the specified parameter has a parameter source defined.
func (ExtendedBundle) ParameterSourcesReader ¶ added in v1.0.1
func (b ExtendedBundle) ParameterSourcesReader() (interface{}, error)
ParameterSourcesReader is a Reader for the ParameterSourcesExtension, which reads from the applicable section in the provided bundle and returns the raw data in the form of an interface
func (ExtendedBundle) ProcessRequiredExtensions ¶ added in v1.0.1
func (b ExtendedBundle) ProcessRequiredExtensions() (ProcessedExtensions, error)
ProcessRequiredExtensions checks all required extensions in the provided bundle and makes sure Porter supports them.
If an unsupported required extension is found, an error is returned.
For each supported required extension, the configuration for that extension is read and returned in the form of a map of the extension name to the extension configuration
func (ExtendedBundle) ReadDependenciesV1 ¶ added in v1.0.1
func (b ExtendedBundle) ReadDependenciesV1() (depsv1.Dependencies, error)
ReadDependenciesV1 is a convenience method for returning a bonafide Dependencies reference after reading from the applicable section from the provided bundle
func (ExtendedBundle) ReadParameterSources ¶ added in v1.0.1
func (b ExtendedBundle) ReadParameterSources() (ParameterSources, error)
ReadParameterSources is a convenience method for returning a bonafide ParameterSources reference after reading from the applicable section from the provided bundle
func (ExtendedBundle) SupportsDependenciesV1 ¶ added in v1.0.1
func (b ExtendedBundle) SupportsDependenciesV1() bool
SupportsDependenciesV1 checks if the bundle supports dependencies
func (ExtendedBundle) SupportsDocker ¶ added in v1.0.1
func (b ExtendedBundle) SupportsDocker() bool
SupportsDocker checks if the bundle supports docker.
func (ExtendedBundle) SupportsExtension ¶ added in v1.0.1
func (b ExtendedBundle) SupportsExtension(key string) bool
SupportsExtension checks if the bundle supports the specified CNAB extension.
func (ExtendedBundle) SupportsFileParameters ¶ added in v1.0.1
func (b ExtendedBundle) SupportsFileParameters() bool
SupportsFileParameters checks if the bundle supports file parameters.
func (ExtendedBundle) SupportsParameterSources ¶ added in v1.0.1
func (b ExtendedBundle) SupportsParameterSources() bool
SupportsParameterSources checks if the bundle supports parameter sources.
func (ExtendedBundle) WriteParameterToString ¶ added in v1.0.1
func (b ExtendedBundle) WriteParameterToString(paramName string, value interface{}) (string, error)
type Installation ¶ added in v1.0.1
type Installation = cnabclaims.Installation
type OCIReference ¶ added in v1.0.1
type OCIReference struct { // Name is the wrapped reference that we are providing helper methods on top of Named reference.Named }
OCIReference is a wrapper around a docker reference with convenience methods for decomposing and manipulating bundle references.
It is designed to be safe to call even when uninitialized, returning empty strings when parts are requested that do not exist, such as calling Digest() when no digest is set on the reference.
func MustParseOCIReference ¶ added in v1.0.1
func MustParseOCIReference(value string) OCIReference
MustParseOCIReference parses the specified value as an OCIReference, panicking on any errors. Only use this for unit tests where you know the value is a reference.
func ParseOCIReference ¶ added in v1.0.1
func ParseOCIReference(value string) (OCIReference, error)
ParseOCIReference parses the specified value as an OCIReference. If the reference includes a digest, the digest is validated.
func (OCIReference) Digest ¶ added in v1.0.1
func (r OCIReference) Digest() digest.Digest
Digest portion of the reference. Example: ghcr.io/getporter/mybuns@sha256:abc123 returns sha256:abc123
func (OCIReference) HasDigest ¶ added in v1.0.1
func (r OCIReference) HasDigest() bool
HasDigest determines if the reference has a digest portion. Example: ghcr.io/getporter/mybuns@sha256:abc123 returns true
func (OCIReference) HasTag ¶ added in v1.0.1
func (r OCIReference) HasTag() bool
HasTag determines if the reference has a tag portion. Example: ghcr.io/getporter/mybuns:latest returns true
func (OCIReference) HasVersion ¶ added in v1.0.1
func (r OCIReference) HasVersion() bool
HasVersion detects if the reference tag is a bundle version (semver).
func (OCIReference) IsRepositoryOnly ¶ added in v1.0.1
func (r OCIReference) IsRepositoryOnly() bool
IsRepositoryOnly determines if the reference is fully qualified with a tag/digest or if it only contains a repository. Example: ghcr.io/getporter/mybuns returns true
func (OCIReference) MarshalJSON ¶ added in v1.0.1
func (r OCIReference) MarshalJSON() ([]byte, error)
func (OCIReference) ParseRepositoryInfo ¶ added in v1.0.1
func (r OCIReference) ParseRepositoryInfo() (*registry.RepositoryInfo, error)
ParseRepositoryInfo returns additional metadata about the repository portion of the reference.
func (OCIReference) Registry ¶ added in v1.0.1
func (r OCIReference) Registry() string
Registry portion of the reference. Example: ghcr.io/getporter/mybuns:v0.1.1 returns ghcr.io
func (OCIReference) Repository ¶ added in v1.0.1
func (r OCIReference) Repository() string
Repository portion of the reference. Example: ghcr.io/getporter/mybuns:v0.1.1 returns getporter/mybuns
func (OCIReference) String ¶ added in v1.0.1
func (r OCIReference) String() string
Always print the original name provided, not the one with docker.io prefixed.
func (OCIReference) Tag ¶ added in v1.0.1
func (r OCIReference) Tag() string
Tag portion of the reference. Example: ghcr.io/getporter/mybuns:latest returns latest
func (*OCIReference) UnmarshalJSON ¶ added in v1.0.1
func (r *OCIReference) UnmarshalJSON(bytes []byte) error
func (OCIReference) Version ¶ added in v1.0.1
func (r OCIReference) Version() string
Version parses the reference tag as a bundle version (semver).
func (OCIReference) WithDigest ¶ added in v1.0.1
func (r OCIReference) WithDigest(digest digest.Digest) (OCIReference, error)
WithDigest creates a new reference using the repository and the specified digest.
func (OCIReference) WithTag ¶ added in v1.0.1
func (r OCIReference) WithTag(tag string) (OCIReference, error)
WithTag creates a new reference using the repository and the specified tag.
func (OCIReference) WithVersion ¶ added in v1.0.1
func (r OCIReference) WithVersion(version string) (OCIReference, error)
WithVersion creates a new reference using the repository and the specified bundle version.
type Output ¶ added in v1.0.1
type Output = cnabclaims.Output
type OutputMetadata ¶ added in v1.0.1
type OutputMetadata = cnabclaims.OutputMetadata
type OutputParameterSource ¶ added in v1.0.1
type OutputParameterSource struct {
OutputName string `json:"name" mapstructure:"name"`
}
OutputParameterSource represents a parameter that is set using the value from a bundle output.
type Outputs ¶ added in v1.0.1
type Outputs = cnabclaims.Outputs
type ParameterSource ¶ added in v1.0.1
type ParameterSource struct { // Priority is an array of source types in the priority order that they should be used to // populated the parameter. Priority []string `json:"priority" mapstructure:"priority"` // Sources is a map of key/value pairs of a source type and definition for // the parameter value. Sources ParameterSourceMap `json:"sources" mapstructure:"sources"` }
func (ParameterSource) ListSourcesByPriority ¶ added in v1.0.1
func (s ParameterSource) ListSourcesByPriority() []ParameterSourceDefinition
ListSourcesByPriority returns the parameter sources by the requested priority, if none is specified, they are unsorted.
type ParameterSourceDefinition ¶ added in v1.0.1
type ParameterSourceDefinition interface { }
type ParameterSourceMap ¶ added in v1.0.1
type ParameterSourceMap map[string]ParameterSourceDefinition
func (*ParameterSourceMap) UnmarshalJSON ¶ added in v1.0.1
func (m *ParameterSourceMap) UnmarshalJSON(data []byte) error
type ParameterSources ¶ added in v1.0.1
type ParameterSources map[string]ParameterSource
ParameterSources describes the set of custom extension metadata associated with the Parameter Sources extension
func (*ParameterSources) SetParameterFromDependencyOutput ¶ added in v1.0.1
func (ps *ParameterSources) SetParameterFromDependencyOutput(parameter string, dep string, output string)
SetParameterFromDependencyOutput creates an entry in the parameter sources section setting the parameter's value using the specified dependency's output value.
func (*ParameterSources) SetParameterFromOutput ¶ added in v1.0.1
func (ps *ParameterSources) SetParameterFromOutput(parameter string, output string)
SetParameterFromOutput creates an entry in the parameter sources section setting the parameter's value using the specified output's value.
type ProcessedExtensions ¶ added in v1.0.1
type ProcessedExtensions map[string]interface{}
ProcessedExtensions represents a map of the extension name to the processed extension configuration
func (ProcessedExtensions) FileParameterSupport ¶ added in v1.0.1
func (e ProcessedExtensions) FileParameterSupport() bool
FileParameterSupport checks if the file parameter extension is present.
func (ProcessedExtensions) GetDocker ¶ added in v1.0.1
func (e ProcessedExtensions) GetDocker() (dockerExt Docker, dockerRequired bool, err error)
GetDocker checks if the docker extension is present and returns its extension configuration.
func (ProcessedExtensions) GetParameterSources ¶ added in v1.0.1
func (e ProcessedExtensions) GetParameterSources() (ParameterSources, bool, error)
GetParameterSources checks if the parameter sources extension is present and returns its extension configuration.
type RequiredExtension ¶ added in v1.0.1
type RequiredExtension struct { Shorthand string Key string Schema string Reader func(b ExtendedBundle) (interface{}, error) }
RequiredExtension represents a required extension that is known and supported by Porter
func GetSupportedExtension ¶ added in v1.0.1
func GetSupportedExtension(e string) (*RequiredExtension, error)
GetSupportedExtension returns a supported extension according to the provided name, or an error
type Result ¶ added in v1.0.1
type Result = cnabclaims.Result