Skip to main content
Patches are shell scripts attached to a checkpoint. When a new sandbox is spawned from that checkpoint, all patches are applied in sequence before the sandbox is handed back to you. This lets you layer additional setup on top of a base checkpoint without re-creating it.

Create a Patch

From a file:
oc patch create cp-7f3a1b2c --script ./setup.sh --description "Install dependencies"
From stdin:
echo "apt install -y curl jq" | oc patch create cp-7f3a1b2c --script=-

oc patch create <checkpoint-id>

Attaches a patch script to a checkpoint. Patches run in the order they were created (by sequence number) whenever oc checkpoint spawn is called for that checkpoint.
FlagTypeDefaultDescription
--scriptstringPath to a shell script file, or - to read from stdin (required)
--descriptionstringHuman-readable description of what the patch does
Output:
Patch created: patch-3c8d2e1a (sequence: 1)

List Patches

oc patch list cp-7f3a1b2c

oc patch list <checkpoint-id>

Shows all patches attached to a checkpoint, in the order they will be applied. Output:
ID               SEQ  DESCRIPTION           STRATEGY  CREATED
patch-3c8d2e1a   1    Install dependencies            2024-01-15T10:35:00Z
patch-9a1f4b7c   2    Configure environment           2024-01-15T10:40:00Z

Delete a Patch

oc patch delete cp-7f3a1b2c patch-3c8d2e1a

oc patch delete <checkpoint-id> <patch-id>

Removes a patch from the checkpoint. Future spawns will no longer apply it. Existing sandboxes already spawned are unaffected.

Examples

Layer Setup Steps onto a Base Checkpoint

# Start with a minimal checkpoint
oc checkpoint create sb-abc123 --name base

# Add patches for each layer of setup
oc patch create cp-7f3a1b2c --script ./install-node.sh --description "Node.js 20"
oc patch create cp-7f3a1b2c --script ./install-postgres.sh --description "PostgreSQL client"
oc patch create cp-7f3a1b2c --script ./app-config.sh --description "App config"

# Each spawned sandbox gets all three patches applied in order
oc checkpoint spawn cp-7f3a1b2c

Use stdin for Quick One-Liners

echo "npm install -g typescript" | oc patch create cp-7f3a1b2c --script=- --description "Global TypeScript"

Inspect Before Spawning

# Review the patches that will run
oc patch list cp-7f3a1b2c

# Spawn knowing exactly what will be applied
oc checkpoint spawn cp-7f3a1b2c