Workflow Specification
In this section, you will find details about Workflow Specification.
Workflow Specification
A Workflow is created as a YAML file named workflow.yaml. See its manifest below:
Manifest workflow.yaml specification
schema-version: v1
kind: workflow
metadata:
name: workflow-name
display-name: Workflow displayed to user
description: Description of what workflow does
version: 0.0.1
spec:
type: deploy
label: Deploy application
repository: https://github.com/stack-spot/workflow
targets:
- "app"
- "infra"
docs:
pt-br: docs/pt-br/doc.md
en-us: docs/en-us/doc.md
inputs:
- type: text
name: text_input
label: "Type some text:"
- type: bool
name: boolean_input
label: "Do you want to run optional job?"
- type: generated-connection
name: some_s3_connection
label: "Give an alias for generated S3 connection"
connection-interface-type: aws-s3-conn
computed-inputs:
computed_input_name: "{{ text_input | upper}}"
outputs:
uppercase_text_output: "{{ computed_input_name | upper }}"
jobs:
- id: some_job
label: Some job
steps:
- type: action
name: studio/some_action@1
id: some_action_execution
label: Execution action
workdir: .
inputs:
some_action_input: "fixed_value"
other_action_input: "{{ inputs.text_input }}"
- id: optional
label: Optional job
depends-on:
- some_job
when: "{{ boolean_input }}"
steps:
- type: plugin
name: studio/optional_plugin@1
id: apply_optional_plugin
label: Apply optional plugin
when: "{{ boolean_input }}"
inputs:
some_plugin_input: "fixed_value"
other_plugin_input: "{{ text_input | lower }}"
input_from_other_job: "{{ outputs.some_job.some_action_execution.some_action_output }}"
Workflow Attributes
Below are the details for each attribute in a Workflow specification:
| Attribute | Description |
|---|---|
schema-version | Contains the schema version, fixed value “v1”. |
kind | Contains the manifest type, fixed value “workflow”. |
metadata | Contains metadata information for the workflow: name, description, and version. |
spec | Contains the Workflow specification. |
spec.label | The label displayed to the user to identify the workflow. |
spec.repository | The URL for the source repository of the Workflow. Optional attribute. |
spec.type | Workflow type: “create”, “starter”, “deploy”, “rollback”, “reusable”. |
spec.targets | Required for Workflows of type starter, deploy, or rollback. Specifies whether it can be applied to “app”, “infra”, or both. |
spec.docs | Workflow documentation in English and Portuguese. Optional attribute. Documentation must be in Markdown format. |
spec.inputs | List of inputs that will be prompted to the user when running the Workflow. Except for inputs with the parameter scope: hidden. |
spec.computed-inputs | Contains computed inputs derived from the values of other inputs. |
spec.outputs | Workflow output attributes (if any). Defined using a Jinja expression. |
spec.jobs | Groups of jobs that need to be executed within the Workflow. |
spec.jobs[i].id | Identifier for the Job, used for referencing within the workflow. Must use snake_case format. |
spec.jobs[i].label | Label shown to the user when the Job is running. |
spec.jobs[i].depends-on | List of other Jobs that this Job depends on. Jobs with resolved dependencies run in parallel. |
spec.jobs[i].when | Condition for the Job to run, defined by a Jinja expression that must return “true” (case insensitive). |
spec.jobs[i].steps | List of steps to be executed within the Jobs. |
spec.jobs[i].steps[i].type | Step type: “action”, “plugin”, “workflow”, "run", or “suspend”. |
spec.jobs[i].steps[i].workdir | Directory where the Step will be executed. Optional attribute. |
spec.jobs[i].steps[i].id | Step ID for referencing within the Workflow. Must use snake_case format. |
spec.jobs[i].steps[i].label | Label displayed in the Portal when the Step is shown. |
spec.jobs[i].steps[i].when | Condition for the Step to execute, defined by a Jinja expression. |
spec.jobs[i].steps[i].inputs | Mapping of input values to be passed to the Action/Plugin/Workflow. |
spec.jobs[i].steps[i].name | Indicates which Action/Plugin/Workflow will be executed/applied. |
spec.jobs[i].steps[i].generated-connections | Map of connections generated by the Plugin. The key is the connection alias and the value is the name provided by the user. |
spec.workflows | Only for Workflows of type “starter”. Defines which Workflows will be automatically added to stk.yaml. |