»Integrating Waypoint with Jenkins

Using Waypoint to deploy an application from within Jenkins is similar to how you might deploy an application from your own workspace.

Your Jenkins runner must have Waypoint installed to execute it in a step. This can be accomplished by installing Waypoint on the runner using the standard installation instructions such as from the Waypoint apt repository. In addition, any dependencies such as authentication details or anything else required by Waypoint plugins must be available in the execution environment.

Note that this example assumes use of a declarative pipeline.

»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 using something like the git parameter plugin, as demonstrated below:

stage('waypoint build') {
    steps {
        sh 'waypoint build -workspace "${params.BRANCH}"'
    }
}

»Example

pipeline {
    agent any

    // Assumes you are deploying a Node.js application
    tools { nodejs "default" }

    environment {
        WAYPOINT_VERSION = '0.1.0'
        WAYPOINT_SERVER_ADDR = ''
        WAYPOINT_SERVER_TOKEN = ''
        WAYPOINT_SERVER_TLS = '1'
        WAYPOINT_SERVER_TLS_SKIP_VERIFY = '1'
    }

    stages {
        stage('waypoint init') {
            steps {
                sh 'waypoint init'
            }
        }

        stage('waypoint build') {
            steps {
                sh 'waypoint build'
            }
        }

        stage('waypoint deploy') {
            steps {
                sh 'waypoint deploy'
            }
        }

        stage('waypoint release') {
            steps {
                sh 'waypoint release'
            }
        }
    }
}