»Integrating Waypoint with CircleCI

Currently, using Waypoint to deploy an application from within Circle is similar to how you might deploy an application from your own workspace.

The example demonstrates the main steps:

  1. Set-up the dependencies Waypoint might use. This could be a Kubernetes context for a more advanced application, or in the below example, a Docker daemon to run applications on.
  2. Install Waypoint from the official source. If you are using a Docker custom image executor with your other deploy dependencies, you could utilize the public Docker image in a multi-stage build.
  3. Run waypoint init. This depends on the environment variables listed below and documented in the Automating Execution overview.
  4. Run the build, deploy, and release. In this case, instead of using waypoint up, it breaks out each stage as a separate command to be easier to read and filter through in the CircleCI UI.

»Workspaces

This example assumes the use of a single default workspace. If this was in a job triggered by a GitHub commit or pull request and may be an ephemeral development environment, you may want to interpolate the relevant Git ref for the workspace parameter, as demonstrated below:

run: waypoint build -workspace $CIRCLE_BRANCH

See the CircleCI built-in environment variables page for a full list of variables that could be utilized in this way.

»Example

---
version: 2.1

jobs:
  build:
    docker:
      - image: cimg/base:2020.01
    environment:
      # Use the appropriate version such as '0.1.1'
      WAYPOINT_VERSION: WAYPOINT_VERSION_HERE
      WAYPOINT_SERVER_ADDR: ''
      WAYPOINT_SERVER_TOKEN: ''
      WAYPOINT_SERVER_TLS: '1'
      WAYPOINT_SERVER_TLS_SKIP_VERIFY: '1'
    steps:
      # We're deploying to Docker for this example app,
      # so we need to setup a remote Docker instance
      - setup_remote_docker
      - checkout
      - run:
          name: Install Waypoint
          command: |
            wget -q -O /tmp/waypoint.zip https://releases.hashicorp.com/waypoint/${WAYPOINT_VERSION}/waypoint_${WAYPOINT_VERSION}_linux_amd64.zip
            sudo unzip -d /usr/local/bin /tmp/waypoint.zip
            rm -rf /tmp/waypoint*
      - run: waypoint init
      - run: waypoint build
      - run: waypoint deploy
      - run: waypoint release