Introduction

Buildkite works very similarly to Github actions. I recently was introduced to Buildkite and wanted to write an introduction to it. Here is a page outlining some differences between Buildkite and Github actions:

https://buildkite.com/compare/github-actions

The website can be found here. Accounts are free and you can setup your own agent for builds with it. I will outline two methods for defining a pipeline. The first will be the UI way from the website, and the next will be in YAML.

UI Pipeline

Once you login you will see your pipelines along with a “+” sign to create a new one.

There are many different things you can do in this UI. We will run shell commands to build prep and building the deb file. Here is what my settings look like:

Notice it creates webhooks for you which is incredibly helpful.

YAML Pipeline

The same pipeline above can be created using this YAML:

steps:
  - command: "make build-deb-setup"
    label: "build-prep"
    branches: "master"
    concurrency: 1
    concurrency_group: "build-setup"

  - command: "make build-deb"
    label: "build"

On the right side while editing the YAML you can see guides to doing different things in the YAML.

This allows you to create pipelines fairly quickly. This is incredibly similar to the Github actions edit screen.

Adding an Agent

The last step to run this test pipeline is to create an agent. I created my agent in a Docker container using the image buildkite/agent. I define my in terraform but the following would be the bare minimum to get this up and running:

docker run -it \
  -v "$HOME/buildkite-agent.cfg:/buildkite/buildkite-agent.cfg:ro" \
  buildkite/agent:ubuntu

buildkite-agent.cfg is a config for the agent. Here is my config as an example:

token="yourtokenhere"
name="my-app-%n"
tags="ci=true,docker=true"
git-clean-flags="-ffdqx"
debug=true
build-path=/tmp

You need to add your own token here from your account on buildkite.com. I found mine on the agent add page. This is a sensitive field so make sure to keep that private. To add special packages to the agent for builds you will need to build your own image from the buildkite/agent image.

Here is what the pipeline looks like after a successful build.