Waypoint Custom Pipelines
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.
NOTE: Custom Pipelines is currently a Tech Preview feature of Waypoint. We invite all Waypoint users to give custom pipelines a try and let us know about your experience on our Discuss forums, as well as feature requests, enhancements, or bugs via GitHub. We look forward to hearing what you think and how Waypoint can help make your experience delivering your applications even better!
Before the introduction of Pipelines, Waypoint had a relatively fixed
built-in pipeline with the waypoint up
CLI command.
An "Up" is a special operation that encapsulates the Build, Deploy, and
Release workflow for an application. This
simple yet powerful pipeline is great for most early users of Waypoint to continuously build
and deploy an application to production.
As our product grew, so did our users. Users wished for more fine-tuned control and customization over how Waypoint deploys applications. Teams need to run tests after a build, security scan artifacts prior to a deploy, and so on. Custom Pipelines enable teams to solve increasingly complex challenges. In the Tech Preview, users can define pipelines to run in the order they require to deliver their application. Additionally, users can run scripts as a pipeline execution step via the "Exec" plugin, which further enables highly customized operations.
Pipelines allow users to tell Waypoint what order these operations should
run in and configure any operation options necessary; such as disabling an
artifact push in the build
step, or pruning old deployments
on a release in the release
step.
Please visit the Pipeline Configuration Docs for more information about the configuration of a Pipeline for a Waypoint project.
Pipeline Runs
Each time a pipeline is run, Waypoint keeps track of the steps, jobs, and run results. As you can see from the waypoint pipeline run console example output, Waypoint identifies how many steps are in the pipeline and how many are successfully completed. Users can then further deep dive into specific pipeline runs to view more information.
waypoint pipeline list
shows the current steps, last run start and complete
times, last run state, and total runs for every pipeline in the project.
waypoint pipeline inspect
can look up a specific pipeline by ID (default) or
name, as well as an additional option to view a specific run of that pipeline.
Pipeline run information will include run state, steps, timestamps, and associated job IDs.
All endpoints and CLI commands related to the running of pipelines: tasks, jobs,
deployments, releases, and builds will reflect pipeline and pipeline run
information. See waypoint artifact list-builds
below for an example:
Exec Step Plugin
Pipelines come with a built-in step plugin named exec
. This plugin allows a
step to execute bash within the Pipeline run. This could be used to run tests
after a build or deploy, or use tools packaged into the exec step image to
security scan the built artifact.
Embedded Pipelines in Steps
You can optionally define a full pipeline within a Pipeline Step. This pattern is useful if you have a series of steps that make sense to be grouped together, such as doing a deploy and release within a specific workspace.
NOTE: Currently, this Tech Preview only allows for 1 level of nesting when defining an embedded pipeline. However, Pipelines can also be used as a reference within a step.
Reference Pipelines As Steps
You can reference other Pipelines within a Project via a pipeline
step:
Pipelines Across Workspaces
Pipelines can be defined and scoped to a Workspace for deploying in various environments.
When you use the pipeline run CLI, you can run a pipeline in a different workspace
with the -workspace
flag.
Workspace Scoped Steps
You can override the environment that a Pipeline step runs in by specifying a
workspace
param for any step in your Pipeline definition. For example,
this pipeline's "build-prod" step will run in the production ("prod") workspace.
Notice that the "build" stanza in the "app" definition contains two "use" plugin definitions, one of which is workspace scoped. That means when the "build-prod" step runs, it will use the "prod" workspace scoped build plugin pack rather than the default "docker" plugin.
You can also use this to set a workspace for an embedded pipeline:
Examples
Below is an example that redefines the Up operation as a pipeline with three steps for a build, deploy, and release workflow. This example could be used as a starting point for more complicated pipelines.
The exec
step accepts "command" and "arg" parameters for executing commands.
To run the example pipeline named "full-up" defined in this example, it is as
simple as waypoint pipeline run full-up
:
Future Roadmap For Pipelines
We plan to continue making improvements to pipelines in the coming months to bring it out of Tech Preview. This includes more support for running batches of operations for a pipeline by improving Waypoint's internal job system, sharing VCS project source code between Steps, giving Pipeline Steps the ability to share input and output variables, approval Steps to "manually" sign off on releases, and more!
Current open feature requests, bug reports, and general issues can be found via the core/pipeline label on GitHub!