Convert bitbucket-pipelines.yml to waypoint.hcl

I am considering the possibility of using Waypoint for doing builds (as well as deploys and releases). Currently all of the projects that I manage are using BitBucket Pipelines for builds. Here is an example of a bitbucket-pipelines.yml file:

image: golang:1.18.4-bullseye

pipelines:
  default:
  - step:
      script:
      - git config --global url."git@bitbucket.org:".insteadOf https://bitbucket.org/
      - make image
      caches:
      - golang

  tags:
    '*':
    - step:
        script:
        - git config --global url."git@bitbucket.org:".insteadOf https://bitbucket.org/
        - docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" "${DOCKER_SERVER}"
        - VERSION="${BITBUCKET_TAG}" make publish
        caches:
        - golang

clone:
  depth: 1

options:
  docker: true

definitions:
  caches:
    golang: /go/pkg/mod

From what I have read, the closest equivalent to this in Waypoint is the waypoint.hcl file.

I have been reading through the waypoint.hcl documentation to familiarize myself with the different nuances.

I do not have any specific questions at the moment, only a general question. Are there any guides/tutorials that would help someone like myself become more conversant in the ways of the waypoint.hcl file coming from the perspective of being a bitbucket pipelines user?

It appears that there is no builtin mechanism for doing custom builds of Go binaries, or for using Make. Everything in Waypoint appears to be geared toward using Docker images.

I see that I can create my own plugin to use with the build stanza of the waypoint.hcl file. If I am creating my own builder plugin, I might as well just build my own CI/CD mechanism and leave Waypoint to the intended target audience.

Ah, I see that the waypoint-plugin-examples project has a custom Go build plugin example. Well played. I will have a Go :wink: at it and see how it works out.

1 Like

Hey @SunSparc! Is your BitBucket pipeline building a binary file with go build? I could not glean that from the yaml you shared, but based on your subsequent responses I had a feeling that’s what you could be doing.

@paladin-devops, yes, the pipeline is doing a go build.

@SunSparc Great! The plugin you mentioned from the waypoint-plugin-examples repo is definitely a good place to get started then. :slight_smile: Would your next objective then be to publish the Go binary in a registry, presumably hosted on BitBucket (I believe the service is called BitBucket Downloads)?

Following the yml file I posted, yes, it is currently setup to publish an image to a Docker compatible repository.

However, I would likely be just storing the built binary in a local cache or perhaps a remote S3 compatible file store.

1 Like

@SunSparc Got it! The docker registry plugin should enable your current workflow then, as it is capable of publishing Docker image builds to a remote registry!

Regarding storing the binary to a local cache or an S3 file store, the plugins which are built-in to Waypoint don’t have that capability; however a custom plugin could be created to do this! A while back, I made a registry plugin for publishing files to a GitLab generic registry, but BitBucket downloads or S3 would be cool too!

1 Like

Ah, I see that Waypoint has introduced their own pipeline mechanism. I will look into this further.

1 Like