Read-only mode and kill switches
Stop Mendloop writing to your tools right now, for one workflow, one repository, the organization or the server.
Use these when Mendloop must stop writing to your tools right now: during an incident, an audit, or after a bad fix. Investigations keep running and errors keep coming in. Only writes stop: branches, pull requests, ticket changes, comments and chat messages.
Every switch applies to live and test mode alike. Turning one on needs a reason, and every change is written to the audit log.
The switches#
| Switch | What stops | Who can flip it |
|---|---|---|
| Read-only mode (organization) | Every write to repositories, trackers and chat. Workflow write steps are simulated, so you can see what would have happened. | Admins |
| Shadow mode (organization) | The same as read-only mode, but meant to stay on during an evaluation rather than an emergency. See Shadow mode. | Admins |
| One workflow | That workflow: no new runs, and runs in progress pause before their next step. | Admins |
| One repository | Branches, commits and pull requests in that repository (owner/repo). |
Admins |
| The organization | Every write and every workflow run. Runs in progress pause before their next step and carry on when you turn it off. | Admins |
| The instance | Everything, for every organization on this server. | Super Admin |
Turn them on and off#
In the web app: Settings → Policies and safety, the Safety section at the bottom. It shows read-only mode, shadow mode, the switch for every workflow, the repositories that are stopped (with a field to stop another one) and the switch for the whole organization. Each switch that is on says who turned it on, when and why.
- Turning one on asks for a reason. Turning one off is immediate, and the toast has an Undo button.
- Everyone in the organization can see this section; only Admins can flip the switches.
- Pausing a workflow from the Workflows list is the same switch as that workflow's row in Safety.
Through the API:
# Read-only on
curl -X PUT $API/api/v1/orgs/$ORG/safety -H 'Content-Type: application/json' \
-d '{"switch": "read_only", "on": true, "reason": "Audit week"}'
# Stop one repository
curl -X PUT $API/api/v1/orgs/$ORG/safety -H 'Content-Type: application/json' \
-d '{"switch": "repository", "target": "acme/payments-api", "on": true, "reason": "Release freeze"}'
# See everything (any member can read it)
curl $API/api/v1/orgs/$ORG/safetyswitch is read_only, shadow, org, repository (with target: "owner/repo") or workflow (with target
set to the workflow id). The instance switch is PUT /api/v1/system/safety with {"on": true, "reason": "..."}.
The emergency stop#
If the database is down, or you can't sign in, set this on the server and restart it:
MENDLOOP_KILL_SWITCH=1Mendloop then makes no writes and starts no runs, whatever the database says. Remove it and restart to go back to normal.
What you'll see#
A blocked write fails with a clear error that names the switch and the reason, for example
read_only: Read-only mode is on for this organization ... Reason: Audit week. Paused runs show "Paused: The kill
switch for this organization is on" in the run timeline. The audit log records read_only.enabled,
kill_switch.enabled, workflow.disabled and their opposites, each with the reason.