YAML Configuration

View as Markdown

The file with the definition must be named action.yml or action.yaml. In the file, you can configure the following properties:

  1. Name
  2. Inputs
  3. Commands to execute (optional)
  4. Filesystem & cache (optional)
  5. Docker image (i.e. run environment)
  6. Outputs (optional)
Success
For the complete list of fields, their types, and defaults, see YAML parameters.

Example

Here we can see an action with three inputs: user, IP, and password. The inputs are passed as variables to the command. The values are then produced in the action logs with the echo command. The command is run in the Ubuntu environment in the latest version.

yaml
name: "My_Action"
inputs:
  user:
    type: TEXT
    required: true
  ip:
    type: TEXT
  password:
    type: PASSWORD
    required: true
commands: |
  echo $user@$ip -p $password
docker_image_name: "ubuntu"
docker_image_tag: "latest"

Name & category

The name of the action must be unique throughout the whole workspace, i.e. cannot be the same as any action name on the default list of actions. If the name is not unique, a parsing error will appear. The name can be up to 40 characters long and may contain only letters, digits, and underscores. Underscores are parsed into spacebars by default. For example, an action named "My_Custom_Action" will be displayed as "My Custom Action". To display a different label on the action tile, add the optional title parameter.

By default, custom actions are added to the Custom / Popular section of the action list. You can define your own categories by adding the category parameter to the YAML file:

yaml
name: "My_Custom_Action"
title: "My custom action"
category: "Example Inputs"

Inputs

The inputs let you specify the data that the action requires. You can add single or multi-line text inputs, checkboxes, command fields, selectors, and more.

In this example, we can see two inputs: one is a simple text field for entering the username, the second is a masked input for the password. Both fields are required.

yaml
inputs:
  user:
    type: TEXT
    required: true
  password:
    type: PASSWORD
    required: true

Commands

The commands executed in the container are defined in the commands parameter, one command per line in a multi-line | block:

yaml
commands: |
  cd src
  VERSION="1.4.2"
  echo "Building $VERSION in $(pwd)"

All lines are run as one script in a single shell session, so variables and directory changes (cd) carry over to the following lines.

Info
Definitions that list the commands as a YAML list, or use the older execute_commands parameter, are still parsed and work the same way. For new actions, use the commands block.

Shell

The commands are run with Bash by default. If the Docker image does not ship Bash (for example alpine), the action fails with Bash is not installed. Set the shell parameter to SH for such images, or to POWERSHELL for PowerShell images:

yaml
docker_image_name: "alpine"
docker_image_tag: "latest"
shell: SH
commands: |
  echo "Running in $0"

Filesystem & caching

If your action requires repository files, you need to attach the pipeline filesystem to it, i.e. define the volume_mappings parameter. The filesystem is a directory exclusive to every pipeline. When a pipeline is run, Buddy pulls the repo to the filesystem, allowing you to run commands on the files it contains. The processed files and artifacts stay in the filesystem, available for use by other actions in the pipeline.

yaml
volume_mappings:
 - /:/buddy
working_directory: "/buddy"

Each mapping has the format <filesystem path>:<container path>. The left side is a path in the pipeline filesystem, where / is its root. The right side is the directory in the container where it is mounted. With /:/buddy, the repository files are available under /buddy, and setting working_directory to the same path runs the commands directly in the repository.

Warning
An action with volume_mappings needs filesystem access in the pipeline. When you add the action in YAML, set filesystem_access: true for it. Without it, saving the pipeline fails with Filesystem access is required. Setting filesystem_access: true does not mount anything by itself if the action definition has no volume_mappings.

Example: passing files to the next action

The action below writes a report to the pipeline filesystem:

yaml
name: "Write_Report"
docker_image_name: "ubuntu"
docker_image_tag: "latest"
volume_mappings:
  - /:/buddy
working_directory: "/buddy"
commands: |
  echo "Report generated on $(date)" > report.txt

In the pipeline, the custom action gets filesystem_access: true, and the next action reads the file from the same filesystem:

yaml
- pipeline: "Report"
  refs:
  - ":default"
  actions:
  - action: "Write report"
    type: "CUSTOM"
    custom_type: "Write_Report:latest"
    filesystem_access: true
  - action: "Read report"
    type: "BUILD"
    docker_image_name: "library/ubuntu"
    docker_image_tag: "latest"
    commands: |-
      cat report.txt

Cache

You can also cache additional directories with the cached_dirs parameter. This feature is useful if your action downloads files on every run - caching them will speed up the execution time.

yaml
volume_mappings:
 - /:/buddy
working_directory: "/buddy/example-folder"
cached_dirs:
 - "/cache-local"
 - "/cache-application"
Info
By default:
1. No filesystem is mounted.
2. No extra directories (cached_dirs) are cached.
3. The working directory remains as defined in the Docker image.

Docker image

Custom actions are run in an isolated container launched from an image defined by the user. The Docker image must be stored on the Docker Hub and be publicly available. If your action does not require a specific language and/or framework, we recommend using the official Ubuntu image in the latest version:

yaml
docker_image_name: "ubuntu" 
docker_image_tag: "latest"
Warning
The image must not have an entrypoint defined, or it will not work. You can clear the entrypoint by adding reset_entrypoint: true to the configuration.

Outputs

When the action is run, the values of the inputs are passed to the container as non-settable environment variables. These variables can be generated in the action with the output parameter:

yaml
inputs:
  first_input:
output:
  variables:
    first_input:
      example: "The description of the variable."
      info: "The contents of the tooltip"
      masked: true

A variable can be described with three parameters:

  • masked: hides the value of the variable in the logs
  • example: adds an example/description
  • info: displays a tooltip on mouse hover

The variables can also be exported and used by other actions in the pipeline for the duration of the pipeline run using the export INPUT_NAME command:

yaml
commands: |
  export first_input
  export second_input

Example

Here we have an action with two inputs reproduced into variables. The third variable is created by the action's commands:

yaml
name: "Output_Example"
inputs:
  first_input:
    default: "Example text"
  second_input:
    required: true
commands: |
  export first_input
  export second_input
  export maskedVar="hidden_value"
docker_image_name: "ubuntu"
docker_image_tag: "latest"
output:
  variables:
    first_input:
      example: "This variable has a default value."
      info: "Tooltip #1"
    second_input:
      example: "This variable is required."
    maskedVar:
      example: "This variable is created by the action and masked."
      info: "Tooltip #3"
      masked: true

Image loading...Custom action with generated variables

The output of the action closely follows the descriptions from the screenshot:

Image loading...Action output

Using output variables in the next action

A variable exported in commands and listed under output.variables is available to every following action in the same run. This action sets BUILD_VERSION:

yaml
name: "Set_Version"
docker_image_name: "ubuntu"
docker_image_tag: "latest"
commands: |
  export BUILD_VERSION="1.4.2"
output:
  variables:
    BUILD_VERSION:
      info: "Version set by the action"

The next action in the pipeline reads it like any other variable:

yaml
actions:
- action: "Set version"
  type: "CUSTOM"
  custom_type: "Set_Version:latest"
- action: "Print version"
  type: "BUILD"
  docker_image_name: "library/ubuntu"
  docker_image_tag: "latest"
  commands: |-
    echo "Version: $BUILD_VERSION"

Last modified on Nov 6, 2026