Skip to content
Reference

Environments and promotion

Promote a workflow, with the topics, template and called workflows it uses, from one workspace to another as one bundle. See the diff first, map connections per environment, deploy through the usual checklist, and roll back in one click.

On this page

Each workspace is an environment: dev, staging, production. Promote (Promote to another workspace, in the ··· menu of the workflow's Versions tab) copies a workflow from one workspace to another, together with what it depends on, as one bundle. You see exactly what changes in the target before anything changes. The copy lands there as a draft, and only a deploy in that workspace makes it run: its test cases run and approval is required.

How it works

A promotion runs in one database transaction. Either everything lands in the target, or nothing does.

sequenceDiagram
    participant You
    participant Dev as Dev workspace
    participant Engine as MedHook engine
    participant Staging as Staging workspace

    You->>Dev: Promote, pick Staging
    Engine-->>You: Diff, what goes with it, connection mapping
    You->>Engine: Promote to Staging
    Engine->>Staging: Topics, template, workflow as a draft
    You->>Staging: Deploy (test cases run, approval)
    You->>Staging: Roll back in one click if needed
  1. Match. Every workflow gets a stable key the first time it is promoted, made from its name (ADT to FHIR becomes adt-to-fhir). A new key is unique across every workspace: two unrelated workflows that share a name in different workspaces get different keys (adt-to-fhir-2), so they never match each other's copy. The copy in the target carries the same key, so the next promotion updates that copy instead of making another. Renaming the workflow keeps its key.
  2. Preview. Nothing is written. The dialog shows the diff against what runs in the target, what goes with the workflow, and how each connection is mapped.
  3. Promote. The dependencies are created or reused, and the workflow lands turned off (the first time) or as a new draft version of the existing copy. What the target runs does not change: the deployed version keeps running, and the copy keeps its own sender settings and connections. Promote lands exactly the preview on screen: if anything changed since (someone edited the workflow, deployed there, or promoted it first), nothing is written and the dialog shows the new preview to review.
  4. Deploy in the target. The usual Deploy checklist applies in that workspace: a fresh passing test, the workflow's saved test cases (run at deploy), and approval by a second admin. Promotion never skips approval.

What goes with the workflow

Each dependency is matched in the target by its own stable key, never by an id.

DependencyMatched byWhen the target already has it
Topics it publishes to or subscribes fromThe topic name (adt.admit)Same settings: reused. Different settings: kept as is, with a warning (other workflows use it).
The workflow template it is linked toThe template's stable keySame steps: reused. Different steps: updated there as a new draft, so its other linked workflows show the update.
A gallery template it was made fromThe template idKept: gallery templates are the same in every workspace.
A workflow it calls (a Call workflow step), and the ones that one callsThe called workflow's stable keyHas the pinned release, or the same steps: reused. Otherwise it goes with it as a draft, at the version the call runs (the pinned release, the newest release, or the deployed version), never a newer unreleased draft.
A component it uses (a Component step), and the ones that one usesThe component's stable keyHas the pinned release, or the same steps: reused. Otherwise it goes with it as a draft component, at the pinned release, never a newer unreleased draft.
Code tablesThe table nameSame entries: reused. Different entries: kept, unless you choose to overwrite.
Mapping setsThe workflowReplaced with the promoted ones (never their sample data).

The copy's Call workflow steps point at the called workflows' copies in the target: a call never leaves its workspace. A promotion never cuts a release (a release labels a deployed version, and deploying there goes through its checklist). When the call pins a release the target doesn't have yet, the dialog says which to cut, for example This workflow pins release 1.2.0 of Patient lookup, which Staging doesn't have yet. Deploy Patient lookup there and cut release 1.2.0, then deploy this workflow.

The copy's Component steps point at the components in the target the same way, and keep their release and their connection per sender table (mapped to the target's connections). A promoted component lands as a draft: release it on its page in the target. Its page there says which release a workflow there pins, and Publish release… suggests it, for example A workflow here pins release 1.0.0, which this component doesn't have yet. The dialog warns before you promote: This workflow pins release 1.0.0 of the component "Post the patient row", which Staging doesn't have yet. Open the component in Staging and release its draft as 1.0.0 (its tests run first), then deploy this workflow.

  • A Call workflow step inside a component is followed too: the called workflow goes with it, and the component's copy calls the target's copy.
  • When the workflow pins several releases of one component, only the newest pinned release goes with it, so only that one can be released from the draft there. The dialog says so for each older one, for example This workflow also pins release 1.0.0 … Only the newest pinned release (1.1.0) goes with it, so 1.0.0 can't be cut there from its draft: move the steps that pin 1.0.0 to 1.1.0 before deploying this workflow there. Publish release… suggests only the newest pinned release.
  • A component the target already has at the newest pinned release is reused. When its copy is updated instead and has an unreleased draft there, the dialog says The component "Post the patient row" in Staging has an unreleased draft. It will be replaced; it stays in Versions there.

Promote a component on its own

On a component's page, Promote… (admins) opens the same dialog. The component goes through the same bundle, with the components it uses: it lands in the target as a new component (first time) or a new draft of its copy there. Its releases there are untouched, and the workflows there keep the release they pin until you release the draft there and pick it. The result links to the component's page there.

The Goes with it list in the dialog shows one line per dependency: Created there, Already there, Updated there (draft), Same everywhere, Differs there: kept as is or Missing.

Connections and secrets

Connections (adapter profiles) and their secrets are never copied. Each workspace keeps its own: the staging API host and credentials stay in staging, production's stay in production. A promotion only changes which connection each step points to.

For each connection the workflow uses, the dialog shows the connection in the target that stands in for it:

How it was mappedMeans
Picked hereYou chose it in the dialog.
Remembered from the last promotionThe mapping table for these two workspaces already has it.
Matched by nameThe target has exactly one connection with the same name and type.
Not mappedPick one. Until you do, Deploy in the target refuses that destination.

Every promotion saves what it mapped in the mapping table for that pair of workspaces (dev to staging, staging to production), so the next promotion is mapped already. Trigger secrets, such as a webhook signing secret, are not copied either: set them once in each workspace.

Sender settings

A workflow's sender table is per environment, like its connections. The first promotion copies it as a starting point (the copy is turned off). After that the copy keeps its own: a promotion never changes the sender values a deployed copy runs with. The dialog says which applies, for example Sender settings are per workspace: Production keeps its own (3 sender rows). Change them in that workspace under Senders.

The diff

The diff compares the target's copy with what would land, line by line: name, trigger, each step with its settings and connection (by its name in the target), and the wiring.

Above the diffCompared with
New in Staging: there is no copy there yet.Nothing: every line is new.
Compared with v3, deployed in Staging.The version Staging runs now.
Compared with the draft in Staging (never deployed).The copy's newest save.

When the target has a newer draft than the version it runs, the dialog warns: Draft v5 in Staging (not deployed) will be replaced. It stays in Versions there. The diff still compares with the version Staging runs.

Deployment history and rollback

Environments, in the ··· menu (More version actions) of the workflow's Versions tab, lists the workspaces the workflow is in: this one, and, for an admin, the promoted copies in other workspaces. For each it shows the deployed version, a waiting draft, and the deployment history, newest first:

  • v2 deployed (promoted from Dev v5): a deploy of the version a promotion landed.
  • v3: rolled back to v1: a rollback.
  • checklist skipped: an admin deployed without the full checklist.

Roll back to vN restores the previous deployed version in that workspace and deploys it again, in one step, through the same checks as a deploy: the version must still validate and every destination needs a connection there. Operators and admins can roll back; viewers cannot.

Who can do what

ActionRole
Promote (and preview)Admin
See this workspace's deployment historyEveryone with access to the workspace
See other workspaces' copiesAdmin
Deploy or roll back in a workspaceOperator or admin (approval by an admin)

Audit

EventWhen
promotion.appliedA promotion, in both workspaces: keys, versions, diff counts, dependencies and connection ids.
promotion.rolled_backA rollback from the Environments card.
workflow.deployedEvery deploy and rollback, as before.

Templates

A template is promoted with the workflow that uses it.

Reference