feat(runner): allow runners to skip the workspace snapshot by pltoledo · Pull Request #17 · cloudflare/ci · GitHub
Skip to content

feat(runner): allow runners to skip the workspace snapshot - #17

Open
pltoledo wants to merge 1 commit into
cloudflare:mainfrom
pltoledo:runner-snapshot-opt-out
Open

pltoledo wants to merge 1 commit into
cloudflare:mainfrom
pltoledo:runner-snapshot-opt-out

Conversation

@pltoledo

@pltoledo pltoledo commented Oct 1, 2026

Copy link
Copy Markdown

Summary

Adds an opt-in snapshot: false runner option that skips the workspace backup after a successful command.

Motivation

Every successful runner ends with createBackup() of /workspace so that a chained runner can restore it. The last runner of a pipeline, typically a deploy step, has nothing chained after it, so its backup is never restored. Producing it still adds a few seconds to the step (for example backup.create … (2833ms) after a deploy command in our pipeline), and the archive stays in R2 until its TTL expires.

Usage

const built = await ci.runner({ name: 'build', command: 'bun run build' });

await built.runner({
  name: 'deploy',
  command: 'bun run deploy',
  snapshot: false,
});

Behavior

  • The Sandbox runner does not call createBackup for that step, and the step succeeds without a snapshot.
  • Calling .runner() on such a result rejects with an error, since there is no workspace to restore.
  • snapshot: false combined with cache is rejected before the step runs, because the cache pointer needs the snapshot.
  • Runners that don't set the option behave exactly as before. The only type change is that CiRunStepOutput.snapshot (and so CiRunnerResult.snapshot) becomes optional.

Tests

Focused tests cover each layer:

  • the Sandbox runner skips the backup;
  • runCiStep forwards the option and returns no snapshot;
  • withStepNotification accepts a missing snapshot only when none is required;
  • CIWorkflow rejects chaining from an opted-out runner and rejects the combination with cache.

Results:

  • vitest run --dir src: 89 passed; the 5 new tests fail without the change.
  • typecheck, lint and format:check pass, with no new lint warnings.

Naming

I named the option snapshot: false to sit next to cache, and I'm happy to rename or reshape it if you'd prefer another API.

Add a snapshot: false runner option for steps whose workspace is never
restored, such as a final deploy. The Sandbox runner then skips
createBackup, the step succeeds without a snapshot, and a chained runner
from that result is rejected. The option cannot be combined with cache,
which needs the snapshot to publish its pointer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeYiT1pGA6KuTByiQvwt7s
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