Skip to main content
Version: 0.7.0

Remote Caching

Bob's remote cache ensures faster completion of CI pipelines and boosts the performance of entire teams by never doing the same work twice.

A bob-managed-repository connected to a remote cache can pull build artifacts each time bob build is called, avoiding unnecessary rebuilds for tasks which have already been built by someone else.

We will show you how to connect your local repository to a remote cache and share access with your team.

Your First Project

A remote cache on bob.build is managed via what is called a "project". Think of a project similar to a git-remote. Each project has it's own unique URL similar to bob.build/john/todoapp.

First, create an account to manage your projects - Create a bob.build account.

To create your first project, go to the Dashboard and click on Create Your First Project:

img alt

Every project needs a name. You can use the same name as the one you use for your repository.

img alt

After you click Create, you are taken to a project overview page that explains how to connect your local repository to the project and create the access tokens.

After you create a project, make sure your repository is linked to it by adding this line to your bob.yaml.

project: bob.build/john/todoapp

In the next step you need to authorize bob to access your project.

Access Control

You can create access tokens from the Access Control Page by clicking on Create New Access Token button.

img alt

Access tokens can be bound to a specific project. If you leave the project empty, it is valid for all your projects. It is also possible to limit the permission of a token to "pull".

img alt

info

We recommend creating separate tokens for each of your team members. This makes it easier to revoke access individually. It is also recommended to use a project-specific token with the "artifact:push" permission for your CI pipeline.

Setting up a token locally

bob auth is the command which manages the access tokens.

To add a new "default" token use

bob auth init --token={token}

If you are working on multiple projects you can register multiple tokens by giving them names.

bob auth init todoapp --token={token}

If you're not sure what your current token is you can use bob auth ls to view all your access tokens:

$ bob auth ls
default (current)
todoapp

To switch to another token use bob auth switch:

$ bob auth switch todoapp
Switched to 'todoapp' context.

You can also update a token with bob auth update:

$ bob auth update todoapp --token=anotherValue
Context 'todoapp' updated.

Pushing & Pulling Artifacts

By default - when you run bob build - no artifact is pushed to the remote cache. To push artifacts use the --push flag:

$ bob build --push 
Using remote store: https://bob.build/john/todoapp
Running task build with 0 dependencies
Using 8 workers

build ...done

โ— โ— โ— โ—
Ran 1 tasks in 6.1ms
build โœ” (6.1ms)

build pushing artifact 5c5bb525f61c44ff 100% (276/276)

The pushed artifact will appear in your project overview

img alt

After a successful push, you can verify that everything is working as expected by performing a bob clean system followed by a bob build. This will pull artifacts from the remote cache and extract them to the desired location. You should only see cached tasks if everything went well.

$ bob build 
Using remote store: https://bob.build/john/todoapp
Running task build with 0 dependencies
Using 8 workers
build pulling artifact 5c5bb525f61c44ff 100% (276B/276B)

โ— โ— โ— โ—
Ran 1 tasks in 16.1ms
build cached

To disable pulling use the --no-pull flag.

Congratulations! Your remote cache is set up and you can now enjoy the benefits of never doing a build twice again!