Skip to main content

Environment variables

orun reads a defined set of environment variables. Prefer CLI flags for per-command overrides and reserve environment variables for CI defaults or machine-wide configuration. Each table below names the source file that reads the variable.

Core CLI behavior​

VariableRead inMeaning
ORUN_CONFIG_DIRcmd/orun/commands_root.goDefault value for the global --config-dir legacy fallback
ORUN_RUNNERcmd/orun/commands_root.go, command_run.goDefault execution backend for orun run (local, docker, github-actions); a --runner flag wins
ORUN_EXEC_IDcmd/orun/commands_root.go, command_status.go, command_logs.goExecution ID for orun run, and the run that status --remote-state / logs --remote-state inspect; auto-generated for run when unset
ORUN_PLAN_IDcmd/orun/commands_root.go, command_run.goPlan reference injected into orun run; overrides the default latest resolution
ORUN_GITHUB_API_URLinternal/flow/remote.goOverride the GitHub API base used to fetch remote workflow refs (GitHub Enterprise; default https://api.github.com)
ORUN_ARTIFACT_RETENTION_DAYSinternal/artifactstore/github/upload.goRetention in days for artifacts uploaded with --artifact github (default 14)
ORUN_SECRET_<KEY>cmd/orun/run_secrets.goLocal-run override for the secret:// reference whose key is <KEY>. Local runs resolve secrets only from these overrides and fail closed when one is missing; runs against Orunbase resolve from the platform instead
ORUN_COORDINATIONcmd/orun/command_run.goSet to legacy to fall back to the retired relational coordination path. Native event-sourced coordination is the default for remote-state runs
ORUN_NO_TUIcmd/orun/commands_root.goWhen truthy, a bare orun prints help instead of opening the cockpit (subcommands are unaffected)
ORUN_TUIcmd/orun/command_tui.goSet to next to open cockpit v2 from orun tui, bare orun, and bare orun agent — the same opt-in as orun tui-next / --next
ORUN_NO_AUTO_REFRESHcmd/orun/refresh_hook.goWhen truthy, disables the universal pre-command object-model catalog refresh hook
ORUN_OBJECT_ZSTD_LEVELinternal/objectstore/local.goAdvanced: zstd compression level for objects written to the local object store (default 3)

Colour and terminal detection​

VariableRead inMeaning
ORUN_NO_COLORinternal/ui/ansi.goDisable ANSI colour output (any non-empty value). orun run --background sets it on the detached child
NO_COLORinternal/ui/ansi.goThe standard opt-out; any non-empty value disables colour. Glyphs are never stripped
CLICOLORinternal/ui/ansi.goCLICOLOR=0 also disables colour
CI, GITHUB_ACTIONS, GITLAB_CI, CIRCLECI, BUILDKITE, JENKINS_URLinternal/ui/ansi.goAny of these set (and not false) marks the process as running in CI: IsInteractiveWriter reports false, so interactive rendering is switched off even on a TTY

Cloud and authentication​

VariableRead inMeaning
ORUN_REMOTE_STATEcmd/orun/commands_root.go, command_run.goSet to true to coordinate the run through the Orunbase state backend. orun run --remote-state sets it
ORUN_MAX_LANEScmd/orun/github_matrix.goOverride execution.lanes.maxLanes for one orun plan, so a CI plan job can size the lane budget to the runner pool's free capacity; --max-lanes wins over it
ORUN_CHECK_RUNSinternal/ghchecksSet to 0 to stop orun run --lane from posting one GitHub check run per job of a multi-job lane
ORUN_BACKEND_URLcmd/orun/commands_root.go, internal/actions/cloud.go, internal/tui2/data/cloud.goBackend URL — Orunbase or a self-hosted backend. Precedence: --backend-url flag > this variable > intent.yaml execution.state.backendUrl > ~/.orun/config.yaml cloud.url > the built-in default
ORUN_TOKENcmd/orun/command_cloud.go, internal/remotestate/auth.goA headless bearer token for CI and automation. Honoured by every auth path, including orun cloud link and orun cloud check, so a container can self-link without a browser login. Interactive use should rely on orun auth login instead
ORUN_TOKEN_FILEcmd/orun/command_cloud.go, internal/remotestate/auth.goPath to a file whose content is the headless bearer token. The file wins when both are set: it is the agent runtime's refreshed token channel (the platform rotates the session credential roughly every 15 minutes), while an ORUN_TOKEN copied from it expires. orun prints a one-line warning to stderr when both are set and differ
ORUN_WORKSPACEcmd/orun/commands_root.go, internal/actions/cloud.goWorkspace scope for remote state — a ws_… ID, slug, or org_… ID. Overrides the linked workspace and the one selected with orun workspace use. Equivalent to --workspace
ORUN_ORGcmd/orun/commands_root.go, internal/actions/cloud.goRetained alias of ORUN_WORKSPACE; the CLI reads either and prefers ORUN_WORKSPACE. Equivalent to --org
ORUN_PROJECTcmd/orun/commands_root.go, internal/tui2/data/cloud.goProject scope for remote state — overrides the linked project. Equivalent to --project
ORUN_CREDENTIAL_STOREinternal/cliauth/storage.goWhich credential store holds the login: file forces ~/.orun/credentials.json, keychain forces the OS keychain (macOS only, skipping the usability probe), empty or auto picks the keychain when it works and the file otherwise
ORUN_SESSIONcmd/orun/pr.go, cmd/orun/mcp_serve.goDefault agent session ID written into the provenance manifest by orun pr and the MCP pr_open tool
ORUN_VERBOSEcmd/orun/refresh_hook.goWhen truthy, surfaces best-effort outcomes that are otherwise silent — the pre-command catalog refresh and autopushCatalog skips

ORUN_TOKEN and ORUN_TOKEN_FILE take precedence over a stored session for the headless paths, but an operation that needs a stored session or a membership listing (for example resolving identity through a workspace-scoped key) fails with a message that says so.

Agent runtime and sessions​

orun agent serve is the in-sandbox entrypoint the platform launches; the identity below is seeded by the platform and read by cmd/orun/command_agent_serve.go unless a flag overrides it.

VariableRead inMeaning
ORUN_CLOUD_APIcmd/orun/command_agent_serve.go, command_agent_live.go, build_events.goThe api-edge base URL the session body dials home to; orun agent attach uses it with ORUN_ORG_ID to reach a remote session
ORUN_ORG_IDsameThe workspace (org_…) ID of the session
ORUN_SESSION_IDcmd/orun/command_agent_serve.go, build_events.goThe as_… session ID (overridable with --session)
ORUN_SESSION_TOKENcmd/orun/command_agent_serve.go, command_agent_live.goThe session bearer — the service-principal credential
ORUN_AGENT_TYPEcmd/orun/command_agent_serve.goThe agent type to serve (default for --type). Without one the tool policy is deny-by-default
ORUN_TASK_KEYcmd/orun/command_agent_serve.goThe task key the session works (default for --task)
ORUN_REPO_REMOTEinternal/agent/ground/ground.goThe https clone URL that grounds the session in a repository; never carries a credential. Absent, the session boots ungrounded
ORUN_REPO_FULL_NAMEinternal/agent/ground/ground.go, ground/token.goThe owner/repo full name — the only repository the session may mint a credential for
ORUN_REPO_REFinternal/agent/ground/ground.goThe branch or tag to clone at
ORUN_PREVIEWcmd/orun/command_agent_serve.gooff stops a grounded session from running its checkout's live preview

Baseline build​

The bootstrap driver (internal/agent/driver/bootstrap.go) reads its inputs from the environment when a session is asked to build a product from a baseline.

VariableRead inMeaning
ORUN_BASELINE_IDinternal/agent/driver/bootstrap.goThe baseline to instantiate, for example cirrus or cirrus@baseline-v6
ORUN_BASELINE_OUTinternal/agent/driver/bootstrap.goWhere to place the product; orun agent serve sets it to the session's working directory
ORUN_BASELINE_VALUESinternal/agent/driver/bootstrap.goPath to a --values JSON file
ORUN_BASELINE_REDOinternal/agent/driver/bootstrap.goComma-separated phases a retry places again under --resume (--redo each)
ORUN_BASELINE_UNTILinternal/agent/driver/bootstrap.goStop after this phase: adds --until <phase> beside --resume. The bootstrap door sets it for a scaffold-only build (orun ≥ v2.90.0)
ORUN_BASELINE_PHASEinternal/agent/driver/bootstrap.goRun only this phase: adds --phase <phase> beside --resume. Set for a live stage run on its own. Set together with ORUN_BASELINE_UNTIL, the driver refuses to launch and names both

Debugging​

VariableRead inMeaning
ORUN_DEBUGcmd/orun/command_integrations_dynamic.goAny non-empty value prints integration-renderer diagnostics (for example a shadowed native extension) to stderr
ORUN_TUI_PROFILEinternal/tui/profile.go, internal/tui2/frame/profile.goPath of an NDJSON file the cockpit writes per-frame timings to (Update and View durations, rendered bytes). When unset the profiler is not installed
ORUN_BACKGROUND_CHILDcmd/orun/command_run_background.goInternal marker set on the child that orun run --background re-execs, so it does not detach itself again

GitHub Actions​

VariableRead inMeaning
GITHUB_ACTIONScmd/orun/command_run.go, internal/ci/detect.go, internal/remotestate/runid.goWhen true, orun run auto-selects the GitHub Actions backend, CI refs are detected from the event payload, and the remote run ID is derived as gha_{GITHUB_RUN_ID}_{GITHUB_RUN_ATTEMPT}
GITHUB_WORKSPACEcmd/orun/command_run.goDefault workdir for the GitHub Actions backend when --workdir is not set
GITHUB_TOKEN, GH_TOKENinternal/artifactstore/github/client.goGitHub token for the artifact API (GH_TOKEN is the fallback)
ACTIONS_RUNTIME_TOKEN, ACTIONS_RESULTS_URLinternal/artifactstore/github/upload.goRuntime token and results URL for @actions/artifact upload; set automatically on GitHub-hosted runners

Self-hosted backend provisioning​

These variables are read by orun backend init, orun backend status, and orun backend destroy (cmd/orun/command_backend.go).

VariableMeaning
CLOUDFLARE_ACCOUNT_IDCloudflare account ID (required)
CLOUDFLARE_API_TOKENCloudflare API token with Workers/D1/R2 edit permissions
ORUN_SESSION_SECRETSession HMAC secret for the Worker; generated securely if absent at init time and never stored in config
ORUN_PUBLIC_URLPublic URL for the Worker; inferred from workers.dev if omitted (also --public-url)
ORUN_DASHBOARD_URLDashboard URL for OAuth callback configuration (also --dashboard-url)
GITHUB_CLIENT_IDGitHub OAuth app client ID for dashboard/CLI auth
GITHUB_CLIENT_SECRETGitHub OAuth app client secret (never stored in config)

Variables injected during execution​

The runner (internal/runner/runner.go) exports these into every step's environment. User-declared env keys must not use the reserved ORUN_ prefix.

VariableMeaning
ORUN_CONTEXTRuntime environment label such as local, container, or ci
ORUN_RUNNERResolved runner name for the current step
ORUN_EXEC_IDExecution ID of the current run
ORUN_PLAN_IDPlan checksum short-hash
ORUN_JOB_IDJob ID of the currently running job (e.g. api.dev.deploy)
ORUN_JOB_UIDContent-addressed UID of the current job — stable across runs while the job's inputs are unchanged
ORUN_JOB_RUN_IDStable per-job identifier: {execID}/{jobUID}
ORUN_ENVIRONMENTEnvironment name for the current job (e.g. dev, production)
ORUN_COMPONENTComponent name for the current job (e.g. api-platform)
ORUN_ENVPath to the env file for persisting environment variables across steps (alias for GITHUB_ENV)
ORUN_SECRET_OUTPUTSPath of the per-job sink file for job output secrets — exported only when the job declares secretOutputs
TF_HTTP_ADDRESS, TF_HTTP_LOCK_ADDRESS, TF_HTTP_UNLOCK_ADDRESS, TF_HTTP_LOCK_METHOD, TF_HTTP_UNLOCK_METHOD, TF_HTTP_USERNAME, TF_HTTP_PASSWORD, TF_HTTP_RETRY_MAXTerraform http state backend wiring, exported to component-job steps on remote runs — see Terraform state on the platform
ORUN_FLOW_SOURCE_REPO, ORUN_FLOW_SOURCE_REF, ORUN_FLOW_SOURCE_SHA, ORUN_FLOW_SOURCE_URLProvenance of a remotely-fetched workflow, exported to every workflow run: step (empty for local files)

User-declared environment variables​

You can declare environment variables at four levels in your configuration. These are resolved at plan time and injected into jobs at runtime.

Intent root-level env​

# intent.yaml
env:
OWNER: sourceplane
ORGANIZATION: sourceplane

Global env vars shared across all environments and components (lowest precedence).

Intent environment-level env​

environments:
dev:
env:
AWS_REGION: us-east-1
TF_LOG: WARN

Component root-level env​

# component.yaml
spec:
env:
REPO: aws-admin
SERVICE: github-iam

Component-wide env vars applied across all subscribed environments.

Component subscription-level env​

subscribe:
environments:
- name: dev
env:
STACK_NAME: api-platform
TF_VAR_replicas: "1"

Subscription env values override all lower-precedence levels. The full merge order from lowest to highest is: intent root → environment → component root → subscription. See Runtime environment for full merge semantics.

GitHub Actions compatibility mode​

When the GitHub Actions backend is active, orun also supports standard GitHub Actions workflow command behavior such as GITHUB_ENV, GITHUB_OUTPUT, and GITHUB_PATH handling inside the compatibility engine.

ORUN_ENV is always set as an alias for GITHUB_ENV, pointing to the same file. Writing KEY=VALUE pairs to either $ORUN_ENV or $GITHUB_ENV has the same effect — the variables become available to all subsequent steps in the job.

# Both of these are equivalent:
echo "MY_VAR=hello" >> "$ORUN_ENV"
echo "MY_VAR=hello" >> "$GITHUB_ENV"

When running inside actual GitHub Actions (detected via GITHUB_ENV in the host environment), the runner sets ORUN_ENV to the same path, so compositions work identically under the orun compatibility engine and on a GitHub-hosted runner.

  • Configuration — intent.yaml, ~/.orun/config.yaml, and the credential store.
  • orun login and orun auth — interactive sessions versus ORUN_TOKEN.
  • orun agent — the runtime that consumes the session variables.
  • Secrets — secret:// references, ORUN_SECRET_<KEY> overrides, and secretOutputs.