|
| 1 | +# Imported Executables Config Reference |
| 2 | + |
| 3 | +flow can automatically generate executables from shell scripts and Makefiles using special comments. |
| 4 | +flow parses these comments during workspace synchronization and creates executable definitions that can be run |
| 5 | +like any other flow executable. See [Importing Executables](../guide/executables.md#importing-executables) for more details. |
| 6 | + |
| 7 | +> [!NOTE] The configuration comments must be at the top of the shell script or right above the Makefile target definition. |
| 8 | +
|
| 9 | +## Supported Fields |
| 10 | + |
| 11 | +| Field | Description | Example | |
| 12 | +|--------------------|-------------|---------| |
| 13 | +| `name` | Executable name | `f:name=deploy-app` | |
| 14 | +| `verb` | Action verb | `f:verb=deploy` | |
| 15 | +| `description` | Executable description | `f:description=Deploy to production` | |
| 16 | +| `tag` or `tags` | Pipe-separated tags | `f:tags=deployment\|production` | |
| 17 | +| `alias`or `aliases` | Pipe-separated aliases | `f:aliases=prod-deploy\|deploy-prod` | |
| 18 | +| `timeout` | Execution timeout | `f:timeout=10m` | |
| 19 | +| `visibility` | Executable visibility | `f:visibility=private` | |
| 20 | +| `dir` | Working directory | `f:dir=//` | |
| 21 | +| `logMode` | Log output format | `f:logMode=json` | |
| 22 | + |
| 23 | +### Environment Parameters |
| 24 | + |
| 25 | +Define environment variables that will be available to your script with `f:params` or `f:param`: |
| 26 | + |
| 27 | +```bash |
| 28 | +#!/bin/bash |
| 29 | +# f:name=deploy-with-secrets f:verb=deploy |
| 30 | +# f:params=secretRef:api-key:API_TOKEN|prompt:Environment?:ENV_NAME|text:production:DEFAULT_ENV |
| 31 | + |
| 32 | +echo "Deploying to $ENV_NAME with token: ${API_TOKEN:0:8}..." |
| 33 | +``` |
| 34 | + |
| 35 | +**Parameter Types:** |
| 36 | +- `secretRef:secret-name:ENV_VAR` - Reference a vault secret |
| 37 | +- `prompt:Question text:ENV_VAR` - Prompt user for input |
| 38 | +- `text:static-value:ENV_VAR` - Set static value |
| 39 | + |
| 40 | +### Command Line Arguments |
| 41 | + |
| 42 | +Define command line arguments that users can pass when running the executable with `f:args` or `f:arg`: |
| 43 | + |
| 44 | +```bash |
| 45 | +#!/bin/bash |
| 46 | +# f:name=build-app f:verb=build |
| 47 | +# f:args=flag:dry-run:DRY_RUN|pos:1:VERSION|flag:verbose:VERBOSE |
| 48 | + |
| 49 | +if [ "$DRY_RUN" = "true" ]; then |
| 50 | + echo "DRY RUN: Would build version $VERSION" |
| 51 | +else |
| 52 | + echo "Building version $VERSION" |
| 53 | +fi |
| 54 | +``` |
| 55 | + |
| 56 | +**Argument Types:** |
| 57 | +- `flag:flag-name:ENV_VAR` - Named flag (`--flag-name`) |
| 58 | +- `pos:1:ENV_VAR` - Positional argument (position 1, 2, etc.) |
| 59 | + |
| 60 | +## Configuration Syntax |
| 61 | + |
| 62 | +**Single Line Format** |
| 63 | + |
| 64 | +Multiple configurations can be defined on a single line: |
| 65 | + |
| 66 | +```bash |
| 67 | +# f:name=my-task f:verb=run f:timeout=5m f:visibility=private |
| 68 | +``` |
| 69 | + |
| 70 | +**Multi-Line Format** |
| 71 | + |
| 72 | +Configurations can be split across multiple lines for readability: |
| 73 | + |
| 74 | +```bash |
| 75 | +# f:name=complex-task |
| 76 | +# f:verb=deploy |
| 77 | +# f:description="Complex deployment with multiple parameters" |
| 78 | +# f:params=secretRef:api-key:API_TOKEN |
| 79 | +# f:params=prompt:Target environment?:ENV_NAME |
| 80 | +# f:args=flag:dry-run:DRY_RUN |
| 81 | +# f:args=pos:1:VERSION |
| 82 | +``` |
| 83 | + |
| 84 | +**Multi-Line Descriptions** |
| 85 | + |
| 86 | +For longer descriptions, use the multi-line description syntax: |
| 87 | + |
| 88 | +```bash |
| 89 | +# f:name=complex-deploy f:verb=deploy |
| 90 | +# <f|description> |
| 91 | +# Deploy application to production environment |
| 92 | +# |
| 93 | +# This executable handles the complete deployment process including: |
| 94 | +# - Database migrations |
| 95 | +# - Service deployment |
| 96 | +# - Health checks |
| 97 | +# <f|description> |
| 98 | +``` |
0 commit comments