Skip to content

ashconnor/waypoint-plugin-s3

Repository files navigation

Waypoint Plugin Template

This folder contains an example plugin structure which can be used when building your own plugins.

Steps

  1. To scaffold a new plugin use the ./clone.sh script passing the destination folder and the Go package for your new plugin as parameters
./clone.sh myplugin ../destination_folder github.com/myorg/mypackage
  1. You can then run the Makefile to compile the new plugin, the Makefile will build the plugin for all architectures.
cd ../destination_folder

make
Build Protos
protoc -I . --go-grpc_out=. ./builder/output.proto
protoc -I . --go-grpc_out=. ./registry/output.proto
protoc -I . --go-grpc_out=. ./platform/output.proto
protoc -I . --go-grpc_out=. ./release/output.proto

Compile Plugin
# Clear the output
rm -rf ./bin
GOOS=linux GOARCH=amd64 go build -o ./bin/linux_amd64/waypoint-plugin-mytest ./main.go 
GOOS=darwin GOARCH=amd64 go build -o ./bin/darwin_amd64/waypoint-plugin-mytest ./main.go 
GOOS=windows GOARCH=amd64 go build -o ./bin/windows_amd64/waypoint-plugin-mytest.exe ./main.go 
GOOS=windows GOARCH=386 go build -o ./bin/windows_386/waypoint-plugin-mytest.exe ./main.go 

Building with Docker

To build plugins for release you can use the build-docker Makefile target, this will build your plugin for all architectures and create zipped artifacts which can be uploaded to an artifact manager such as GitHub releases.

The built artifacts will be output in the ./releases folder.

make build-docker

rm -rf ./releases
DOCKER_BUILDKIT=1 docker build --output releases --progress=plain .
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s

#...

#14 [export_stage 1/1] COPY --from=build /go/plugin/bin/*.zip .
#14 DONE 0.1s

#15 exporting to client
#15 copying files 36.45MB 0.1s done
#15 DONE 0.1s

Building and releasing with GitHub Actions

When cloning the template a default GitHub Action is created at the path .github/workflows/build-plugin.yaml. You can use this action to automatically build and release your plugin.

The action has two main phases:

  1. Build - This phase builds the plugin binaries for all the supported architectures. It is triggered when pushing to a branch or on pull requests.
  2. Release - This phase creates a new GitHub release containing the built plugin. It is triggered when pushing tags which starting with v, for example v0.1.0.

You can enable this action by clicking on the Actions tab in your GitHub repository and enabling GitHub Actions.

About

Hackathon Waypoint S3 Plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published