Workflow structure#
The article explains the structure of a workflow in detail.
Important
The following examples are relevant for the default YAML loader.
For custom loaders, refer the developers guide.
Structure#
A typical workflow source is a YAML document, containing a mapping with the fields described below. Any other fields or document types are rejected by default.
actions#
Represents a list of mappings, each of which define an action. The mapping structure is:
Key |
Description |
|---|---|
|
Defines what and how this action does. |
|
A unique identifier for the workflow step. |
|
Text description of the action. |
|
Defines direct dependencies for the action. |
|
Specifies whether to allow switching the action on-off during plan interaction phase. |
|
Specifies whether to allow switching the action on-off during plan interaction phase. |
|
Defines variables available only during this action rendering. |
expects field#
This field, when set, should be of one of the following types:
A list of mappings: an item of this list is a mapping with the following fields:
Key
Description
name
required,
type: stringA name of another action in the workflow.
strict
optional,
type: booleanForce the dependency strictness.
When not set, it is determined by the Strategy.# An example of an action using mapping-type dependencies - name: ActionOne type: <...> expects: - name: ActionTwo - name: ActionThree strict: yes
A list of strings: contains a list of another actions names, e.g.
# An example of an action using string-type dependencies - name: ActionOne type: <...> expects: - ActionTwo - ActionThree
A string: fully equivalent to a list of one string, e.g.
# An example of an action setting a single dependency - name: ActionOne type: <...> expects: ActionTwo
context#
Contains key-value definitions of context fields, which are either literals, expressions or complex YAML types consisting of them. Root structure must be a mapping with string keys, yet values types are not forced.
configuration#
Some parameters can be set for the workflow explicitly (e.g. strategy). These settings reside in this section.
A comprehensive example#
---
configuration:
strategy: strict # Set the strategy explicitly for this workflow
context:
greeting: "Hello, @{ ctx.user.name }!" # A template with a reference to another context field
user:
name: !@ env.USER # Context expression
actions:
- name: GreetUser
description: Say hi to the user
type: echo
message: "@{ ctx.greeting }"
- name: ReportCurrentWorkDir
description: Print out the working directory
type: shell
command: |
pwd
expects:
- name: GreetUser
strict: no
- name: CheckEnvironment
description: Validate that use has the AWS_DEFAULT_REGION variable set
type: shell
severity: low
command: |
[ "$AWS_DEFAULT_REGION" != "" ] || exit 1
expects: GreetUser