No description
  • Go 99.2%
  • Makefile 0.5%
  • Dockerfile 0.2%
  • Nix 0.1%
Find a file
hc-github-team-es-release-engineering dcdb2a03f7
Convert hashicorp/waypoint-plugin-sdk to GitHub Actions (#85)
* Adding workflow .github/actions/notify_main_failure/action.yml
.github/workflows/go-tests.yml

* SHA-pin all 3rd-party actions

* Restrict workflow permissions

* Add actionslint

* Add dependabot

Restore checks after figuring out the go-test.yml file

* restore circle for now

* add correct circle ci

* sha1 pin setup-protoc

* try manual protoc install

* fix path and format

* unzip off stdin

* try bsdtar

* try tar

* back to unzip

* use correct home

* restore other jobs

* remove failure notification action

* double quote GITHUB_PATH

* fixup: Enable running on main, with alerting on failures

* fixup: Make protoc install step one step

* fixup: private actions are not accessible from public repos

* remove circle

* Revert "fixup: private actions are not accessible from public repos"

This reverts commit 3296d20bd4.

---------

Co-authored-by: catsby <clint@ctshryock.com>
Co-authored-by: Daniel Kimsey <daniel.kimsey@hashicorp.com>
2023-04-12 16:08:08 -05:00
.github Convert hashicorp/waypoint-plugin-sdk to GitHub Actions (#85) 2023-04-12 16:08:08 -05:00
component More linter pacifying 2022-12-08 13:55:36 -05:00
datadir Fix lint error for dir test 2021-03-18 14:41:51 -07:00
docs Mark blocks with all optional fields as optional 2023-01-25 10:02:03 -08:00
framework Fixed a panic where m.dtr is nil 2022-09-16 10:44:17 -04:00
internal Comment update & error check for destroy. 2022-08-15 13:07:26 -04:00
internal-shared Add component.BuildODR and component.RegistryAccess 2021-08-16 10:51:25 -07:00
proto Add json configvar outputs 2022-12-22 16:27:24 -06:00
terminal Pacifying the linter 2022-12-08 13:46:21 -05:00
thirdparty/proto 3rdparty -> thirdparty 2021-06-08 11:14:34 -04:00
tools Convert hashicorp/waypoint-plugin-sdk to GitHub Actions (#85) 2023-04-12 16:08:08 -05:00
.envrc shell.nix 2020-10-05 14:33:57 -07:00
.gitignore WP#2060 - Add sequence to deployConfig 2021-09-14 19:23:40 +12:00
.gitmodules 3rdparty -> thirdparty 2021-06-08 11:14:34 -04:00
.go-version Convert hashicorp/waypoint-plugin-sdk to GitHub Actions (#85) 2023-04-12 16:08:08 -05:00
flake.lock update flake 2022-04-26 11:29:43 -07:00
flake.nix Use flakes to copy Waypoint's environment 2021-06-10 20:12:49 -07:00
go.mod Upgrade to go 1.19 2022-12-08 10:55:49 -05:00
go.sum Switch over to the separate grpc generator 2022-03-21 12:52:38 -07:00
LICENSE [COMPLIANCE] Update MPL 2.0 LICENSE 2022-10-11 23:23:40 +00:00
main.go More linter pacifying 2022-12-08 13:55:36 -05:00
Makefile Convert hashicorp/waypoint-plugin-sdk to GitHub Actions (#85) 2023-04-12 16:08:08 -05:00
README.md Generate protos with docker via make docker/gen 2022-12-06 17:24:53 -05:00
shell.nix Use flakes to copy Waypoint's environment 2021-06-10 20:12:49 -07:00
tools.Dockerfile Generate protos with docker via make docker/gen 2022-12-06 17:24:53 -05:00

Waypoint Plugin SDK

This repository is a Go library that enables users to write custom Waypoint plugins. Waypoint supports plugins for builders, deployment platforms, release managers, and more. Waypoint plugins enable Waypoint to utilize any popular service providers as well as custom in-house solutions.

Plugins in Waypoint are separate binaries which communicate with the Waypoint application; the plugin communicates using gRPC, and while it is theoretically possible to build a plugin in any language supported by the gRPC framework. We recommend that the developers leverage the Waypoint SDK.

Simple Plugin Overview

To initialize the plugin SDK you use the Main function in the sdk package and register Components which provide callbacks for Waypoint during the various parts of the lifecycle.

package main

import (
  sdk "github.com/hashicorp/waypoint-plugin-sdk"
)

func main() {

  sdk.Main(sdk.WithComponents(
    // Comment out any components which are not
    // required for your plugin
    &builder.Builder{},
  ))

}

Components are Go structs which implement the various lifecycle interfaces in the Waypoint SDK. The following example shows a plugin which Waypoint can use for the build lifecycle. Creating a build plugin is as simple as implementing the interface component.Builder on a struct as shown in the following example.

package builder

import (
  "context"
  "fmt"

  "github.com/hashicorp/waypoint-plugin-sdk/terminal"
)

type Builder struct {}

func (b *Builder) BuildFunc() interface{} {
  // return a function which will be called by Waypoint
  return func(ctx context.Context, ui terminal.UI) (*Binary, error) {
  u := ui.Status()
  defer u.Close()
  u.Update("Building application")

  return &Binary{}, nil
  }
}

To pass values from one Waypoint component to another Waypoint component you return structs which implement proto.Message, generally these structs are not manually created but generated by defining a Protocol Buffer message template and then using the protoc and associated Go plugin to generate the Go structs.

The following example shows the Protocol Buffer message template which is used to define the Binary struct which is returned from the previous example.

syntax = "proto3";

package platform;

option go_package = "github.com/hashicorp/waypoint-plugin-examples/template/builder";

message Binary {
  string location = 1;
}

For more information on Protocol Buffers and Go, please see the documentation on the Google Developers website.

https://developers.google.com/protocol-buffers/docs/gotutorial

For full walkthrough for creating a Waypoint Plugin and reference documentation, please see the Extending Waypoint section of the Waypoint website.

Example Plugins

Please see the following Plugins for examples of real world implementations of the Waypoint SDK.

Build

Docker Build Packs

Registry

Amazon ECR Docker Files

Deploy

Nomad Nomad Jobspec Kubernetes kubectl Apply Helm Docker Azure Container Interface Google Cloud Run Amazon EC2 Amazon ECS

Release

Kubernetes Google Cloud Run Amazon ALB

Config Sourcers

Terraform Cloud Vault

Contributing

Thank you for your interest in contributing! Please refer to CONTRIBUTING.md for guidance.

Installing Dependencies

To automate installing the required Golang packages needed to build Waypoint locally, run make tools.

Regenerating protobufs

Install dockern and run make docker/gen