Skip to main content

Workflow Commands

In this section, you will find the list of Workflow commands.


CommandDescription
stk create workflowCreates a basic structure for a Workflow and the workflow.yaml file.
stk list workflowLists all Workflows registered in an active Workspace or Studio.
stk publish workflowPublishes your Workflow to a Studio in the StackSpot EDP Portal.
stk resume workflowStarts the execution of Workflows that are suspended.
stk run workflowRuns a Workflow of type reusable.
stk validate workflowValidates the structure of a Workflow.

stk create workflow

The stk create workflow command creates a basic structure for a Workflow.

Usage

To create a Workflow, run the command below and provide a name for the Workflow. Fill in the Workflow data in the terminal or provide them directly in the command line:

stk create workflow WORKFLOW-NAME --description "DESCRIPTION TEXT" --type deploy/rollback/starter/reusable --target "./PATH/TO/OTHER/FOLDER" --non-interactive

Example:

stk create workflow sqs-workflow-config --description "AWS SQS queue configuration" --type deploy --target "localUser/Documents/infra-workflows" --non-interactive

Parameters

OptionsDescriptionExample
-d, --description TEXTText to describe the Workflow and its purpose.
stk create workflow workflow-name --description "Workflow Description"
-o, --target TEXTThe -o, --target option sets the directory path where the Workflow will be added. Otherwise, the Workflow is created in the current folder.
stk create workflow my-workflow --target "home/user/Documents"
-t, --type TEXTDefines the Workflow type. Available types are deploy, rollback, starter, reusable.
stk create workflow workflow-name --description "Workflow Description" --type reusable
-q, --non-interactiveDoes not prompt the user for missing input parameters and returns an error if a required parameter was not provided.
stk create workflow workflow-name --description "Workflow Description" --type reusable --non-interactive
-h, --helpDisplays the command help and exits.
stk create workflow --help

stk list workflow

The stk list workflow command lists all Workflows from a Studio or Workspace. If you are in an active Workspace, the Workflows from this Workspace will be listed; otherwise, you must provide a Studio name to list its Workflows.

Usage

To list Workflows from a Workspace:

  1. First, access a Workspace with the command:
stk use workspace WORKSPACE-NAME
  1. List the Workflows from the active Workspace:
stk list workflow

To list Workflows from a Studio:

  1. Make sure you are not in an active Workspace, run the following command:
stk exit workspace
  1. Run the following command, providing the Studio name (Studio slug):
stk list workflow --studio STUDIO-NAME

Parameters

OptionsDescriptionExample
-stu, --studio TEXTFilters the Workflows by the Studio name (Studio slug).
stk list workflow --studio techwriters-studio
-h, --helpDisplays the command help and exits.
stk list workflow --help

stk publish workflow

The stk publish workflow command publishes a Workflow to a Studio on the StackSpot EDP platform.

Usage

Inside the Workflow folder, run the following command and provide the Studio name (Studio slug) where the Workflow will be published:

stk publish workflow --studio STUDIO-NAME --verbose

Example:

stk publish workflow --studio techwriters-studio --verbose

Parameters

OptionsDescriptionExample
-s, --studioStudio name (Studio slug) to publish the Workflow.
stk publish workflow --studio techwriters-studio
-v, --verboseEnables verbose logging of the Workflow publishing steps in the terminal.
stk publish workflow --studio techwriters-studio --verbose
-h, --helpDisplays the command help and exits.
stk publish workflow --help

stk resume workflow

The stk resume workflow command starts the execution of a paused or suspended Workflow.

A Workflow is "paused" in a pipeline until it is identified and automatically executed by the STK CLI using the stk resume workflow command. For local executions, the stk resume workflow command must be run manually.

Suspended Workflows (status suspend) are Workflows that have their execution paused by the "Approval" mechanism. This occurs when one of the Workflow steps requires approval from an Account or Workspace administrator to continue execution. The stk resume workflow command is triggered after the Workflow step is approved.

Usage

Run the following command and provide the Workflow ID:

stk resume workflow WORKFLOW-ID

For local executions, provide the ID and the Workflow folder path:

stk resume workflow WORKFLOW-ID --path "./Documents/workflows-stk/"
tip

The Workflow ID is obtained from the terminal log after its execution.

Parameters

OptionsDescriptionExample
-p, --path TEXTPath to the folder of a local Workflow that is in execution.
stk resume workflow WORKFLOW-ID --path "./Documents/workflows-stk/"
-h, --helpDisplays the command help and exits.
stk add action --help

stk run workflow

The stk run workflow command runs Workflows of type reusable.

Usage

To run a Workflow of type reusable, run the following command:

Syntax:

stk run workflow WORKFLOW-NAME|PATH/TO/WORKFLOW --inputs-json '{"input_1": "value", "input_2": "value"}' --non-interactive --report-status --env ENVIRONMENT-NAME

Example:

stk run workflow documentation-wf-reusable --inputs-json '{"input_1": "value", "input_2": "value"}' --non-interactive --report-status --env dev

Local Workflow execution:

stk run workflow /Documents/Workflows/documentation-wf-reusable --inputs-json '{"input_1": "value", "input_2": "value"}' --non-interactive --report-status --env stg

Parameters

OptionsDescriptionExample
-i, --inputs-json TEXTProvides input values for the Workflow in JSON format.stk run workflow documentation-wf-reusable --inputs-json '{"input_1": "value", "input_2": "value"}' --non-interactive --report-status --env prod
-e, --env TEXTName of the environment (environment slug) where the Workflow will run. Required when the reusable Workflow interacts with resources from other Workflows of type deploy and rollback.stk run workflow documentation-wf-reusable --inputs-json '{"input_1": "value", "input_2": "value"}' --non-interactive --report-status --env dev
-q, --non-interactiveDoes not prompt the user for missing input parameters and returns an error if a required parameter was not provided.stk run workflow documentation-wf-reusable --inputs-json '{"input_1": "value", "input_2": "value"}' --non-interactive --report-status --env dev
-r, --report-statusSends the Workflow execution report to the activity history of the current Application or Infrastructure that is using the Workflow.stk run workflow documentation-wf-reusable --inputs-json '{"input_1": "value", "input_2": "value"}' --report-status
-rwc, --resume-workflow-configReceives a JSON string with Azure, GitHub, or GitLab configurations (one at a time). Examples: {"azure": {"pipeline_name": "...", "org": "...", "project_name": "...","branch": "..."}} or {"github":{"repository_name": "...", "org": "...", "workflow_name": "...", "branch": "..."}} or {"gitlab": {"id": "...", "slug": "..."}}
stk run workflow studio/stack/workflow-name@1.0.0 --report-status --non-interactive --env dev --resume-workflow-config '{"azure": {"pipeline_name": "...", "org": "...", "project_name": "...","branch": "..."}} '
-h, --helpDisplays the command help and exits.
stk run workflow --help

stk validate workflow

The stk validate workflow command checks the structure of the workflow.yaml file and displays a log in the terminal with any errors found in your Workflow. This command is also automatically executed before publishing a Workflow and will block publishing if any errors are found.

Usage

To validate the structure of your Workflow, run the following command inside the Workflow folder:

stk validate workflow --studio STUDIO-NAME --verbose

Example:

stk validate workflow --studio techwriters-studio --verbose

Parameters

OptionsDescriptionExample
-v, --verboseEnables verbose logging of the Workflow structure validation steps in the terminal.
stk validate workflow --studio techwriters-studio --verbose
-s, --studioStudio name (Studio slug) to validate the current Workflow based on information from a previously published Workflow version.
stk validate workflow --studio techwriters-studio
-h, --helpDisplays the command help and exits.
stk validate workflow --help