Skip to content

Add sticky disk cache modes#43

Open
crohr wants to merge 37 commits into
mainfrom
feature/sticky
Open

Add sticky disk cache modes#43
crohr wants to merge 37 commits into
mainfrom
feature/sticky

Conversation

@crohr

@crohr crohr commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Persistent caches for RunsOn jobs

RunsOn jobs can now keep large build caches on a sticky disk between ephemeral runners. Add a sticky= job label and select the caches your workflow needs:

jobs:
  build:
    runs-on: runs-on=${{ github.run_id }}/runner=2cpu-linux-x64/sticky=20gb
    steps:
      - uses: actions/checkout@v6
      - uses: runs-on/action@v2
        with:
          sticky_cache: |
            go
            pnpm
            custom,path=vendor/cache

What changes for users

  • Built-in modes cover Go, Node.js, Yarn, pnpm, Ruby, Rust, Python, uv, Poetry, APT, Gradle, Maven, Playwright, Git, and BuildKit.
  • custom,path=... persists additional directories. Relative paths resolve from GITHUB_WORKSPACE; home-relative and absolute directories are supported. File caches are rejected.
  • Linux and Windows are supported where the underlying tool allows it. APT, Git, and BuildKit are Linux-only.
  • cache-hit is true only when every requested cache was restored from an earlier snapshot.
  • Requests fail clearly when the sticky disk is missing or does not become ready before sticky_wait_timeout.
  • Disk and inode pressure appear in the job summary. Critically full caches are reset before use so later jobs can recover.

Existing workflows are unchanged unless they configure sticky_cache.

BuildKit cache

The buildkit mode prepares persistent state for docker/setup-buildx-action. Run the RunsOn action first, then configure setup-buildx with the emitted builder name, the docker-container driver, and cleanup: false. The post step validates the builder and makes a best-effort shutdown before the sticky disk is snapshotted.

Git checkout cache

The git mode starts a local smart-HTTP proxy backed by mirrors on the sticky disk. Run it before actions/checkout; fetches use the mirror while pushes, Git LFS, and unsupported requests continue to use GitHub. Private repositories use the action token input.

Workspace-relative caches must run after checkout. To combine Git with Ruby vendor/bundle or a relative custom path, invoke runs-on/action once before checkout for git, then again after checkout for the workspace cache.

Reviewer notes

  • Prerequisites are merged: direct cache/* access remains available with cache isolation, and runs-on/cache@v5 uses the repository prefix. CI targets env=bootstrap, deployed from the latest v3.2.0 template source with the published v3.2.0-rc.1 artifact.
  • Late review fixes restore Windows cache targets after failed junction creation and terminate unhealthy stale Git proxies before replacing their state.
  • Validation includes go test ./..., Windows compilation and regression coverage, workflow lint, the complete automatic matrix, and explicit cold/warm sticky-disk roundtrips for pinned and latest Buildx.

crohr added 8 commits July 3, 2026 16:12
Adds nscloud-cache-action-style caching backed by RunsOn sticky disks
(snap=<size>[:<name>] label). The new 'cache' input takes a list of
package manager modes (go, node, ruby, rust, python, apt, ...) whose
cache directories are bind-mounted onto the sticky disk volume; 'path'
accepts arbitrary paths. Outputs 'cache-hit' when all paths were
restored from a previous snapshot.
Blacksmith-style: runs a pinned buildkitd whose state and binaries live
on the sticky disk, registered as the current buildx builder via the
remote driver. The docker daemon is never touched. The action's post
step stops buildkitd gracefully so the state is consistent before the
volume is unmounted and snapshotted.
- buildkitd now runs with an explicit GC config (cache capped at 75%
  of the volume, 20% min free) so the buildkit cache stays bounded.
- Post step logs volume usage and emits a warning + job summary with a
  per-cache breakdown when free space drops below 20% (or inodes 10%).
- If a restored volume is critically full at job start (<5% free space
  or inodes), all caches on it are reset so the job runs cold instead
  of dead-looping on ENOSPC, and the next snapshot starts clean.
- Junction-based cacheMount on Windows (mklink /J, moves existing targets aside)
- Windows cache paths (~/AppData/Local) for go, node, yarn, pnpm, pip, uv, poetry
- Skip apt/buildkit modes on Windows; disk stats via GetDiskFreeSpaceExW
- Regenerate main-* binaries with Windows sticky-disk support
Accelerates an unmodified actions/checkout (and any github.com fetch)
by running a local git smart-HTTP proxy whose bare mirrors live on the
sticky disk, with github.com fetch URLs rewritten to it via global git
config. Serving is delegated to git http-backend (protocol-exact, incl.
v2); pushes are pinned to upstream via pushInsteadOf, and anything the
mirror cannot serve (LFS, receive-pack, force-push-orphaned SHAs,
mirror failures) is transparently forwarded to github.com.

Mirror code adapted from github.com/crohr/smart-git-proxy, minus the
shared-proxy pack cache (unnecessary per-job, and buggy per issue #1).
@crohr
crohr marked this pull request as ready for review July 10, 2026 09:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4505b1cc1f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/stickydisk/modes.go Outdated
Comment thread internal/stickydisk/buildkit.go Outdated
Comment thread internal/gitproxy/mirror.go Outdated
Comment thread internal/stickydisk/mount_unix.go
Comment thread internal/stickydisk/buildkit.go Outdated
crohr added 2 commits July 24, 2026 11:36
* Delegate sticky BuildKit to setup-buildx

* feat: add structured sticky cache input

* dist: rebuild binaries

* ci: run sticky buildkit test on dev fleet

* ci: separate deploy-time sticky integration

* feat: rename snap runner label to sticky

* dist: rebuild binaries

* feat: make sticky cache availability strict

* Fail sticky cache on unavailable disk

* dist: rebuild binaries

* Fix sticky BuildKit edge cases

* dist: rebuild binaries

* ci: use bootstrap stack for sticky failure test

* Fix stale Buildx recovery

* dist: rebuild binaries

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f9527ffad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/gitproxy/uploadpack.go
Comment thread internal/stickydisk/modes.go
Comment thread internal/stickydisk/buildkit.go Outdated
Comment thread internal/stickydisk/git.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9739fe9911

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/stickydisk/mount_unix.go
Comment thread internal/stickydisk/stickydisk.go
Comment thread internal/stickydisk/git.go Outdated
Comment thread internal/stickydisk/stickydisk.go
Comment thread internal/stickydisk/git.go Outdated
Comment thread internal/stickydisk/mount_unix.go Outdated
Comment thread internal/stickydisk/stickydisk.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfac95924f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/stickydisk/mount_windows.go
Comment thread internal/stickydisk/git.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 687e2712fb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/gitproxy/mirror.go Outdated
Comment thread internal/stickydisk/buildkit.go
Comment thread internal/stickydisk/mount_unix.go Outdated
@crohr

crohr commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@crohr

crohr commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab459aec9c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/gitproxy/mirror.go
Comment thread internal/gitproxy/mirror.go Outdated
Comment thread internal/stickydisk/buildkit.go Outdated
Comment thread internal/stickydisk/git.go
@crohr

crohr commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@crohr

crohr commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@crohr

crohr commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f9fb83100

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread main.go
Comment thread internal/stickydisk/git.go
Comment thread internal/stickydisk/stickydisk.go
Comment thread internal/gitproxy/mirror.go
@crohr

crohr commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: bdd8fc72ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d3160aad8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/gitproxy/mirror.go
Comment thread internal/stickydisk/pressure.go Outdated
Comment thread internal/gitproxy/uploadpack.go Outdated
Comment thread internal/stickydisk/git.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd12007786

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/stickydisk/stickydisk.go Outdated
Comment thread internal/gitproxy/uploadpack.go
Comment thread internal/stickydisk/git.go Outdated
Comment thread internal/stickydisk/mount_unix.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5931d8190e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/gitproxy/mirror.go Outdated
Comment thread internal/gitproxy/mirror.go Outdated
Comment thread internal/stickydisk/stickydisk.go
Comment thread internal/stickydisk/git.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a26376f453

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/gitproxy/mirror.go
Comment thread internal/stickydisk/buildkit.go Outdated
Comment thread internal/stickydisk/stickydisk.go Outdated
Comment thread internal/gitproxy/mirror.go
Comment thread internal/gitproxy/gitproxy.go
Comment thread internal/stickydisk/mount_unix.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed4191e356

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/stickydisk/git.go
Comment thread internal/stickydisk/stickydisk.go
Comment thread internal/gitproxy/mirror.go
Comment thread internal/stickydisk/mount_unix.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7fcf9ca11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/stickydisk/mount_windows.go
Comment thread internal/stickydisk/stickydisk.go Outdated
Comment thread internal/stickydisk/modes.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bfebbeb696

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/stickydisk/mount_windows.go Outdated
Comment thread internal/stickydisk/modes.go Outdated
@crohr

crohr commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@crohr

crohr commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 9a322ad91e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant