New Interested in participating in the HCP Waypoint Private Beta Program? Apply here
  • Infrastructure
    • terraform
    • packer
  • Networking
    • consul
  • Security
    • vault
    • boundary
  • Applications
    • nomad
    • waypoint
    • vagrant
  • HashiCorp Cloud Platform

    A fully managed platform to automate infrastructure on any cloud with HashiCorp products.

    • consul
    • terraform
    • vault
    • packerbeta
    Visit cloud.hashicorp.com
  • Overview
  • Tutorials
  • Docs
  • CLI
  • Plugins
  • Community
GitHub
Download
    • Overview
      • Overview
      • Helm
      • Heroku, Vercel, etc.
      • Kubernetes
  • Getting Started
    • Overview
    • Compatibility Promise
    • Protocol Version Table
    • Release Notifications
      • Overview
      • Upgrade to 0.2.0
      • Upgrade to 0.3.0
      • Upgrade to 0.4.0
      • Upgrade to 0.5.0
      • Upgrade to 0.6.0
      • Upgrade to 0.7.0
      • Upgrade to 0.8.0

    • Install
    • Externally Built Images
    • Building Container Images
    • Helm Deployment
    • YAML-Free Deployment
    • YAML Directory Deployment
    • Resource Status
    • ConfigMaps and Secrets

    • Overview
    • Git Integration
    • Remote Operations
    • Overview
    • Build
    • Deploy
    • Release
    • Hooks
    • Labels
    • Workspace and Label Scoping
    • Overview
      • Overview
      • Input Variables
      • External Data
      • artifact
      • deploy
      • entrypoint
      • labels
      • path
      • workspace
      • Overview
      • Full Reference
      • Templating
      • Overview
      • Expressions
      • JSON Syntax
    • app
    • build
    • config
    • deploy
    • hook
    • plugin
    • registry
    • release
    • runner
    • url
    • use
    • variable
  • URL Service
  • Logs
  • Exec
    • Overview
    • Dynamic Values
    • Files
    • Internal Values
    • Workspace and Label Scoping
    • Overview
      • Overview
      • OIDC
      • Tokens
      • Overview
      • Maintenance
      • Production
      • Security
    • Express Server Install
    • Overview
    • Configuration
    • Profiles
    • On-Demand Runner
    • Additional Runners
  • Workspaces
  • Plugins
  • Triggers

    • Overview
      • Overview
      • Registering Plugin Components
      • Handling Configuration
      • Implementing the Builder Interface
      • Compiling the Plugin
      • Creating an Example Application
      • Testing the Plugin
    • Initializing the SDK
    • Passing Values Between Components
      • Overview
      • Authenticator
      • ConfigSourcer
      • Configurable
      • ConfigurableNotify
      • Builder
      • Registry
      • Platform
      • ReleaseManager
      • Destroy
      • Status
      • Default Parameters
      • Overview
    • Overview
    • Disable
    • Overview
    • GitHub Actions
    • GitLab CI/CD
    • CircleCI
    • Jenkins
  • Troubleshooting
  • Glossary

    • Overview
    • Architecture
    • Operation Execution
  • Roadmap
Type '/' to Search

»Default Parameters

In addition to user defined return values you can also request waypoint injects default parameters. At present there are 11 possible parameters which you can inject, these are:

  • context.Context
  • *component.Source
  • *component.JobInfo
  • *component.DeploymentConfig
  • hclog.Logger
  • terminal.UI
  • *component.LabelSet

»context.Context

https://pkg.go.dev/context#Context

Context is a default parameter and is used by Waypoint to notify you when the work that component is performing should be cancelled. As with any Go code calling the Err() function on the Context will return an error if the Context has already been cancelled, you can also use the channel returned by the Done() function to notify you when Waypoint cancels the current operation.

if ctx.Err() != nil {
  return nil, status.Error(codes.Internal, "Context cancelled error message")
}
if ctx.Err() != nil {
  return nil, status.Error(codes.Internal, "Context cancelled error message")
}

»*component.Source

https://pkg.go.dev/github.com/hashicorp/waypoint-plugin-sdk/component#Source

Source is a data struct which provides the current application name App, and Path which is the directory containing the current Waypoint file.

type Source struct {
  App  string
  Path string
}
type Source struct {
  App  string
  Path string
}

»*component.JobInfo

https://pkg.go.dev/github.com/hashicorp/waypoint-plugin-sdk/component#JobInfo

JobInfo is a data struct which provides details related to the current Job.

type JobInfo struct {
  // Id is the ID of the job that is executing this plugin operation.
  // If this is empty then it means that the execution is happening
  // outside of a job.
  Id string

  // Local is true if the operation is running locally on a machine
  // alongside the invocation. This can be used to determine if you can
  // do things such as open browser windows, read user files, etc.
  Local bool

  // Workspace is the workspace that this job is executing in. This should
  // be used by plugins to properly isolate resources from each other.
  Workspace string
}
type JobInfo struct {
  // Id is the ID of the job that is executing this plugin operation.
  // If this is empty then it means that the execution is happening
  // outside of a job.
  Id string

  // Local is true if the operation is running locally on a machine
  // alongside the invocation. This can be used to determine if you can
  // do things such as open browser windows, read user files, etc.
  Local bool

  // Workspace is the workspace that this job is executing in. This should
  // be used by plugins to properly isolate resources from each other.
  Workspace string
}

»*component.DeploymentConfig

https://pkg.go.dev/github.com/hashicorp/waypoint-plugin-sdk/component#DeploymentConfig

DeploymentConfig contains configuration which the entrypoint binary requires in order to run correctly. For example if you deploy an application to Google Cloud Run which is using the builtin Docker builder, the entrypoint is automatically bundled into the container. In order for the entrypoint to function correctly it needs to be configured correctly.

type DeploymentConfig struct {
  Id                    string
  ServerAddr            string
  ServerTls             bool
  ServerTlsSkipVerify   bool
  EntrypointInviteToken string
}
type DeploymentConfig struct {
  Id                    string
  ServerAddr            string
  ServerTls             bool
  ServerTlsSkipVerify   bool
  EntrypointInviteToken string
}

To simplify the configuration of the entrypoint environment variables DeploymentConfig also has a function which returns a map of the correct environment variables and their values.

func (c *DeploymentConfig) Env() map[string]string
func (c *DeploymentConfig) Env() map[string]string

»hclog.Logger

https://pkg.go.dev/github.com/hashicorp/go-hclog#Logger

Logger provides you with the ability to write to the Waypoint standard logger using different log levels such as Info, Debug, Trace, etc. By default, log output is disabled when running a waypoint command. The environment variable WAYPOINT_LOG_LEVEL=[debug, trace, info, warning] can be set to enable log output in the CLI.

  log.Info(
    "Start build",
    "src", src,
    "job", job,
    "projectDataDir", projectDir.DataDir(),
    "projectCacheDir", projectDir.CacheDir(),
    "appDataDir", appDir.DataDir(),
    "appCacheDir", appDir.CacheDir(),
    "componentDataDir", componentDir.DataDir(),
    "componentCacheDir", componentDir.CacheDir(),
    "labels", labels,
  )
  log.Info(
    "Start build",
    "src", src,
    "job", job,
    "projectDataDir", projectDir.DataDir(),
    "projectCacheDir", projectDir.CacheDir(),
    "appDataDir", appDir.DataDir(),
    "appCacheDir", appDir.CacheDir(),
    "componentDataDir", componentDir.DataDir(),
    "componentCacheDir", componentDir.CacheDir(),
    "labels", labels,
  )

»terminal.UI

https://pkg.go.dev/github.com/hashicorp/waypoint-plugin-sdk/terminal#UI

UI allows you to build rich output for your plugin, more details on using terminal.UI can be found in the Interacting with the UI section.

»*component.LabelSet

https://pkg.go.dev/github.com/hashicorp/waypoint-plugin-sdk/component#LabelSet

LabelSet allows you to read the labels defined at an app level on your Waypoint configuration.

app "wpmini" {
  labels = {
    "service" = "wpmini",
    "env"     = "dev"
  }
#...
app "wpmini" {
  labels = {
    "service" = "wpmini",
    "env"     = "dev"
  }
#...

The LabelSet struct exposes a single field Labels which is of type map[string]string, this collection contains all the labels defined in the configuration.

Labels map[string]string
Labels map[string]string
github logoEdit this page

Using Waypoint

The best way to understand what Waypoint can enable for your projects is to give it a try.

Waypoint tutorials
Waypoint documentation
Tutorial

Get Started - Kubernetes

Build, deploy, and release applications to a Kubernetes cluster.

View
Tutorial

Introduction to Waypoint

Waypoint enables you to publish any application to any platform with a single file and a single command.

View

Waypoint is maintained by HashiCorp, Inc.

View Code of Conduct
DocumentationCLI ReferenceTutorialsIntegrations
All systems normal