Getting Started
This document is meant to help you to run Bob locally on some popular platforms
Running Bob on other platforms
Checkout the bob-deploy repo for reference deployments on various platforms
Running a local Bob cluster on Podman or 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.
- Download Podman or Rootless Docker
- Fetch this docker-compose.yml file with
curl -LfO 'https://raw.githubusercontent.com/bob-cd/bob-deploy/main/docker-compose.yml'
- In the same directory, start the cluster using podman-compose or docker-compose:
podman-compose up
or
docker-compose up
- 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 curl or HTTPie 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 assumes the above steps have been followed and a Bob cluster is available on http://localhost:7777
. A 2xx response here signifies success.
- Test if Bob is ready:
curl "http://localhost:7777/can-we-build-it?"
should respond:
{ "message": "Yes we can! 🔨 🔨" }
- Create a pipeline creation request body in a file
pipeline.json
, set theGOOS
andGOARCH
values according to your OS:{ "group": "dev", "name": "pipeline1", "image": "docker.io/library/golang:latest", "steps": [ { "needs_resource": "source", "cmd": "go test" }, { "needs_resource": "source", "vars": { "GOOS": "darwin", "GOARCH": "amd64" }, "cmd": "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" } } ] }
- Create the pipeline:
curl -X POST -d@pipeline.json -H "Content-Type: application/json" http://localhost:7777/pipelines/groups/dev/names/pipeline1
- Register the resource provider:
curl -X POST -d'{"url": "http://resource:8000"}' -H "Content-Type: application/json" http://localhost:7777/resource-providers/resource-git
- Register the artifact store:
curl -X POST -d'{"url": "http://artifact:8001"}' -H "Content-Type: application/json" http://localhost:7777/artifact-stores/local
- Start the pipeline:
curl -X 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. - Follow the events of the run via SSE:
curl -H "Accept: text/event-stream" http://localhost:7777/events
should respond with JSON encoded events, hit ctrl-c to close it:
data: {"run-id":"r-0ef66ba9-e397-461b-a6d9-f52f91889264","type":"pipeline","event":"pull","group":"dev","name":"pipeline1","timestamp":1699339368930}
This is ideal for UIs/CLIs reacting to changes in the cluster.
- Check the pipeline status with the run id:
curl http://localhost:7777/pipelines/status/runs/r-0ef66ba9-e397-461b-a6d9-f52f91889264
should respond:
{ "message": "running" }
- See the logs of the run at any time:
curl http://localhost:7777/pipelines/logs/runs/r-0ef66ba9-e397-461b-a6d9-f52f91889264/offset/0/lines/50
- If all goes well, eventually it should respond with a
passed
status with the same status call as above. - Download the produced artifact:
curl -o artifact.tar http://localhost:7777/pipelines/groups/dev/names/pipeline1/runs/r-0ef66ba9-e397-461b-a6d9-f52f91889264/artifact-stores/local/artifact/app
- Extract the TAR file:
tar xvf artifact.tar
- Test the executable file. Running following command should give “Hello Casey”
./app