Pipeline

A Pipeline is the only unit of execution in Bob. A pipeline consists of the following:

Image

Bob implements a pipeline as a series of steps carried out on a starting container image. This image is used to set the context of the build and is used to get the prerequisites like compilers, build tooling, deployment tooling etc.

Always use a fully qualified name to denote the registry to be downloaded from.

Examples:

A List of Steps

A Step is essentially a key-value pair consisting of the following keys:

Example: cargo build in case the rust Docker image being used.

Example:

{ "needs_resource": "app-source-code" }

Example:

{
  "produces_artifact": {
    "path": "target/app.jar",
    "name": "app-jar",
    "store": "s3"
  }
}

Vars

Vars is a map of key-value pairs which denotes the environment variables that is to be available to all the steps of the pipeline.

Example:

{
  "user": "wendy",
  "env": "prod"
}

List of Resources

Resources is a list of key-value pairs which defines the list of Resources which may be consumed by one or more of the steps of the pipeline.

Full working pipeline example

{
  "image": "docker.io/library/busybox:musl",
  "vars": {
    "env": "test",
    "url": "test.com"
  },
  "steps": [
    {
      "cmd": "echo hello"
    },
    {
      "cmd": "sleep 10"
    },
    {
      "cmd": "sh -c 'touch test.txt && echo $env >> test.txt'"
    },
    {
      "cmd": "cat test.txt",
      "produces_artifact": {
        "name": "afile",
        "path": "test.txt",
        "store": "local"
      }
    },
    {
      "needs_resource": "my-source",
      "cmd": "ls",
      "produces_artifact": {
        "name": "license-file",
        "path": "LICENSE",
        "store": "local"
      }
    }
  ],
  "resources": [
    {
      "name": "my-source",
      "type": "external",
      "provider": "git",
      "params": {
        "repo": "https://github.com/bob-cd/bob",
        "branch": "main"
      }
    },
    {
      "name": "another-source",
      "type": "external",
      "provider": "git",
      "params": {
        "repo": "https://github.com/into-docker/clj-docker-client",
        "branch": "main"
      }
    }
  ]
}