Labels
Warning
This content is part of the legacy version of Waypoint that is no longer actively maintained. For additional information on the new vision of Waypoint, check out this blog post and the HCP Waypoint documentation.
Labels are key/value pairs that can be specified by the user and
attached to Waypoint operations. Labels can be used to specify any information
that may be useful for the user, but are not directly interpreted by
Waypoint itself. For example, this can be used for organizational information
(team=widget
), process information (scanned=true
), etc.
Specifying Labels
Operation Labels
Labels can be attached to any of the major lifecycle stages using the
labels
attribute, as shown below.
This would attach the label region=tokyo
to all the "build" operations
and this would be visible in the UI and accessible via the API.
Operation labels can also be specified using the CLI during any operation
by specifying the -label
flag. This flag can be repeated multiple times
to specify multiple labels. The example below specifies a couple labels
that will be applied to the build step only for this invocation.
Project and App Labels
Labels can also be specified at both the project and app scope. These labels are inherited by all operations within the project and application.
Predefined Labels
Labels starting with waypoint/
are reserved for Waypoint rather than
user specification. It is an error to try to set any labels starting with
waypoint/
and Waypoint will not allow it. We call these "system labels".
The full set of system labels is listed below:
waypoint/workspace
- The current workspace of the operation.
Using Labels
Labels Variable
The complete label set for the current operation is always available
using the labels
variable
within the waypoint.hcl
file. The linked documentation shares various
examples of how this might be useful, but one example might be that you
want to also store all the labels as annotations within a platform such
as Kubernetes:
Filtering with Selectors
Labels can be used in various places in Waypoint for filtering by using "label selectors." Label selectors are boolean expressions (result in a "true" or "false"). An example of where filtering can be used is application configuration.
The full label selector syntax is documented below.
Note: Labels have powerful but limited functionality at present. We plan for more features to utilize labels in the future but expect their usage beyond simple informational tasks to remain advanced concepts.
Label Selector Syntax
The full syntax for label selectors is documented below.
The list below shows all the operators that can be used for a single value, such as equality, inequality, string or list containment, regular expression matching, etc.
Multiple such expressions can be composed using and
, or
, and parentheses: