Skip to main content
Version: v4.4.0

task.yaml

The task.yaml file contains the basic structure to configure operations you can perform on a Stack or a project.

task.yaml file attributes

To create a Task, run the command stk create task, you will get the basic structure of your Task. See an example below:

name: <your-task-name>
description: <ask-description-text>
inputs:
- label: commit message
type: text
default: example
name: message
required: 'true'
supported-os:
- windows
- linux
- mac
requirements-check:
dependency-example:
check-command: git --version
info: git is not installed
command: git add . ; git commit -m "{{inputs.message}}"

Mandatory Task Attributes

name

A string that defines the name of the Task. This information defines the name of the Task, it works when you execute the stk run command.

name: <task-name>

description

A string that describes the Task's purpose, it should contain relevant information for the users when running the stk list task command.

description: <text-description-task>

supported-os

Parameter that defines the operating systems the Task will support. The options are:

supported-os:
- windows
- linux
- mac

command

Command or list of commands the Task will execute. You can split the execution by operating system using the objects named after each operating system:

command: git add . ; git commit -m "{{inputs.message}}"

Or by operating system:

command:
- linux: |
echo "I'm on linux"
git add . ; git commit -m "{{inputs.message}}"
- mac: |
echo "I'm on macOS"
git add . ; git commit -m "{{inputs.message}}"
- windows: |
echo "I'm on windows"
git add . ; git commit -m "{{inputs.message}}"

Optional Task Attributes

requirements-check

Requirements list that will be checked before the list command is executed. The available option is dependency-example with check-command and info parameters:

requirements-check:
dependency-example:
check-command: git --version
info: git is not installed

check-command

String with a command, it will be executed during the requirements check:

check-command: git --version

info

String with a message it will be displayed if the requirements check fails:

info: git is not installed

container

Execute the task's command' inside a docker' container.

container:
image: alpine
volumes: # optional
- "{{ component_path.absolute() }}:/data"

image

String with the image's URL:

image: ubuntu

volumes

The list with the volumes that are assembled during the Task execution. Here is an example:

volumes:
- /my/files:data
- "{{ target_path.absolute() }}:/project"

inputs

Check the available input types in the Inputs from .yaml files page.

Next steps

Check the Inputs from .yaml files section to see all the available input types.

Was this page helpful?