@gapi/gcli 1.8.246 → 1.8.247
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README-CLI.md
CHANGED
|
@@ -79,6 +79,9 @@ Commands:
|
|
|
79
79
|
workflow:runs [options] List a workflow runs, newest first
|
|
80
80
|
workflow:status [options] Show a run: its step events, error and output (--follow until it ends)
|
|
81
81
|
workflow:cancel [options] Cancel a running run
|
|
82
|
+
workflow:trigger:add [options] Start runs from an HTTP URL (--http; the JSON body is the input) or a schedule (--cron). Needs Fission 1.26+ on the cluster
|
|
83
|
+
workflow:trigger:list [options] List a workflow HTTP and schedule triggers
|
|
84
|
+
workflow:trigger:remove [options] Remove a workflow trigger
|
|
82
85
|
help [command] display help for command
|
|
83
86
|
[36m
|
|
84
87
|
--- Subcommand: login ---[0m
|
|
@@ -1134,3 +1137,43 @@ Options:
|
|
|
1134
1137
|
-n, --name <name> Workflow name
|
|
1135
1138
|
-r, --run <run> Run name (see workflow:runs)
|
|
1136
1139
|
-h, --help display help for command
|
|
1140
|
+
[36m
|
|
1141
|
+
--- Subcommand: workflow:trigger:add ---[0m
|
|
1142
|
+
Usage: gcli workflow:trigger:add [options]
|
|
1143
|
+
|
|
1144
|
+
Start runs from an HTTP URL (--http; the JSON body is the input) or a schedule (--cron). Needs Fission 1.26+ on the cluster
|
|
1145
|
+
|
|
1146
|
+
Options:
|
|
1147
|
+
-p, --project <project>
|
|
1148
|
+
-n, --name <name> Workflow name
|
|
1149
|
+
--http An HTTP trigger: <router>/<project>/workflows/<path>
|
|
1150
|
+
--path <path> HTTP path under /workflows/ (default: the workflow
|
|
1151
|
+
name)
|
|
1152
|
+
--method <methods> HTTP methods, comma separated (default POST)
|
|
1153
|
+
--cron <schedule> A schedule: "@every 1h", "0 9 * * 1-5", "@daily"
|
|
1154
|
+
(UTC)
|
|
1155
|
+
-i, --input <json> Schedule: the input of every run (default {})
|
|
1156
|
+
--input-file <file> Schedule: read the run input from a JSON file
|
|
1157
|
+
-h, --help display help for command
|
|
1158
|
+
[36m
|
|
1159
|
+
--- Subcommand: workflow:trigger:list ---[0m
|
|
1160
|
+
Usage: gcli workflow:trigger:list [options]
|
|
1161
|
+
|
|
1162
|
+
List a workflow HTTP and schedule triggers
|
|
1163
|
+
|
|
1164
|
+
Options:
|
|
1165
|
+
-p, --project <project>
|
|
1166
|
+
-n, --name <name> Workflow name
|
|
1167
|
+
-h, --help display help for command
|
|
1168
|
+
[36m
|
|
1169
|
+
--- Subcommand: workflow:trigger:remove ---[0m
|
|
1170
|
+
Usage: gcli workflow:trigger:remove [options]
|
|
1171
|
+
|
|
1172
|
+
Remove a workflow trigger
|
|
1173
|
+
|
|
1174
|
+
Options:
|
|
1175
|
+
-p, --project <project>
|
|
1176
|
+
-n, --name <name> Workflow name
|
|
1177
|
+
-t, --trigger <trigger> Trigger id, path or schedule (see
|
|
1178
|
+
workflow:trigger:list)
|
|
1179
|
+
-h, --help display help for command
|
package/README.md
CHANGED
|
@@ -788,6 +788,24 @@ gcli workflow:validate -f order-flow.yaml
|
|
|
788
788
|
gcli workflow:delete --name order-flow # also deletes its runs
|
|
789
789
|
```
|
|
790
790
|
|
|
791
|
+
**Triggers** start runs without anyone calling `workflow:run` (Fission 1.26+
|
|
792
|
+
on the workflow's cluster creates the run itself):
|
|
793
|
+
|
|
794
|
+
```bash
|
|
795
|
+
# An HTTP URL: every request starts a run, the JSON body is the run input,
|
|
796
|
+
# the answer is 202 {"run": "..."}; default path = the workflow name, POST
|
|
797
|
+
gcli workflow:trigger:add --name order-flow --http --path orders --method POST
|
|
798
|
+
curl -X POST 'https://functions.lambforge.com/<projectId>/workflows/orders' -d '{"orderId": 42}'
|
|
799
|
+
|
|
800
|
+
# A schedule (UTC) with a fixed run input
|
|
801
|
+
gcli workflow:trigger:add --name nightly-report --cron "0 6 * * *" --input '{"scope": "all"}'
|
|
802
|
+
|
|
803
|
+
gcli workflow:trigger:list --name order-flow
|
|
804
|
+
gcli workflow:trigger:remove --name order-flow --trigger orders # id, path or schedule
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
`workflow:runs` shows how each run started (`manual`, `http`, `schedule`).
|
|
808
|
+
|
|
791
809
|
The file `workflow:get` / `workflow:generate` write (and `workflow:apply`
|
|
792
810
|
reads) - a Fission `kind: Workflow` manifest or a bare `startAt` + `states`
|
|
793
811
|
works too:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
## 2026-10-26 - workflows: workflow:trigger commands for HTTP and schedule triggers
|
|
2
|
+
|
|
3
|
+
**Feature:** workflows · **Type:** feat
|
|
4
|
+
|
|
5
|
+
- `workflow:trigger:add` (`--http [--path] [--method]` or `--cron
|
|
6
|
+
"<schedule>" [-i | --input-file]`), `workflow:trigger:list`,
|
|
7
|
+
`workflow:trigger:remove -t <id | path | schedule | Fission name>`
|
|
8
|
+
(`src/commands/workflow/trigger-*.ts`), on the graphql-server-lambdas
|
|
9
|
+
`addWorkflowTrigger` / `removeWorkflowTrigger` (Fission 1.26+ fork
|
|
10
|
+
`workflow-triggers` creates the runs).
|
|
11
|
+
- Option handling and output are pure (`triggers.ts`: `buildTriggerInput`,
|
|
12
|
+
`findTrigger`, `triggerRow`, `runSource`); `workflow:runs` gained a `by`
|
|
13
|
+
column (manual / http / schedule). `WorkflowFragment.triggers`,
|
|
14
|
+
`WorkflowRunFragment.triggerKind / triggerName`; client calls in
|
|
15
|
+
`gql-client.ts`.
|
|
16
|
+
- README Workflows section + regenerated `README-CLI.md`.
|
|
17
|
+
- **Test:** `npx jest --coverage=false test/workflow.spec.ts` (11 pass, 5 new).
|
|
18
|
+
- **Debug:** `Workflow triggers need Fission 1.26 or newer on this cluster`
|
|
19
|
+
is the backend saying the cluster is too old; `Pass either --http or
|
|
20
|
+
--cron` is the option check.
|
|
21
|
+
- **Verification:** gcli jest 114/114; tsc + eslint clean; the new
|
|
22
|
+
mutations and fragments validated against the local gateway schema;
|
|
23
|
+
not run against production (gcli login points at production).
|
|
@@ -17,9 +17,19 @@ the id with `listWorkflows`):
|
|
|
17
17
|
| `workflow:validate -f file` | `validateWorkflow` (graph + lambdas on the cluster) |
|
|
18
18
|
| `workflow:delete -n` | `deleteWorkflow` (runs too) |
|
|
19
19
|
| `workflow:run -n [-i json \| --input-file] [--wait]` | `startWorkflowRun`; `--wait` polls `getWorkflowRun` every 2 s and prints each new event until the run is terminal |
|
|
20
|
-
| `workflow:runs -n [-l]` | `listWorkflowRuns` |
|
|
20
|
+
| `workflow:runs -n [-l]` | `listWorkflowRuns` (column `by`: manual / http / schedule, from `triggerKind`) |
|
|
21
21
|
| `workflow:status -n -r run [--follow]` | `getWorkflowRun` (events, error, output) |
|
|
22
22
|
| `workflow:cancel -n -r run` | `cancelWorkflowRun` |
|
|
23
|
+
| `workflow:trigger:add -n (--http [--path] [--method a,b] \| --cron "<schedule>" [-i json \| --input-file])` | `addWorkflowTrigger`; prints the trigger and, for HTTP, a `curl` line |
|
|
24
|
+
| `workflow:trigger:list -n` | the workflow's `triggers` (id, kind, URL or schedule, input) |
|
|
25
|
+
| `workflow:trigger:remove -n -t <id \| path \| schedule \| Fission name>` | `removeWorkflowTrigger` |
|
|
26
|
+
|
|
27
|
+
Triggers (2026-10-26) are HTTP URLs (`<router>/<projectId>/workflows/<path>`,
|
|
28
|
+
the JSON body is the run input, 202 `{run}`) and schedules (cron, UTC, with a
|
|
29
|
+
fixed input) that start runs. Fission 1.26+ (fork `workflow-triggers`) on the
|
|
30
|
+
workflow's cluster creates the run. The option handling is pure and tested:
|
|
31
|
+
`src/commands/workflow/triggers.ts` (`buildTriggerInput`, `findTrigger`,
|
|
32
|
+
`triggerRow`, `runSource`).
|
|
23
33
|
|
|
24
34
|
The workflow file (`definition.ts` `parseWorkflowFile`) accepts
|
|
25
35
|
`workflow: {name, description, clusterId, definition}`, the same without the
|
|
@@ -37,7 +47,9 @@ USER-only in graphql-server-lambdas, so these commands need `gcli login`.
|
|
|
37
47
|
`npx jest --coverage=false test/workflow.spec.ts`. Real: log in to a
|
|
38
48
|
gateway whose project has `allowWorkflows`, then
|
|
39
49
|
`gcli workflow:generate -d "..." -n demo --apply` and
|
|
40
|
-
`gcli workflow:run -n demo --wait
|
|
50
|
+
`gcli workflow:run -n demo --wait`; triggers:
|
|
51
|
+
`gcli workflow:trigger:add -n demo --http`, then `curl -X POST <url> -d '{}'`
|
|
52
|
+
and `gcli workflow:runs -n demo` shows the run `by` http.
|
|
41
53
|
|
|
42
54
|
## How to debug
|
|
43
55
|
|
|
@@ -47,3 +59,6 @@ gateway whose project has `allowWorkflows`, then
|
|
|
47
59
|
`allowWorkflows`.
|
|
48
60
|
- `Workflows are not enabled on this cluster`: the cluster runs Fission
|
|
49
61
|
without `workflows.enabled` (canonical doc, Requires).
|
|
62
|
+
- `Workflow triggers need Fission 1.26 or newer on this cluster`: the
|
|
63
|
+
cluster's Fission CRDs predate workflow triggers.
|
|
64
|
+
- `Pass either --http or --cron`: exactly one of them.
|