Harmont docs
Pipeline SDK

Chains & steps

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
ParameterTypeDefaultDescription
cmdstrrequiredShell command to run.
cwdstr | NoneNoneDirectory to run in, relative to the workspace root. Omit to run in the root.
labelstr | NoneNoneHuman-facing label shown in the UI. Defaults to the command.
cacheCachePolicy | NoneNoneCache policy controlling result reuse across builds.
envdict[str, str] | NoneNonePer-step environment variables merged on top of pipeline-level env.
timeout_secondsint | NoneNoneHard wall-clock timeout in seconds.
imagestr | NoneNoneLocal-mode Docker base image override for this step.
keystr | NoneNoneManual 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
ParameterTypeDefaultDescription
continue_on_failureboolFalseWhen ``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.

On this page