opschain triggers update
triggers
opschain triggers update <project>/<code> [-f <file.yaml>] [--condition <expr> ...]
[--throttle <n>] [--run-as <username>] [--owned-by <group>]
Updates parts of a trigger, sending only what is supplied
(PATCH /api/projects/{project}/triggers/{id}); unsupplied attributes keep
their stored values. At least one of the five flags must be passed.
The sources overlay in this order — a flag wins over the file for the attribute it names:
-f <file.yaml>— the same flat attribute formattriggers createloads, strictly checked against the same accepted key set. Every attribute in the file is sent exceptcode: code is immutable, and a file whosecodedisagrees with the addressed trigger is refused.--condition(repeatable) — a replacement conditions list. It REPLACES the stored conditions array wholesale; there is no append.--throttle <n>— a newthrottle_per_minute. Sent whenever the flag is passed,0included.--run-as <username>— the identity the trigger's firings execute and authorisation-check as. Setting it requires youract_astrust grant for that identity on the project;--run-as ""clears it. Service accounts (opschain admin service-accounts) are the durable choice for anything a team depends on.--owned-by <group>— the group that owns this automation: maintenance and failure-notification accountability routes to the team, surviving individual departures. Must name a known group (local or provider snapshot);--owned-by ""clears it.
On success: updated trigger <project>/<code> (-o json|yaml prints the
server's response document instead). Needs a server target (--server <url>, OPSCHAIN_SERVER, or the active context).
Flags
| Flag | Meaning |
|---|---|
-f, --file <file> | Flat YAML definition — every attribute in it is sent (except code). |
--condition <expr> | Replacement condition event.<path> <op> <value> (repeatable; REPLACES the stored conditions array). |
--throttle <n> | New throttle_per_minute. |
--run-as <username> | Identity this trigger's firings execute as (needs your act_as trust grant; "" clears). |
--owned-by <group> | Group owning this automation — routes its notifications and maintenance to the team ("" clears). |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Trigger updated. |
| 1 | The command failed (trigger not found, server refused the update). |
| 2 | Usage error — nothing to send, invalid file, code mismatch, no server target. |
Named errors
nothing to update — pass -f, --condition, --throttle, --run-as and/or --owned-by— exit 2.<file> defines code "<other>" but the command addresses <project>/<code> — code is immutable— exit 2.<file>: unknown trigger attribute(s) <keys> (accepted: …)and<file> is a trigger interchange document (trigger/when/then) — load it withopschain triggers import`` — the create loader's checks, exit 2.trigger "<code>" not found in project "<project>"— exit 1.
Examples
opschain triggers update demo/promote_on_success --throttle 10
opschain triggers update demo/promote_on_success \
--condition "event.source.action eq web:deploy" \
--condition "event.data.region in syd,mel"
opschain triggers update demo/promote_on_success --run-as release-bot
opschain triggers update demo/promote_on_success --owned-by platform-team
See also
opschain docs cli/triggers-create— the file format.opschain docs cli/triggers-enableandopschain docs cli/triggers-disable— the dedicated enabled-flag verbs.opschain docs cli/triggers-import— full replacement from an exported document.