Skip to content

Build Cache

Jobs on Quant CI runners keep their caches in Australia by default. You do not need to change your workflows.

The build cache holds what these steps save:

  • actions/cache
  • the cache: input of actions/setup-node, actions/setup-python, actions/setup-go, actions/setup-java and similar setup actions
  • Docker buildx cache-from: type=gha and cache-to: type=gha

Each pool’s caches are separate from every other pool’s. Repositories never share caches.

This job restores and saves npm packages and Docker build layers on a Quant pool:

jobs:
build:
runs-on: [self-hosted, quant, build, x64]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
# This step shows only the cache inputs. Add your tags and set push as you need.
- name: Build image
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
push: false
cache-from: type=gha
cache-to: type=gha,mode=max

Buildx type=gha needs the docker/setup-buildx-action step before build-push-action, because the default Docker driver cannot export a gha cache. On a pool set to Australia only, the cache entries stay in Australia.

The branch rules match GitHub’s.

Run Restores from Saves to
A push or other run on a branch or tag Its own branch or tag, then the default branch Its own branch or tag
A pull request refs/pull/<number>/merge, then the base branch, then the default branch refs/pull/<number>/merge
A pull_request_target run The base branch, then the default branch The base branch
A pull request from a fork, or a pull_request_target run that a fork started No cache No cache

A push to a new branch has no entries of its own, so it restores from the default branch. A pull request from a new branch restores from its base branch first.

A pull request from a fork of a private repository gets no Quant values and no build cache, so its build is cold.

  • A save to a key that already exists is refused, as on GitHub. Use a key that changes when the content changes, for example with hashFiles, and add restore-keys to restore an older entry.
  • Entries expire 14 days after they are saved.
  • An entry can be up to 10 GiB.

Each pool has a Cache residency setting with two options:

Option When a job starts and the pool’s cache service cannot serve it
Australia only (the default) The job runs without a cache: a restore is a miss and a save is skipped with a warning. Its artifact upload and download steps fail. The job never falls back to GitHub’s cache.
Allow GitHub fallback The job uses GitHub’s cache and artifact services directly.

With Australia only, cache data is never sent to GitHub’s cache storage.

This case is rare, because a runner machine whose cache service is not healthy takes no new jobs and is replaced automatically. If it happens on a pool with Australia only, run the job again.

You choose the setting on the create form, where Australia only is preselected. To change it later, choose Edit on the pool. A change applies to the next job each runner machine starts.

Artifacts from actions/upload-artifact and actions/download-artifact are still stored by GitHub. Job logs are also still stored by GitHub.

On a pool with Australia only, artifact uploads and downloads pass through the pool’s cache service on their way to GitHub.

Open Cloud → CI runners → Pools and choose a pool. The Build cache section loads when you choose Show build cache. It shows:

  • the storage used
  • the hit rate for the last 7 days: the hits divided by the hits plus the misses
  • the entries by repository and branch

If you can edit the pool, you can remove entries.

  • Delete entry removes one entry.
  • Clear branch removes the entries of one branch.
  • Clear repository removes the entries of one repository.
  • Clear cache removes every entry in the pool.

If Delete entry or Clear branch is not available for a ref, use Clear repository.

When you delete a pool, its cache is deleted too.