function61 / turbobob

Modern, minimal container-based build/development tool to make any project´s dev easy and frictionless.
https://function61.com/
Apache License 2.0
7 stars 0 forks source link
build-system build-tool builder-pattern continuous-integration

Build status Download

Modern, minimal container-based build/development tool to make any project´s dev easy and frictionless.

Think like GitHub actions, but actually runnable locally (and also runnable from GitHub actions).

Note: while Bob uses containers for builds (and dev), your programs themselves don't need to use containers!

In a nutshell

flowchart TD
    GitHub[GitHub actions] --> Build_from_ci[Build from CI]
    GitLab[GitLab CI] --> Build_from_ci
    OtherCI[... CI] -->|In each CI: small boilerplate\nCI-specific conf to ask\nBob to do the build| Build_from_ci
    Build_from_ci -->|$ bob build in-ci-autodetect-settings| TurboBob
    Build_locally[Build locally] -->|$ bob build| TurboBob
    Develop_locally[Develop locally] -->|$ bob dev| TurboBob
    TurboBob[Turbo Bob<small>\ncontainer-based\nbuild orchestration</small>] -->|$ docker run ...| Docker

Notes:

Small demo screencast

Features

Additional documentation

What is this?

Turbo Bob (the builder) is an abstraction for building and developing your software, whether it happens in your laptop or in a CI system.

Usage of Turbo Bob, in every project you're developing:

$ bob dev

This gives you a shell inside the build environment container with the working directory mounted inside the container so that you can directly edit your code files from your host system.

To build your project:

$ bob build

By keeping these commands consistent across each project we'll minimize friction with mental context switching, since the commands are the same for each project whether you're building a Docker-based image or running anything custom that produces build artefacts.

There's a document that your project can link to for build & help instructions. This explains Bob's value proposition quite well and serves as the first introduction for new Bob users. See an example of a project's build docs linking to Bob.

Philosophy

Install

Linux

Requires Docker for use, so currently only Linux is supported. Native Windows support might come later as Windows' Linux subsystem keeps maturing.

$ sudo curl --location --fail --output /usr/bin/bob https://function61.com/go/turbobob-latest-stable-linux-amd64 && sudo chmod +x /usr/bin/bob

Windows

I have used Turbo Bob in Windows through Vagrant (= run Linux in VM) quite succesfully for years.

I can edit my project files from the Windows host and those changes reflect inside the container just fine, though the Linux setup is definitely simpler and has less moving parts. The setup looks like this:

Vagrant setup diagram

Mac

I have no experience whatsoever with Mac, but I hear Vagrant works on Mac so maybe it works the same way I described it works on Windows.

Supported build/CI platforms

Basic approach anywhere:

  1. Have Docker installed
  2. If you don't have Turbo Bob installed, download it
  3. Run $ bob build (i.e. hand off build to it)

Your own computer

If your system can run Docker locally, you can build projects on your own computer.

GitHub actions

See example actions workflow file.

GitHub actions' design is pretty similar to Turbo Bob's design ("run stuff inside containers"). I started this project before actions was announced, so unfortunately there's currently no synergy with these projects. I'd like to research if Bob concepts could directly be mapped into actions' concepts (perhaps you could just generate actions' workflow file from turbobob.json).

GitLab

I've built projects on GitLab's public runners with Bob. See example configuration.

Other CI systems, vendor lock-in

Bob's approach is pretty generic (as documented under the above larger heading).

Here's a commit demonstrating how portable Bob is by moving from Travis CI -> GitHub actions - how it's just from small boilerplate to small boilerplate. This prevents vendor lock-in. (NOTE: GitHub actions boilerplate has since been updated).

If you've added support to other public CI systems, please add links to here for instructions!

Examples / how does it work?

NOTE: The easiest way to understand is to read "Using Bob in your project" first!

Examples

Look for the turbobob.json file in each of these example repos. Most of them use multiple container images ("buildkits") for builds:

How does turbobob.json work?

The process is exactly the same whether you use a different CI system. You can even run builds exactly the same way on your laptop by just running $ bob build.

This very project is built with Bob on GitHub actions. The workflow configuration is minimal. Here's what happens when a new commit lands in this repo:

Why multiple buildkits?

If your project e.g. uses Go for backend and TypeScript for frontend, it's hygienic to keep the build tools separate so:

p.s. "buildkit" is not a Turbo bob concept per se. It just means "a container image with tooling". You can probably use images with Turbo Bob that aren't designed with Turbo Bob in mind.

Alternative software

These technologies have some overlap with Turbo Bob: