Pipeline SDK
How a pipeline is built from chained shell steps, forks, and waits.
A pipeline is a directed graph of steps. You build it by chaining method calls off a root and returning the leaf (or leaves). A step built off another runs after it and inherits its filesystem; steps returned together with no dependency between them run in parallel.
Starting a chain
hm.sh(...) starts a chain and sets its first command — shorthand for
hm.scratch().sh(...).
sh(cmd, *, cwd=None, label=None, cache=None, env=None, timeout_seconds=None, image=None, key=None) -> Step| Parameter | Type | Default | Description |
|---|---|---|---|
cmd | str | required | Shell command to run. |
cwd | str | None | None | Directory to run in, relative to the workspace root. Omit to run in the root. |
label | str | None | None | Human-facing label shown in the UI. Defaults to the command. |
cache | CachePolicy | None | None | Cache policy controlling result reuse across builds. |
env | dict[str, str] | None | None | Per-step environment variables merged on top of pipeline-level env. |
timeout_seconds | int | None | None | Hard wall-clock timeout in seconds. |
image | str | None | None | Local-mode Docker base image override for this step. |
key | str | None | None | Manual key override for this step in the v0 IR. |
import harmont as hm
build = hm.sh("make build").sh("make test")import { sh } from "@harmont/hm";
const build = sh("make build").sh("make test");Forking and joining
Call .fork() to branch, and hm.wait() for a join barrier.
wait(*, continue_on_failure=False) -> Step| Parameter | Type | Default | Description |
|---|---|---|---|
continue_on_failure | bool | False | When ``True``, the barrier passes even if upstream steps have failed, allowing cleanup or notification steps to run. |
import harmont as hm
root = hm.sh("make deps")
lint = root.fork("lint").sh("make lint")
test = root.fork("test").sh("make test")import { sh } from "@harmont/hm";
const root = sh("make deps");
const lint = root.fork({ label: "lint" }).sh("make lint");
const test = root.fork({ label: "test" }).sh("make test");The full Step field and method list is in the
chains reference.