@@ -224,18 +224,20 @@ _This example used the `exec` type, but the `dir` field can be used with the `se
224224
225225##### exec
226226
227+ The `exec` type is used to run a command directly in the shell. The command can be a single command or a script file.
228+
227229```yaml
228230fromFile:
229231 - "generated.sh"
230232executables:
231- - verb: "send "
232- name: "ping "
233+ - verb: "init "
234+ name: "chezmoi "
233235 exec:
234- cmd : "ping -c 3 google.com "
235- - verb: "run "
236- name: "file "
236+ file : "init-chezmoi.sh "
237+ - verb: "apply "
238+ name: "dotfiles "
237239 exec:
238- file : "run.sh "
240+ cmd : "chezmoi apply "
239241```
240242
241243**Generated Executable**
@@ -273,69 +275,104 @@ echo "Hello from a generated executable!"
273275
274276# #### serial
275277
278+ The ` serial` type is used to run a list of executables sequentially. For each ` exec` in the list, you must define
279+ either a ` ref` to another executable or a ` cmd` to run directly in the shell.
280+
281+ The [executable environment variables](# environment-variables) and [executable directory](#changing-directories)
282+ of the parent executable are inherited by the child executables.
283+
276284` ` ` yaml
277285executables:
278- - verb: " start "
279- name: " env-setup "
286+ - verb: " setup "
287+ name: " flow-system "
280288 serial:
281- failFast: true
289+ failFast: true # Setting ` failFast ` will stop the execution if any of the executables fail
282290 execs:
283- - ref: " build checkout/backend "
284- - ref: " build checkout/frontend "
285- retries: 2
286- - ref: " build users:server "
287- - ref: " deploy all "
288- - cmd: " echo 'All done!' "
289- reviewRequired: true
291+ - ref: " upgrade flow:cli "
292+ - ref: " install flow:workspaces "
293+ args: [ " all " ] # When referring to another executable that requires arguments, you can pass them in the `args` field
294+ retries: 2 # retry the executable up to 2 times if it fails
295+ - ref: " apply flow:config "
296+ reviewRequired: true # serial execution will pause here for review (user input)
297+ - cmd: " flow sync "
290298` ` `
291299
292300# #### parallel
293301
302+ The ` parallel` type is used to run a list of executables concurrently. For each ` exec` in the list, you must define
303+ either a ` ref` to another executable or a ` cmd` to run directly in the shell.
304+
305+ The [executable environment variables](# environment-variables) and [executable directory](#changing-directories)
306+ of the parent executable are inherited by the child executables.
307+
294308` ` ` yaml
295309executables:
296- - verb: " watch "
297- name: " logs "
310+ - verb: " deploy "
311+ name: " apps "
298312 parallel:
299- maxThreads: 2
300- timeout: " 2h "
313+ failFast: true # Setting ` failFast ` will stop the execution if any of the executables fail
314+ maxThreads: 2 # Setting `maxThreads` will limit the number of concurrent threads that can be run at once
301315 execs:
302- - ref: " tail logs/backend.log"
303- - ref: " tail logs/frontend.log"
304- - ref: " tail logs/users.log"
316+ - ref: " deploy helm-app"
317+ args: [" tailscale" ] # When referring to another executable that requires arguments, you can pass them in the `args` field
318+ - ref: " deploy helm-app"
319+ args: [" metallb" ]
320+ - ref: " setup gloo-gateway"
321+ retries: 1 # retry the executable up to 1 time if it fails
322+ - cmd: " kubectl apply -f external-services.yaml"
305323` ` `
306324
307325# #### launch
308326
327+ The ` launch` type is used to open a service or application. The ` uri` field is required and can include environment variables
328+ (including those resolved from params and args)
329+
309330` ` ` yaml
310331executables:
311332 - verb: " open"
312- name: " ws-config "
333+ name: " workspace "
313334 launch:
314335 uri: " $FLOW_WORKSPACE_PATH "
315- wait: true
336+ app: " Visual Studio Code" # optional application to open the URI with
337+ wait: true # wait for the application to close before continuing
316338` ` `
317339
318340# #### request
319341
342+ The ` request` type is used to make HTTP requests to APIs. The ` url` field is required, and the ` method` field defaults
343+ to ` GET` .
344+
345+ Additionally, you can define the ` body` field to include a request body and the ` headers` field to include custom headers.
346+
320347` ` ` yaml
321348executables:
322- - verb: " transform "
323- name: " greeting "
349+ - verb: " pause "
350+ name: " pihole "
324351 request:
325352 method: " POST"
326- url: " https://httpbin.org/post"
327- body: ' {"hello": "world"}'
328- logResponse: true
329- transformResponse: " .args.hello = 'universe' | .args"
353+ url: " http://pi.hole/admin/api.php?disable=$DURATION &auth=$PWHASH "
354+ logResponse: true # log the response body
355+ validStatusCodes: [200] # only consider the execution successful if the status code is 200
356+ # transform the response body with jq
357+ transformResponse: |
358+ if .status == " disabled" then .status = " pause" else . end
330359` ` `
331360
332361# #### render
333362
363+ The ` render` type is used to generate and view markdown created dynamically with templates or configurations.
364+ The ` templateFile` field is required and can include environment variables (including those resolved from params and args).
365+
366+ The markdown template can include [Go template](https://pkg.go.dev/text/template) syntax to dynamically generate content.
367+ [Sprig functions](https://masterminds.github.io/sprig/) are also available for use in the template.
368+
334369` ` ` yaml
335370executables:
336- - verb: " render "
337- name: " documentation "
371+ - verb: " show "
372+ name: " cluster-summary "
338373 render:
339- templateFile: " template.md"
340- templateDataFile: " template-data.yaml"
374+ templateFile: " cluster-template.md"
375+ # Optionally, you can define a data file to use with the template
376+ # It can be a JSON or YAML file.
377+ templateDataFile: " kubectl-out.json"
341378` ` `
0 commit comments