Documentation ¶
Index ¶
- Constants
- func AddVariables(ctx *hcl.EvalContext, vs variables.Values) *hcl.EvalContext
- func EvalContext(parent *hcl.EvalContext, pwd string) *hcl.EvalContext
- func FindPath(start, filename string, searchParent bool) (string, error)
- func TestConfigFile(t testing.T, src string)
- func TestSource(t testing.T) string
- func TestSourceJSON(t testing.T) string
- type App
- func (c *App) Build(ctx *hcl.EvalContext) (*Build, error)
- func (c *App) BuildLabels(ctx *hcl.EvalContext) (map[string]string, error)
- func (c *App) BuildUse(ctx *hcl.EvalContext) (string, error)
- func (c *App) ConfigMetadata() (*ConfigMetadata, *ConfigMetadata)
- func (c *App) ConfigVars() ([]*pb.ConfigVar, error)
- func (c *App) Deploy(ctx *hcl.EvalContext) (*Deploy, error)
- func (c *App) DeployLabels(ctx *hcl.EvalContext) (map[string]string, error)
- func (c *App) DeployUse(ctx *hcl.EvalContext) (string, error)
- func (c *App) Ref() *pb.Ref_Application
- func (c *App) Registry(ctx *hcl.EvalContext) (*Registry, error)
- func (c *App) RegistryLabels(ctx *hcl.EvalContext) (map[string]string, error)
- func (c *App) RegistryUse(ctx *hcl.EvalContext) (string, error)
- func (c *App) Release(ctx *hcl.EvalContext) (*Release, error)
- func (c *App) ReleaseLabels(ctx *hcl.EvalContext) (map[string]string, error)
- func (c *App) ReleaseUse(ctx *hcl.EvalContext) (string, error)
- func (c *App) Validate() (ValidationResults, error)
- type AppURL
- type Build
- type Config
- func (c *Config) App(n string, ctx *hcl.EvalContext) (*App, error)
- func (c *Config) Apps() []string
- func (c *Config) ConfigAppRunner(name string) *Runner
- func (c *Config) ConfigPath() string
- func (c *Config) ConfigRunner() *Runner
- func (c *Config) HCLContext() *hcl.EvalContext
- func (c *Config) Pipeline(id string, ctx *hcl.EvalContext) (*Pipeline, error)
- func (c *Config) PipelineProtos() ([]*pb.Pipeline, error)
- func (c *Config) Pipelines() []string
- func (c *Config) Plugins() []*Plugin
- func (c *Config) Validate() (ValidationResults, error)
- type ConfigMetadata
- type DataSource
- type Deploy
- type Hook
- type LoadOptions
- type Operation
- type Pipeline
- type Plugin
- type Poll
- type Registry
- type Release
- type Runner
- type Step
- type Use
- type ValidationResult
- type ValidationResults
- type VariableLoopError
Constants ¶
const Filename = "waypoint.hcl"
Filename is the default filename for the Waypoint configuration.
Variables ¶
This section is empty.
Functions ¶
func AddVariables ¶ added in v0.5.0
AddVariables uses the final map of InputValues to add all input variables to the given hcl EvalContext.
func EvalContext ¶
func EvalContext(parent *hcl.EvalContext, pwd string) *hcl.EvalContext
EvalContext returns the common eval context to use for parsing all configurations. This should always be available for all config types.
The pwd param is the directory to use as a working directory for determining things like relative paths. This should be considered the pwd over the actual process pwd.
func FindPath ¶
FindPath looks for our configuration file starting at "start" and traversing parent directories until it is found. If it is found, the path is returned. If it is not found, an empty string is returned. Error will be non-nil only if an error occurred.
If start is empty, start will be the current working directory. If filename is empty, it will default to the Filename constant.
If searchParent is false, then we will not search parent directories and require the Waypoint configuration file be directly in the "start" directory.
func TestConfigFile ¶
func TestConfigFile(t testing.T, src string)
TestConfigFile writes the default Waypoint configuration file with the given contents.
func TestSourceJSON ¶ added in v0.3.0
func TestSourceJSON(t testing.T) string
TestSourceJSON returns valid configuration in JSON format.
Types ¶
type App ¶
type App struct { Name string `hcl:",label"` Path string `hcl:"path,optional"` Labels map[string]string `hcl:"labels,optional"` URL *AppURL `hcl:"url,block" default:"{}"` Config *genericConfig `hcl:"config,block"` Runner *Runner `hcl:"runner,block"` BuildRaw *hclBuild `hcl:"build,block"` DeployRaw *hclStage `hcl:"deploy,block"` ReleaseRaw *hclStage `hcl:"release,block"` Body hcl.Body `hcl:",body"` // contains filtered or unexported fields }
App represents a single application.
func (*App) BuildLabels ¶ added in v0.6.0
BuildLabels returns the labels for this stage.
func (*App) ConfigMetadata ¶ added in v0.4.0
func (c *App) ConfigMetadata() (*ConfigMetadata, *ConfigMetadata)
ConfigMetadata returns any configuration metadata about the project and app.
func (*App) ConfigVars ¶ added in v0.2.0
ConfigVars returns the configuration variables for the app, including merging the configuration variables from the project level.
For access to only the app-level config vars, use the Config attribute directly.
func (*App) DeployLabels ¶ added in v0.6.0
DeployLabels returns the labels for this stage.
func (*App) Ref ¶ added in v0.2.0
func (c *App) Ref() *pb.Ref_Application
Ref returns the ref for this app.
func (*App) RegistryLabels ¶ added in v0.6.0
RegistryLabels returns the labels for this stage.
func (*App) RegistryUse ¶ added in v0.2.0
RegistryUse returns the plugin "use" value.
func (*App) ReleaseLabels ¶ added in v0.6.0
ReleaseLabels returns the labels for this stage.
func (*App) ReleaseUse ¶ added in v0.2.0
ReleaseUse returns the plugin "use" value.
func (*App) Validate ¶
func (c *App) Validate() (ValidationResults, error)
Validate validates the application.
Similar to Config.App, this doesn't validate configuration that is further deferred such as build, deploy, etc. stanzas so call Validate on those as they're loaded.
type AppURL ¶
type AppURL struct {
AutoHostname *bool `hcl:"auto_hostname,optional"`
}
AppURL configures the App-specific URL settings.
type Build ¶
type Build struct { Labels map[string]string `hcl:"labels,optional"` Hooks []*Hook `hcl:"hook,block"` Use *Use `hcl:"use,block"` // This should not be used directly. This is here for validation. // Instead, use App.Registry(). Registry *Registry `hcl:"registry,block"` // Unused for practical reasons, but we need this here so that // the decoding validates successfully (HCL doesn't error of // unexpected things). WorkspaceScoped []*scopedStage `hcl:"workspace,block"` LabelScoped []*scopedStage `hcl:"label,block"` // contains filtered or unexported fields }
Build are the build settings.
type Config ¶
type Config struct { InputVariables map[string]*variables.Variable // contains filtered or unexported fields }
func Load ¶ added in v0.2.0
func Load(path string, opts *LoadOptions) (*Config, error)
Load loads the configuration file from the given path.
Configuration loading in Waypoint is lazy. This will load just the amount necessary to return the initial Config structure. Additional functions on Config must be called to load additional parts of the Config.
This also means that the config may be invalid. To validate the config call the Validate method.
func TestConfig ¶
TestConfig returns a Config from a string source and fails the test if parsing the configuration fails.
func (*Config) App ¶ added in v0.2.0
App returns the configured app named n. If the app doesn't exist, this will return (nil, nil).
func (*Config) ConfigAppRunner ¶ added in v0.7.2
ConfigAppRunner returns the runner stanza on an application
func (*Config) ConfigPath ¶ added in v0.7.0
ConfigPath returns the path to the directory that contains the config file (waypoint.hcl)
func (*Config) ConfigRunner ¶ added in v0.7.2
ConfigRunner returns the runner stanza on a project
func (*Config) HCLContext ¶ added in v0.2.0
func (c *Config) HCLContext() *hcl.EvalContext
HCLContext returns the eval context for this configuration.
func (*Config) Pipeline ¶ added in v0.10.0
Pipeline returns the configured pipeline named n. If the pipeline doesn't exist, this will return (nil, nil). Note that currently this parsing function does not attempt to detect cycles between embedded pipelines.
func (*Config) PipelineProtos ¶ added in v0.10.0
PipelineProtos will take the existing HCL eval context, eval the config and translate the HCL result into a Pipeline Proto to be returned for operations such as ConfigSync. If a pipeline has an embedded pipeline defined, PipelineProtos will return each as its own separate Pipeline proto message where the step that defined the embedded pipeline is actually a Pipeline Step reference.
func (*Config) Plugins ¶
Plugins returns all the plugins defined by this configuration. This will include the implicitly defined plugins via `use` statements.
func (*Config) Validate ¶
func (c *Config) Validate() (ValidationResults, error)
Validate the structure of the configuration.
This will validate required fields are specified and the types of some fields. Plugin-specific fields won't be validated until later. Fields that use functions and variables will not be validated until those values can be realized.
Users of this package should call Validate on each subsequent configuration that is loaded (Apps, Builds, Deploys, etc.) for further rich validation.
type ConfigMetadata ¶ added in v0.4.0
type ConfigMetadata struct {
FileChangeSignal string
}
ConfigMetadata holds information about the configuration variables or process themselves.
type DataSource ¶
type DataSource struct { Type string `hcl:",label"` Body hcl.Body `hcl:",remain"` }
DataSource configures the data source for the runner.
type Deploy ¶
type Deploy struct { Labels map[string]string `hcl:"labels,optional"` Hooks []*Hook `hcl:"hook,block"` Use *Use `hcl:"use,block"` // Unused, see Build WorkspaceScoped []*scopedStage `hcl:"workspace,block"` LabelScoped []*scopedStage `hcl:"label,block"` // contains filtered or unexported fields }
Deploy are the deploy settings.
type Hook ¶
type Hook struct { When string `hcl:"when,attr"` Command []string `hcl:"command,attr"` OnFailure string `hcl:"on_failure,optional"` }
Hook is the configuration for a hook that runs at specified times.
func (*Hook) ContinueOnFailure ¶
type LoadOptions ¶ added in v0.4.0
type LoadOptions struct { // Pwd is the current working directory. This is used to setup the // `path.pwd` variable and also makes things such as the Git rules work. Pwd string // Workspace is the workspace that we are executing in. This is used to // setup `workspace.name` variables. Workspace string }
LoadOptions should be set for the Load function.
type Operation ¶
type Operation struct { Labels map[string]string `hcl:"labels,optional"` Hooks []*Hook `hcl:"hook,block"` Use *Use `hcl:"use,block"` // contains filtered or unexported fields }
Operation is something in the Waypoint configuration that is executed using some underlying plugin. This is a general shared structure that is used by internal/core to initialize all the proper plugins.
type Pipeline ¶ added in v0.10.0
type Pipeline struct { Name string `hcl:",label"` StepRaw []*hclStep `hcl:"step,block"` Steps []*Step Config *Config // contains filtered or unexported fields }
Pipeline represents a single pipeline definition
func (*Pipeline) Ref ¶ added in v0.10.0
func (c *Pipeline) Ref() *pb.Ref_Pipeline
Ref returns the ref for this pipeline.
type Plugin ¶
type Plugin struct { // Name of the plugin. This is expected to match the plugin binary // "waypoint-plugin-<name>" including casing. Name string `hcl:",label"` // Type is the type of plugin this is. This can be multiple. Type struct { Mapper bool `hcl:"mapper,optional"` Builder bool `hcl:"build,optional"` Registry bool `hcl:"registry,optional"` Platform bool `hcl:"deploy,optional"` Releaser bool `hcl:"release,optional"` } `hcl:"type,block"` // Checksum is the SHA256 checksum to validate this plugin. Checksum string `hcl:"checksum,optional"` }
Plugin configures a plugin.
type Poll ¶ added in v0.3.0
type Poll struct { Enabled bool `hcl:"enabled,optional"` Interval string `hcl:"interval,optional"` }
Poll configures the polling settings for a project.
type Registry ¶
type Registry struct { Labels map[string]string `hcl:"labels,optional"` Hooks []*Hook `hcl:"hook,block"` Use *Use `hcl:"use,block"` // Unused, see Build WorkspaceScoped []*scopedStage `hcl:"workspace,block"` LabelScoped []*scopedStage `hcl:"label,block"` // contains filtered or unexported fields }
Registry are the registry settings.
type Release ¶
type Release struct { Labels map[string]string `hcl:"labels,optional"` Hooks []*Hook `hcl:"hook,block"` Use *Use `hcl:"use,block"` // Unused, see Build WorkspaceScoped []*scopedStage `hcl:"workspace,block"` LabelScoped []*scopedStage `hcl:"label,block"` // contains filtered or unexported fields }
Release are the release settings.
type Runner ¶
type Runner struct { // Profile is the name of the on-demand runner configuration. Profile string `hcl:"profile,optional"` // Enabled is whether runners are enabled. If this is false // then the "-remote" flag will not work. Enabled bool `hcl:"enabled,optional"` // DataSource is the default data source when a remote job is queued. DataSource *DataSource `hcl:"data_source,block"` // Poll are the settings related to polling. Poll *Poll `hcl:"poll,block"` }
Runner is the configuration for supporting runners in this project.
type Step ¶ added in v0.10.0
type Step struct { Labels map[string]string `hcl:"labels,optional"` Use *Use `hcl:"use,block"` // Give this step a name Name string `hcl:",label"` // If set, this step will depend on the defined step. The default step // will be the previously defined step in order that it was defined // in a waypoint.hcl DependsOn []string `hcl:"depends_on,optional"` // The OCI image to use for executing this step ImageURL string `hcl:"image_url,optional"` // An optional embedded pipeline stanza Pipeline *Pipeline `hcl:"pipeline,block"` // Optional workspace scoping Workspace string `hcl:"workspace,optional"` // contains filtered or unexported fields }
Step are the step settings for pipelines
type Use ¶
type Use struct { Type string `hcl:",label"` Body hcl.Body `hcl:",remain"` }
Use is something in the Waypoint configuration that is executed using some underlying plugin. This is a general shared structure that is used by internal/core to initialize all the proper plugins.
type ValidationResult ¶ added in v0.9.0
func (ValidationResult) String ¶ added in v0.9.0
func (v ValidationResult) String() string
type ValidationResults ¶ added in v0.9.0
type ValidationResults []ValidationResult
func ValidateLabels ¶
func ValidateLabels(labels map[string]string) ValidationResults
ValidateLabels validates a set of labels. This ensures that labels are set according to our requirements:
- key and value length can't be greater than 255 characters each
- keys must be in hostname format (RFC 952)
- keys can't be prefixed with "waypoint/" which is reserved for system use
func (ValidationResults) Error ¶ added in v0.9.0
func (v ValidationResults) Error() string
func (ValidationResults) HasErrors ¶ added in v0.9.1
func (v ValidationResults) HasErrors() bool
type VariableLoopError ¶ added in v0.4.0
type VariableLoopError struct {
LoopVars []string
}
VariableLoopError is returned when, in the course of sorting the variables, a loop is detected. This means the variables can never be properly evaluated.
func (*VariableLoopError) Error ¶ added in v0.4.0
func (v *VariableLoopError) Error() string