Skip to content

A plugin for Hashicorp Waypoint that allows to deploy artifacts on Cloud Foundry

License

Notifications You must be signed in to change notification settings

swisscom/waypoint-plugin-cloudfoundry

Repository files navigation

waypoint-plugin-cloudfoundry

Plugin for waypoint that adds support for the Cloud Foundry platform.

Usage

Check out the project in the example folder to get an idea of how exactly to use the platform.

Cloud Foundry deployment

deploy {
   use "cloudfoundry" {
      organisation = "cf organisation"
      space = "waypoint-test"

      # App name can be overwritten, otherwise the application name from above is used.
      # app_name = "hello-world"

      # Make sure to create and rename this file, if needed
      # it should contain username:password as base64 encoded string
      docker_encoded_auth = file(abspath("./docker_encoded_credentials.secret"))

      # Defines an Health Check configuration
      health_check {
         type = "http" # required
         endpoint = "/health" # required if type = "http"
         timeout = 60
         invocation_timeout = 60
      }
}

Cloud Foundry release

release {
   use "cloudfoundry" {
      domain = "cfapp.swisscom.com"

      # Hostname can be specifically set, if it is different than the app name
      # hostname = my-example-app-url
      
      # To stop old instances of the app after release
      # stopOldInstances = true
   }
}

Initial setup

Mac OS

Install go: brew install go

Install protoc-gen-go: go get google.golang.org/protobuf/cmd/protoc-gen-go

Build: make

Install locally (make sure the folder $HOME/.config/waypoint/plugins/ exists, if not create beforehand): make install

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 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

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.