Documentation ¶
Index ¶
- Constants
- 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 ValidateLabels(labels map[string]string) []error
- type App
- func (c *App) Build(ctx *hcl.EvalContext) (*Build, error)
- func (c *App) BuildUse() string
- func (c *App) ConfigVars() ([]*pb.ConfigVar, error)
- func (c *App) Deploy(ctx *hcl.EvalContext) (*Deploy, error)
- func (c *App) DeployUse() string
- func (c *App) Ref() *pb.Ref_Application
- func (c *App) Registry(ctx *hcl.EvalContext) (*Registry, error)
- func (c *App) RegistryUse() string
- func (c *App) Release(ctx *hcl.EvalContext) (*Release, error)
- func (c *App) ReleaseUse() string
- func (c *App) Validate() error
- type AppURL
- type Build
- type Config
- type DataSource
- type Deploy
- type Hook
- type Operation
- type Plugin
- type Registry
- type Release
- type Runner
- type Use
Constants ¶
const Filename = "waypoint.hcl"
Filename is the default filename for the Waypoint configuration.
Variables ¶
This section is empty.
Functions ¶
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 ValidateLabels ¶
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
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"` 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) 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) Ref ¶ added in v0.2.0
func (c *App) Ref() *pb.Ref_Application
Ref returns the ref for this app.
func (*App) RegistryUse ¶ added in v0.2.0
RegistryUse returns the plugin "use" value.
func (*App) ReleaseUse ¶ added in v0.2.0
ReleaseUse returns the plugin "use" value.
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"` // contains filtered or unexported fields }
Build are the build settings.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func Load ¶ added in v0.2.0
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) HCLContext ¶ added in v0.2.0
func (c *Config) HCLContext() *hcl.EvalContext
HCLContext returns the eval context for this configuration.
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 ¶
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 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"` // 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 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 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 Registry ¶
type Registry struct { Labels map[string]string `hcl:"labels,optional"` Hooks []*Hook `hcl:"hook,block"` Use *Use `hcl:"use,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"` // contains filtered or unexported fields }
Release are the release settings.
type Runner ¶
type Runner struct { // Enabled is whether or not 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"` }
Runner is the configuration for supporting runners in this project.