Skip to main content

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:

AttributeDescription
schema-versionContains the schema version, fixed value “v1”.
kindContains the manifest type, fixed value “workflow”.
metadataContains metadata information for the workflow: name, description, and version.
specContains the Workflow specification.
spec.labelThe label displayed to the user to identify the workflow.
spec.repositoryThe URL for the source repository of the Workflow. Optional attribute.
spec.typeWorkflow type: “create”, “starter”, “deploy”, “rollback”, “reusable”.
spec.targetsRequired for Workflows of type starter, deploy, or rollback. Specifies whether it can be applied to “app”, “infra”, or both.
spec.docsWorkflow documentation in English and Portuguese. Optional attribute. Documentation must be in Markdown format.
spec.inputsList of inputs that will be prompted to the user when running the Workflow. Except for inputs with the parameter scope: hidden.
spec.computed-inputsContains computed inputs derived from the values of other inputs.
spec.outputsWorkflow output attributes (if any). Defined using a Jinja expression.
spec.jobsGroups of jobs that need to be executed within the Workflow.
spec.jobs[i].idIdentifier for the Job, used for referencing within the workflow. Must use snake_case format.
spec.jobs[i].labelLabel shown to the user when the Job is running.
spec.jobs[i].depends-onList of other Jobs that this Job depends on. Jobs with resolved dependencies run in parallel.
spec.jobs[i].whenCondition for the Job to run, defined by a Jinja expression that must return “true” (case insensitive).
spec.jobs[i].stepsList of steps to be executed within the Jobs.
spec.jobs[i].steps[i].typeStep type: “action”, “plugin”, “workflow”, "run", or “suspend”.
spec.jobs[i].steps[i].workdirDirectory where the Step will be executed. Optional attribute.
spec.jobs[i].steps[i].idStep ID for referencing within the Workflow. Must use snake_case format.
spec.jobs[i].steps[i].labelLabel displayed in the Portal when the Step is shown.
spec.jobs[i].steps[i].whenCondition for the Step to execute, defined by a Jinja expression.
spec.jobs[i].steps[i].inputsMapping of input values to be passed to the Action/Plugin/Workflow.
spec.jobs[i].steps[i].nameIndicates which Action/Plugin/Workflow will be executed/applied.
spec.jobs[i].steps[i].generated-connectionsMap of connections generated by the Plugin. The key is the connection alias and the value is the name provided by the user.
spec.workflowsOnly for Workflows of type “starter”. Defines which Workflows will be automatically added to stk.yaml.