CommonRig docsOpen the app

Docs / Workers and automation / The Environment module

The Environment module

Optional. A map of your machines, services, jobs and runbooks, so your agents know where things run. Off until a workspace owner turns it on.

What it holds

runsrunsforusesLaptophostBuild boxhostWeb appservice, activeNightly buildjob, raises on failureRestore runbookrunbook for the web appHosting accountkey lives in your passwordmanagerrunsrunsforusesLaptophostBuild boxhostWeb appservice, activeNightly buildjob, raises on failureRestore runbookrunbook for the web appHosting accountkey lives in your passwordmanager
An example environment: two machines, their services and jobs
Record kindWhat it is
HostA machine
ServiceSomething that runs on a host
JobSomething a host runs on a timer
RunbookHow to fix or restore something
PlacementWhich path or repo runs where
CredentialWhere a key lives: its manager and reference. Never the key
  • Turn it on under Setup, Workspace. Collaborators never have to use it.
  • Agents read it with env_get, ask where a path runs with placement_get and where a key lives with credential_where.
  • An agent's write follows Environment: your agents' writes, under Setup, Work and moves (yours and the workspace's) and in a project's Settings. Auto: it stands at once, approved by you, and the trail says auto-accepted: own agent. Agent: it waits, and your agents may say yes for you from another session than the one that wrote it. Ask: it waits for your yes, like a schedule. Nothing set is auto in your own Home and ask in a shared workspace; a workspace or project word caps yours. An account always waits for a person.
  • It is backed up with everything else. In your own repo copy it is off unless you turn it on, and then it goes through the pre-push scan.

For agents env_get placement_get env_write: env_get reads the map or one record, placement_get answers where a folder or repo runs, env_write adds or changes a record: it stands at once where your person's word is auto (the default in their own Home), else it waits for a person's yes (issues never do; an account always waits). With agent, env_write approve says yes for them from another session. An account says where its secret lives, never the secret. Applies when you need to know where something runs, or record a host, service, job, runbook or account.

Placements and pipelines

Two more Rig components read the same records. Each is its own switch on the overview page of Rig, an owner's, and needs Environment on. A project shows each on, hidden or off in its own Rig group.

thenthen1 Builduses: Build box, BLD-42 Testuses: a tool card3 Deployuses: Web app, Laptopthenthen1 Builduses: Build box, BLD-42 Testuses: a tool card3 Deployuses: Web app, Laptop
A pipeline: a runbook with its stages in order, each naming what it uses
ComponentWhat it shows
PlacementsEach placement under the host it runs on, and a box: type a folder or repo and see what placement_get answers an agent for it
PipelinesRunbooks with stages. Each stage has a name, what happens, and what it uses: hosts, services and jobs, builds, and tool, skill or package cards
  • Stages are written one a line on the Pipelines page: name | HST-3, BLD-2 | what happens. An empty list makes it a plain runbook again.
  • A stage only uses records in the runbook's own project, or a workspace card. Someone's own card is never one.
  • Agents read the stages with env_get on the runbook, and see only the records they can see.

Agents writing stages

An agent writes a runbook's stages with env_write: the whole list in order, each stage a name, what happens and the records it uses. The same rules hold as on the Pipelines page, and like every environment write it counts once a person, or your agents' auto setting, says yes.

For agents env_write: env_write with stages replaces a runbook's stages whole, and the runbook needs a yes again (auto gives it at once). Applies when a runbook's ordered stages change.

Keeping it in one project

A map made before projects, or brought in by an import, has no project. A workspace owner can file it into one, a private one if only some people should read it.

  • Filing a record moves everything tied to it: what its links reach either way, and the records a runbook's stages use or that use it. A link's two ends always sit in one project, so a map never splits.
  • Agents file records with record_move and get back every id that moved. Filing loose records into a project is for whoever may write there; moving between projects is the workspace owner's.
  • An account that unlocked items left in another project stops naming them, and the reply says which.
  • Who reads the project then follows project privacy: its members, the workspace owner and anyone who sees all projects.

For agents record_move: record_move on any environment id moves it with every record its links and stages reach; the reply lists each id moved. Applies when environment records sit loose and belong to a project.

Checked against the code at e28af69c. Site built from f04f4af1.