Skip to content

Block-level snapshots

Since v2.8.3, RunsOn supports block-level snapshots. This is a new feature that allows you to save and restore entire folders with block-level snapshots. This is particularly useful for speeding up docker builds in your GitHub Actions workflows.

The snapshotting feature is performed by a dedicated action: runs-on/snapshot@v1. This action is used to create a snapshot of an entire folder at the end of a job, and restore it at the beginning of the next.

name: Docker build with snapshots
jobs:
long-docker-build:
runs-on: runs-on=${{ github.run_id }}/runner=2cpu-linux-x64
steps:
- uses: actions/checkout@v4
- uses: runs-on/snapshot@v1
with:
path: /var/lib/docker
- uses: docker/setup-buildx-action@v3
with:
name: runs-on
keep-state: true
- uses: docker/build-push-action@v4
with:
context: .
InputDescriptionRequiredDefault
pathPath to the directory to snapshot. Must be an absolute path.Yes-
versionVersion of the snapshot to use. Can be bumped to force a new initial snapshotNov1
volume_typeType of volume to use for the snapshotNogp3
volume_iopsIOPS to use for the volumeNo3000
volume_throughputThroughput to use for the volumeNo750
volume_sizeSize (in GiB) of the volume to use for the snapshotNo40
volume_initialization_rateInitialization rate to use for the volume. Useful for very large volumes. 100 MB/s - 200 MB/s: $0.00240/GB, 201 MB/s - 300 MB/s $0.00360/GBNo0
wait_for_completionWait for snapshot completion before exiting. Note that the first snapshot will always be waited forNofalse

When restoring a snapshot, the most recent snapshot for the current branch is fetched. If none is found, the most recent snapshot for the repository default branch will be taken. If none found, a new empty volume is used instead.

Volume and snapshot cleanup is performed by the RunsOn service that lives in your AWS account.

Only the latest snapshot from a branch is kept, and volumes are deleted 20 minutes after the snapshot has been taken.

Snapshots older than 10 days are always removed (in case the branch no longer see any activity).

  • On the first run, there will be an additional delay because the action will forcibly wait for the completion of the first snapshot, which takes the most time (further snapshots are incremental). This is technically not required, but will be less confusing if a second job comes up right after and you start from an empty volume again, because the first snapshot is still being created.
  • Snapshot and restore speed is highly dependent on the volume type, iops, throughput, and used size. Feel free to experiment with those. Default values are a balance between good speed, and very low price.