useblacksmith/stickydisk is a GitHub Action that helps persist state written to disk across jobs. This action can serve as a superior alternative to the Actions cache, especially when the cache artifacts are extremely large. Each sticky disk is hot-loaded into the runner and mounted at the specified path. The sticky disk is formatted as an ext4 filesystem.

Cache Performance Comparison

Caching SolutionCache SizeAverage Download SpeedTime to Access
GitHub Actions Cache6GB90 MB/s~1m6s
Blacksmith Cache6GB400 MB/s~15s
Sticky Disks6GBN/A3 seconds

Use Cases

NPM Package Caching

Node.js projects can have extensive dependency trees, leading to large node_modules directories. Sticky disks provide persistent, high-performance storage for your NPM packages.

jobs:
  build:
    runs-on: blacksmith
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node.js
        uses: useblacksmith/setup-node@v5
        with:
          node-version: '18.x'
      
      - name: Mount NPM Cache
        uses: useblacksmith/stickydisk@v1
        with:
          key: ${{ github.repository }}-npm-cache
          path: ~/.npm
      
      - name: Mount node_modules
        uses: useblacksmith/stickydisk@v1
        with:
          key: ${{ github.repository }}-node-modules
          path: ./node_modules
      
      - name: Install Dependencies
        run: npm ci

      - name: Build
        run: npm run build

Bazel Build Caching

Bazel’s remote cache can significantly improve build times, but uploading and downloading cached artifacts can still be a bottleneck. Using sticky disks with Blacksmith runners provides near-instant access to your Bazel caches as they are bind mounted into your runners on demand. Our useblacksmith/setup-bazel@v2 action is a zero-confg way to use sticky disks to store the disk, repository, and external cache.

jobs:
  build:
    runs-on: blacksmith
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Bazel
        uses: useblacksmith/setup-bazel@v2
        with:
          version: '6.x'
      
      - name: Build
        run: |
          bazel build //...

How it works

Blacksmith stores sticky disk artifacts in a secure, highly performant Ceph cluster, running on local NVMe drives. Our runners proxy their requests through our Storage Agents to interact with the Ceph cluster. Each sticky disk is uniquely identified by a key. When a GitHub Action job requests a sticky disk, the last committed snapshot will be cloned and mounted into the runner at the specified path. Once the job completes, the sticky disk will be unmounted and committed for future invocations. At the moment, customers can use up to 5 sticky disks in a single GitHub Action job.