Getting Started

This document is meant to help you to run Bob locally on Docker and some other popular platforms

Running Bob on other platforms

Checkout the bob-deploy repo for reference deployments on various platforms

Running a local Bob cluster on Docker

To get a minimal setup running locally (with a simple Github public repo and file system based storage), we will run bob, resource-git and artifact-store.

  1. Download Docker
  2. Fetch this docker-compose.yml file with curl -LfO 'https://raw.githubusercontent.com/bob-cd/bob/main/docker-compose.yml'
  3. In the same directory, start the cluster using docker-compose:
    docker-compose up
    
  4. When it all comes up, bob should be available on port 7777

Using the API

Bob exposes itself fully via a REST API as described here A HTTP client like HTTPie, curl or Insomnia is recommended to use.

The reference CLI for Bob: Wendy is under construction and should be ready soon! Any PRs and help on Wendy is much much appreciated!

Building a simple project on Bob

This uses HTTPie and assumes the above steps have been followed and a Bob cluster is available on http://localhost:7777. A 200/202 response here signifies success.

  1. Test if Bob is ready:
    http http://localhost:7777/can-we-build-it?
    

    should respond:

    {
      "message": "Yes we can! 🔨 🔨"
    }
    
  2. Create a pipeline creation request body in a file pipeline.json, set the GOOS and GOARCH values according to your OS:
    {
      "group": "dev",
      "name": "pipeline1",
      "image": "docker.io/library/golang:alpine",
      "steps": [
        {
          "needs_resource": "source",
          "cmd": "go test"
        },
        {
          "needs_resource": "source",
          "cmd": "sh -c 'GOOS=darwin GOARCH=amd64 go build -o app'",
          "produces_artifact": {
            "name": "app",
            "path": "app",
            "store": "local"
          }
        }
      ],
      "resources": [
        {
          "name": "source",
          "type": "external",
          "provider": "resource-git",
          "params": {
            "repo": "https://github.com/lispyclouds/bob-example",
            "branch": "main"
          }
        }
      ]
    }
    
  3. Create the pipeline:
    cat pipeline.json | http POST http://localhost:7777/pipelines/groups/dev/names/pipeline1
    
  4. Register the resource provider:
    http POST http://localhost:7777/resource-providers/resource-git url="http://resource:8000"
    
  5. Register the artifact store:
    http POST http://localhost:7777/artifact-stores/local url="http://artifact:8001"
    
  6. Start the pipeline:
    http POST http://localhost:7777/pipelines/start/groups/dev/names/pipeline1
    

    should respond with a run id like this:

    {
      "message": "r-0ef66ba9-e397-461b-a6d9-f52f91889264"
    }
    

    This run-id is like a tracing id, all subsequent interactions can be done with this.

  7. Check the pipeline status with the run id:
    http http://localhost:7777/pipelines/status/runs/r-0ef66ba9-e397-461b-a6d9-f52f91889264
    

    should respond:

    {
      "message": "running"
    }
    
  8. See the logs of the run at any time:
    http http://localhost:7777/pipelines/logs/runs/r-0ef66ba9-e397-461b-a6d9-f52f91889264/offset/0/lines/50
    
  9. If all goes well, eventually it should respond with a passed status with the same status call as above.
  10. Download the produced artifact:
    http http://localhost:7777/pipelines/groups/dev/names/pipeline1/runs/r-0ef66ba9-e397-461b-a6d9-f52f91889264/artifact-stores/local/artifact/app > artifact.tar
    
  11. Extract the TAR file:
    tar xvf artifact.tar
    
  12. Test the executable file. Running following command should give “Hello Casey”
    ./app