Skip to content
codeband is pre-release. These docs describe its first release, and some of what they describe is still being built.

Repository cache

A repository cache is a read-only copy of a target repository’s history that a sandbox uses, so that the engine sends the sandbox only the commits that it lacks.

A sandbox shares no folder with the daemon’s machine, so every commit that its workspace needs travels into it. The Go repository, for example, has 770 MiB of history. With the cache, a new container of kind docker holds the start commit of the Go repository in its workspace after 2 seconds.

Each sandbox has a git repository of its own, which holds the workspace. The engine sends the start commit in and fetches the end commit out with git’s own transfer, through the input and output of a git program in the sandbox, as git does over SSH. Nothing in the sandbox calls the daemon.

  1. At the start of an attempt, the engine sends the start commit into the sandbox’s repository. The repository reads old commits from the repository cache, so only the commits that it lacks travel. Git in the sandbox writes the files of the start commit to the workspace.
  2. The harness runs, and its agent changes the files of the workspace.
  3. When the harness ends, git in the sandbox commits the files that the agent left uncommitted.
  4. The engine fetches the end commit out of the sandbox, checks it and keeps it on a hidden ref in the daemon’s bare clone.

An agent can write hooks and config entries into the repository that it works in, and git runs them. Every git command on the workspace therefore runs in the sandbox, and the daemon never runs git on files that an agent wrote. A sandbox never holds a login that can push: a code change leaves codeband only through its run result destination.

Kind Repository cache
docker One Docker volume for each target repository, which each sandbox mounts read-only. The daemon copies the history into it once, and before the first sandbox of each run it adds the commits up to the run’s start commit. No setting turns it off
host The daemon’s bare clone of the target repository

The cache holds only git objects, which their IDs name by their content, so an agent step sees the same files with or without it. The reference of the kind docker names the volume and its folder in the container.

A sandbox is ready for its attempt or shell step within 1 to 5 seconds, for a large repository too. On Docker Desktop for macOS, the first copy of the 770 MiB of the Go repository’s history into the volume takes about a minute, and 500 new commits take about 4 seconds. The volume takes about as much disk space as the history.

The cache holds the whole history of the target repository, and an agent can read all of it, not only the files of its start commit.

A volume stays after the run and after the daemon stops. When you delete it with docker volume rm, the next run builds it again.