You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/executables.md
+87-37Lines changed: 87 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Executables
4
4
5
5
# Executables
6
6
7
-
Executables are the building blocks of flow automation. They can be simple commands, complex multi-step workflows, HTTP requests, or even GUI applications.
7
+
Executables are the building blocks of flow automation. They can be simple commands, complex multi-step workflows, HTTP requests, or even GUI applications.
8
8
This guide covers all executable types and configuration options.
9
9
10
10
## Finding Executables
@@ -67,7 +67,7 @@ Customize executable behavior with environment variables or temporary files usin
67
67
68
68
> [!INFO]
69
69
> Executables inherit environment variables from their parent executable, workspace, and system.
70
-
>
70
+
>
71
71
> By default, values defined in the `.env` file at the workspace root are automatically loaded. This can be overriden
72
72
> in the workspace configuration file with the `envFiles` field.
- `method`: HTTP method (GET, POST, PUT, PATCH, DELETE)
349
348
- `url`: Request URL (required)
350
349
- `headers`: Custom headers
351
-
- `body`: Request body with Expr templating
350
+
- `body`: Request body
352
351
- `timeout`: Request timeout
353
352
- `validStatusCodes`: Acceptable status codes
354
353
- `logResponse`: Log response body
355
-
- `transformResponse`: Transform response with Expr templating
354
+
- `transformResponse`: Expr expression to reshape the response before output or file save
356
355
- `responseFile`: Save response to file
357
356
357
+
**Transforming responses with `transformResponse`:**
358
+
359
+
The `transformResponse` field is a single [Expr expression](./expressions) evaluated after the request completes. Its result replaces the raw response body in any output or `responseFile`. The expression has access to:
> `headers` is a `map[string][]string` — each name maps to a slice of values. Access the first value with `headers["Content-Type"][0]`, not `headers["Content-Type"]`.
- `templateDataFile`: JSON/YAML data file for the `data` variable
408
+
- `dir`: Working directory
409
+
- `params`: Environment variable definitions (available as `env["KEY"]`)
410
+
411
+
**Available template variables:**
374
412
375
-
Current time: {{ data["timestamp"] }}
413
+
| Variable | Type | Description |
414
+
|----------|------|-------------|
415
+
| `env` | `map[string]string` | Params and environment variables from the executable |
416
+
| `data` | `any` | Parsed contents of `templateDataFile` (nil if not set) |
376
417
377
-
## Services
378
-
{{- range .services }}
379
-
- **{{ .name }}**: {{ data["status"] }}
380
-
{{- end }}
418
+
`data` is typed based on the file content — a JSON object becomes a map, a JSON array becomes a slice. Access fields with bracket notation: `data["key"]`or `data[0]["field"]`.
381
419
382
-
## Metrics
383
-
- CPU: {{ data["cpu"] }}%
384
-
- Memory: {{ data["memory"] }}%
420
+
**Template file example** — given a `status-data.json`:
The template syntax uses `{{ expression }}` delimiters where expressions are evaluated using the [Expr language](./expressions). See the [Expression Language](./expressions) guide for syntax and built-ins.
390
440
391
441
## Importing Executables
392
442
@@ -508,12 +558,12 @@ services:
508
558
build: .
509
559
ports:
510
560
- "3000:3000"
511
-
561
+
512
562
db:
513
563
image: postgres:13
514
564
environment:
515
565
POSTGRES_DB: myapp
516
-
566
+
517
567
redis:
518
568
image: redis:6
519
569
```
@@ -539,12 +589,12 @@ executables:
539
589
name: api
540
590
exec:
541
591
cmd: docker build -t api .
542
-
592
+
543
593
- verb: test
544
594
name: api
545
595
exec:
546
596
cmd: npm test
547
-
597
+
548
598
# Composite workflows
549
599
- verb: deploy
550
600
name: full
@@ -553,7 +603,7 @@ executables:
553
603
- ref: build api
554
604
- ref: test api
555
605
- cmd: kubectl apply -f api.yaml
556
-
606
+
557
607
# Cross-workspace references (requires public visibility)
0 commit comments