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.
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 elseA 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:
| Use | For | Example |
|---|---|---|
| A spec file | What the sandbox is: its system, size, start point, packages and rules, reviewed and committed with your code | A repository's development sandbox |
| A snapshot | What 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 too | An eval's environment, a session image |
| Commands at start | What changes every time: today's branch, a fresh token, a step that must run now | git 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.
| Field | Kind | What it is |
|---|---|---|
version (required) | Number | The version of the spec format. Always 1. |
name | Text | A short name for what the file describes, lowercase. Sandboxes made from it carry it in the pod.spec-name label. |
system (required) | Text | The operating system: a system of the catalog. |
size | Text | A size of the catalog. small when not given. |
class | Text | shared or ci. The size's class when not given, and it must match the size. |
disk | Text | persistent or throwaway. Always throwaway on CI sizes. |
from | Fields | What the sandbox starts from: at most one of template, image, snapshot, dockerfile and repository. The system's default template when not given. |
from.template | Text | Restore this template (tpl_…). |
from.image | Text | Boot this image (img_…). |
from.snapshot | Text | Restore this snapshot (snp_…) of the same project. |
from.dockerfile | Text | Build an image from this Dockerfile of the repository, a path relative to the spec file. The lock pins the image built. |
from.context | Text | The build context for dockerfile, relative to the spec file. . when not given. |
from.repository | Text | Build an image from the Dockerfile at the root of this git repository (an https:// address). The lock pins the image built. |
from.ref | Text | The branch, tag or commit of repository. Its default branch when not given. |
needs | List of text | Capabilities the sandbox needs, by name (see the capability list). The scheduler places it where they are. |
env | Names to text | Environment variables. The file is committed, so never a secret: secrets reach a sandbox through connected tools. |
labels | Names to text | Labels for the sandboxes made from the file. Keys starting with pod. are Pod's. |
time_limit_s | Number | Stop the sandbox this long after it starts. None when not given. |
idle_s | Number | Sleep after this long with no activity. The project's default when not given. |
setup | Fields | What 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.packages | List of text | Packages to install with the system's own package manager, as root, before run. |
setup.run | List of text | Command lines run in order, each by /bin/sh -c as the sandbox's user. The first that fails stops the setup. |
setup.workdir | Text | The folder run starts in, an absolute path. The user's home when not given. |
setup.timeout_s | Number | How long each setup step may take. 1,800 seconds when not given. |
home | Fields | The home folder on a move to another system. |
home.carry | List of text | Paths under the home folder that move with the sandbox to another system, beyond git's settings and ignore files, which always move. |
sync | Fields | A group's shared workspace. |
sync.skip | List of text | Paths in the workspace never synced between a group's machines, beyond build outputs and caches such as node_modules, which are never synced. |
network | Fields | The sandbox's network rules. |
network.rules | List of text | Rules 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.
| Capability | Systems | What it gives |
|---|---|---|
kvm | linux | Run 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.
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!);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.
| Problem | Stops it | What it means |
|---|---|---|
yaml | Yes | Not YAML Pod reads: a syntax error, a repeated key, an anchor, an alias, a tag, or more than one document. |
too_large | Yes | The file is over its size limit. |
unknown_field | Yes | A field the spec format does not have. |
required | Yes | A required field is missing. |
type | Yes | A value of the wrong kind: text where a number belongs, a list where a mapping belongs. |
value | Yes | A value out of range, not on its list, or not in its format. |
version | Yes | A spec version this client does not read. |
size_class | Yes | The class does not match the size's class. |
size_disk | Yes | A persistent disk on a size that always has a throwaway one. |
from_one | Yes | More than one source under from, or a field that belongs to another source. |
capability_system | Yes | A capability the system does not have. |
label_reserved | Yes | A label key that starts with pod., which Pod sets. |
path | Yes | A path that is absolute where a relative one belongs, or the other way round, or that climbs out with ... |
rule_syntax | Yes | A network rule Pod cannot read. An unknown word is an error, never a guess. |
duplicate | No | The same entry twice in a list. |
env_secret | No | An environment variable whose name looks like a secret. The file is committed. |
key_file | No | A path to key files or .env files, which checkpoints and moves leave out. |
rule_closes_network | No | Once the rules apply, the sandbox reaches only what they grant. Allow net everything else keeps the rest of the internet. |
rules_not_enforced | No | Until then a sandbox made from the file reaches the public internet inside the fixed baseline. |
lock_invalid | Yes | The lock file is not a lock this version reads. |
lock_stale | No | The lock was written for another version of the spec file. Write it again. |
not_found | Yes | A template, image or snapshot the project cannot see. |
not_offered | Yes | A system, size or capability this cell or plan does not offer. |
needs_build | Yes | The image must be built from the Dockerfile or the repository first, and no fresh lock pins one. |
rule_refused | Yes | The 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_gone | Yes | The lock pins an image, template or snapshot that no longer exists. Write the lock again. |