Volumes

A saved disk that starts a job with what the last run on your default branch left behind.

#What volumes do

A job of an opted-in private repository starts with a second disk. The disk holds what the last successful run of the same job on the default branch saved. The machine still boots a fresh system disk. If the disk fails to mount or unlock, the job runs without it.

Volumes help jobs that rebuild large state on every run:

  • Docker image builds that reuse layers.
  • Jobs that fetch the whole git history with fetch-depth: 0.
  • Incremental compiled builds, such as Rust, with the build output in a saved directory.

A job that installs a few small packages gains nothing. Each job measures whether its disk helps and drops it when it does not. Volumes work beside the dependency cache and replace nothing.

#Turn them on

Volumes are off by default. On the Volumes page, an owner turns on Use volumes, picks the Repositories that may use a disk, and clicks Save. The page lists each saved disk with a Clear button. Members can read the page.

Turning volumes off, or taking a repository off the list, starts the deletion in that same call, and it is finished about an hour later.

#Which jobs get a disk

The repository must be private and on your list. Public repositories never get a disk. Opting in does not change where your job runs. If its provider has no volume support, it runs without a disk.

Who reads and who saves a disk
The job runs forIt reads the diskIt saves a disk
A push, a schedule or a manual run on the default branchYesYes, when it succeeds
Another branch, or a pull request from the same repositoryYesNo
A pull request from a forkNoNo
pull_request_target, workflow_run, issue_comment and review eventsNoNo

Each job of each workflow has its own disk.

#What is saved

  • ~/.cache, ~/.npm, ~/.cargo/registry, ~/.cargo/git, ~/go/pkg/mod, ~/.gradle/caches and ~/.m2/repository
  • Docker's data root: its images, layers and build cache.
  • A copy of the git history. actions/checkout reuses it with fetch-depth: 0.

The workspace is not saved. actions/checkout cleans it before each fetch. Put build output under ~/.cache. For Rust:

.github/workflows/ci.yml
steps:
  - uses: actions/checkout@v4
  - name: Keep build output in a saved directory
    run: echo "CARGO_TARGET_DIR=$HOME/.cache/cargo-target" >> "$GITHUB_ENV"
  - run: cargo build

#Encryption

The disk is encrypted with LUKS2. CI Router gives the machine the key only after GitHub reports that the runner is on the job it was started for. A runner that took another job never gets the key and runs without a disk. The key stays in memory and is never written to a file or a log.

#Keep or drop

Runs alternate between starting with the disk and without it, until there are five of each. The disk is kept when runs with it finish sooner at the median. Every tenth run starts without the disk, to keep checking. A dropped disk is deleted, and the job is measured again after 7 days.

#A disk that keeps failing

A saved disk is deleted when:

  • It fails to open or mount on two runs in a row, or
  • Jobs on the default branch (push, schedule or manual run) fail or time out with it two times in a row.

A failing pull request or feature-branch job never counts. The next default-branch run starts from a fresh disk.

#Retention and cost

Retention and limits
ItemValue
One disk20 GiB.
Storage per team50 GiB. A new disk replaces the disks used least recently. If that does not make room, the new disk is not saved.
A disk expires7 days after its last use.
Deletion starts at onceWhen volumes are turned off, a repository leaves the list or the GitHub App, or an owner clears a disk. It finishes within about an hour.
Deleted after failuresAfter the failures listed above. The next default-branch run starts from a fresh disk.

Volume storage is not charged. Job charges and the credit check before a job starts stay the same. A team that cannot pay for jobs saves no disk.

Where a disk is saved as a sealed archive instead of a block device, the machine of a default-branch run stays up after the job to seal and copy the cache out. That hold is part of the run's billed machine time: in our measurements a run that saves a disk was billed about 16 seconds more than a run without one. Pull request and feature-branch runs are not held.

#Check a run

The Volumes page shows each saved disk: whether it is measured, kept or dropped, the median run times with and without it, its size and its last use. The job receipt of a run has a volume block. Its mode is cold, warm or published, and its reason says why:

Reasons in the volume block
ReasonWhat it means
forkThe run started with the saved disk.
freshThe run started with an empty disk and saves the first one.
team_disabledVolumes are off for your team.
repo_not_allowedThe repository is not on your list.
public_repoThe repository is public.
lookup_failedGitHub did not say in time what the job runs for. The job ran without a disk.
untrusted_writerThe run comes from a fork, Dependabot or an unknown actor.
untrusted_eventThe event never gets a disk, such as pull_request_target.
gate_droppedThe disk does not make this job faster. It is measured again after 7 days.
probeA planned run without the disk, to compare run times.
no_headNo disk exists for this job, and this run cannot save one.
key_rotatedThe encryption key changed. The old disk was cleared.
fork_refusedThe saved disk could not be used and was set aside.
environment_jobThe job may use a deployment environment, which never gets a saved disk, so the run started without it.
briq_missThe provider could not give this run the saved disk (busy, out of room, or not ready yet), so it started without it.
size_mismatchThe saved disk was made for a different machine size, so the run started without it.
internal_errorSomething failed while deciding. The job ran without a disk.
mount_failed:...The disk was attached but did not mount.

On a default-branch run, publish says what happened to the new disk: none, pending, snapshotting, published, or discarded: followed by a reason. The reasons are not_sealed, not_success, crossed, stale_revision, lineage_inactive, unpaid, setting_off, team_cap, total_cap, snapshot_error, lost_race, no_volume, transfer_failed, hold_expired and too_large.

#API

An API key can do everything the Volumes page does. See the API overview for keys.

GET/v1/volumes/settings

The switch and the repositories.

PATCH/v1/volumes/settings

Change the switch or the repository list. Send only the fields to change.

Body
NameTypeDescription
enabledbooleanTurn volumes on or off.
repositoryIdsinteger[]GitHub repository ids. The whole list after the change. Up to 500.
Turn on
curl -X PATCH https://api.ci-router.com/v1/volumes/settings \
  -H "Authorization: Bearer sk-cir_..." \
  -H "Content-Type: application/json" \
  -d '{ "enabled": true, "repositoryIds": [123456] }'

An id outside your installations answers 400 unknown_repository.

GET/v1/volumes/lineages

The saved disks, one per job. gate.state is measuring, keep or drop.

DELETE/v1/volumes/lineages/{id}

Clear one saved disk. The body repeats the id: { "confirm": "<id>" }.

GET/v1/volumes/usage

The storage kept for your team, per repository and day.

Volumes | CI Router docs