Spec files

Describe a sandbox in your repository with pod.yaml, and make the same sandbox from it every time

Not available yet Creating sandboxes from a spec file is not offered yet.

A spec file describes a sandbox in your repository: the system, the size, what it starts from, what is loaded once it runs, and its network rules. Pod writes a lock beside it, which pins what the file resolved to, so every sandbox made from the same two files starts the same. Commit both.

pod.yaml
version: 1
name: web-app
system: linux
size: medium
env:
  NODE_ENV: test
setup:
  packages: [git, jq]
  run:
    - corepack enable
    - pnpm install --frozen-lockfile
  workdir: /home/user/app
network:
  rules:
    - Allow net registry.npmjs.org
    - Allow net api.github.com GET POST /repos/acme/app/*
    - Deny net everything else

A repository can hold more than one: pod.yaml and pod.lock, then web.pod.yaml beside web.pod.lock, and so on.

A spec file, a snapshot, or commands at start

Three ways to get a sandbox ready, each for a different part of the job:

UseForExample
A spec fileWhat the sandbox is: its system, size, start point, packages and rules, reviewed and committed with your codeA repository's development sandbox
A snapshotWhat is on its disk and in its memory, ready the moment it starts. What you would put in a Dockerfile, and a warm build or a signed-in app tooAn eval's environment, a session image
Commands at startWhat changes every time: today's branch, a fresh token, a step that must run nowgit pull, a login

They work together: a spec file can start from a snapshot, and its setup steps are commands that run once the sandbox is up. Put slow, stable steps in the snapshot and quick, changing ones in commands.

The fields

The file is YAML, read as YAML 1.2: on, yes and a date are text, and 010 is ten. Anchors, aliases, tags, repeated keys and a second document are refused, so every reader of the file sees the same values. A field the format does not have is an error, never ignored.

FieldKindWhat it is
version (required)NumberThe version of the spec format. Always 1.
nameTextA short name for what the file describes, lowercase. Sandboxes made from it carry it in the pod.spec-name label.
system (required)TextThe operating system: a system of the catalog.
sizeTextA size of the catalog. small when not given.
classTextshared or ci. The size's class when not given, and it must match the size.
diskTextpersistent or throwaway. Always throwaway on CI sizes.
fromFieldsWhat the sandbox starts from: at most one of template, image, snapshot, dockerfile and repository. The system's default template when not given.
from.templateTextRestore this template (tpl_…).
from.imageTextBoot this image (img_…).
from.snapshotTextRestore this snapshot (snp_…) of the same project.
from.dockerfileTextBuild an image from this Dockerfile of the repository, a path relative to the spec file. The lock pins the image built.
from.contextTextThe build context for dockerfile, relative to the spec file. . when not given.
from.repositoryTextBuild an image from the Dockerfile at the root of this git repository (an https:// address). The lock pins the image built.
from.refTextThe branch, tag or commit of repository. Its default branch when not given.
needsList of textCapabilities the sandbox needs, by name (see the capability list). The scheduler places it where they are.
envNames to textEnvironment variables. The file is committed, so never a secret: secrets reach a sandbox through connected tools.
labelsNames to textLabels for the sandboxes made from the file. Keys starting with pod. are Pod's.
time_limit_sNumberStop the sandbox this long after it starts. None when not given.
idle_sNumberSleep after this long with no activity. The project's default when not given.
setupFieldsWhat is loaded once the sandbox runs. Installed software is rebuilt from here when a sandbox moves to another system. Pod CI's bake run uses it as the repository's recipe.
setup.packagesList of textPackages to install with the system's own package manager, as root, before run.
setup.runList of textCommand lines run in order, each by /bin/sh -c as the sandbox's user. The first that fails stops the setup.
setup.workdirTextThe folder run starts in, an absolute path. The user's home when not given.
setup.timeout_sNumberHow long each setup step may take. 1,800 seconds when not given.
homeFieldsThe home folder on a move to another system.
home.carryList of textPaths under the home folder that move with the sandbox to another system, beyond git's settings and ignore files, which always move.
syncFieldsA group's shared workspace.
sync.skipList of textPaths in the workspace never synced between a group's machines, beyond build outputs and caches such as node_modules, which are never synced.
networkFieldsThe sandbox's network rules.
network.rulesList of textRules in Pod Agent IAM's simple form, one a line: a verdict, an action and a thing. They add to the project's rules and are cut to its ceiling.

Never put a secret in the file: it is committed. A variable whose name looks like a secret, and a carried path that holds keys or .env files, are warned about.

Capabilities

needs names what the sandbox needs beyond its system. Pod places it where that is.

CapabilitySystemsWhat it gives
kvmlinuxRun virtual machines of its own inside the sandbox. The sandbox lands in the pool kept for them.

Network rules

Each rule is a verdict, an action and a thing, one a line: Allow, Deny or Ask; net, read, write, use or msg; then a host, an address, a folder, a connected tool or a policy. The rules add to your project's rules and can never allow more than they do.

A sandbox with rules reaches only what they grant. Write Allow net everything else to keep the rest of the internet, and a check warns when a file says nothing about everything else. Pod reads and checks rules now and does not yet enforce them: until it does, a sandbox made from the file reaches the public internet, and a check says so.

Check a file and write its lock

Check a spec file answers every problem with it and the lock Pod would write, without making anything. A file with problems answers with ok false, never with an error. Send the lock you have, and the answer says whether it was written for this file: fresh, stale or missing. Writing a lock again with nothing changed writes the same bytes.

The lock pins the template, image or snapshot the file starts from, by id and digest, with the size and each capability's pool. A sandbox made with a fresh lock starts from its pin; a stale lock is set aside. An image built from a Dockerfile or a repository needs a lock that pins the image built.

Apply a file

Applying a file makes one sandbox from it: one create with the file's fields, then each setup step as a command, the packages first, as root, then each run line, stopping at the first that fails. The sandbox carries the file's hash in its pod.spec label and its name in pod.spec-name, so you can list the sandboxes made from a file.

TypeScript
import { readFile, writeFile } from "node:fs/promises";

const spec = await readFile("pod.yaml", "utf8");
const lock = await readFile("pod.lock", "utf8").catch(() => null);
const { sandbox, check } = await pod.specs.apply(spec, { lock });
await writeFile("pod.lock", check.lock_text!);
Python
from pathlib import Path

applied = pod.specs.apply_file("pod.yaml")  # reads pod.lock beside it
Path("pod.lock").write_text(applied.check["lock_text"])

In the dashboard, Sandboxes has From a spec file: open or paste the file, see its problems by line as you type, check it with Pod, download the lock, and apply it while each setup step's output shows.

Problems

Each problem names a code, a path in the file such as network.rules[2], and the line where it is known.

ProblemStops itWhat it means
yamlYesNot YAML Pod reads: a syntax error, a repeated key, an anchor, an alias, a tag, or more than one document.
too_largeYesThe file is over its size limit.
unknown_fieldYesA field the spec format does not have.
requiredYesA required field is missing.
typeYesA value of the wrong kind: text where a number belongs, a list where a mapping belongs.
valueYesA value out of range, not on its list, or not in its format.
versionYesA spec version this client does not read.
size_classYesThe class does not match the size's class.
size_diskYesA persistent disk on a size that always has a throwaway one.
from_oneYesMore than one source under from, or a field that belongs to another source.
capability_systemYesA capability the system does not have.
label_reservedYesA label key that starts with pod., which Pod sets.
pathYesA path that is absolute where a relative one belongs, or the other way round, or that climbs out with ...
rule_syntaxYesA network rule Pod cannot read. An unknown word is an error, never a guess.
duplicateNoThe same entry twice in a list.
env_secretNoAn environment variable whose name looks like a secret. The file is committed.
key_fileNoA path to key files or .env files, which checkpoints and moves leave out.
rule_closes_networkNoOnce the rules apply, the sandbox reaches only what they grant. Allow net everything else keeps the rest of the internet.
rules_not_enforcedNoUntil then a sandbox made from the file reaches the public internet inside the fixed baseline.
lock_invalidYesThe lock file is not a lock this version reads.
lock_staleNoThe lock was written for another version of the spec file. Write it again.
not_foundYesA template, image or snapshot the project cannot see.
not_offeredYesA system, size or capability this cell or plan does not offer.
needs_buildYesThe image must be built from the Dockerfile or the repository first, and no fresh lock pins one.
rule_refusedYesThe policy compiler refused a rule: it allows more than the project's ceiling, or names a folder, tool or policy that does not exist.
lock_pin_goneYesThe lock pins an image, template or snapshot that no longer exists. Write the lock again.