YAML Schema

The buddy.yml file defines all pipelines in the project. Every pipeline consists of a list of actions to be executed. Below you’ll find schemas for both pipelines and actions.

Pipelines schema

The file consists of a list of pipelines:

- pipeline: "production"
on: "CLICK"
refs:
- "refs/heads/master"
variables:
- key: "username"
value: "Buddy"
settable: false
description: "var_descrption"
- pipeline: "build"
on: "EVENT"
events:
- type: "PUSH"
refs:
- "*"

Properties

NameTypeDescription
pipeline
Required
StringThe ID of the pipeline.
on
Required
StringThe trigger mode of the pipeline. Can be one of CLICK, EVENT, SCHEDULE.
refsString[]Set it if on is set to CLICK or SCHEDULE. The list of refs for which the pipeline will be triggered. Automatically set to NONE if not provided.
eventsEvent[]The list of events for which the pipeline will be triggered. Set it if on is set to EVENT.
trigger_conditionsTriggerCondition[]The list of trigger conditions to meet so that the pipeline can be triggered.
always_from_scratchBooleanDefines whether or not to upload everything from scratch on every execution.
auto_clear_cacheBooleanDefines whether or not to automatically clear cache before running the pipeline .
no_skip_to_most_recentBooleanDefines whether or not to skip execution to the most recent execution.
do_not_create_commit_statusBooleanDefines whether or not to omit sending commit statuses to Github or Gitlab upon execution.
start_dateiso 8601 utc dateRequired if the pipeline is set to on: SCHEDULE and no cron is specified. Defines when the pipeline execution should start. Format: 2016-11-18T12:38:16.000Z
delayIntegerRequired if the pipeline is set to on: SCHEDULE and no cron is specified. Defines the intervals in which the pipeline should be executed (in minutes).
cronStringRequired if the pipeline is set to on: SCHEDULE and neither start_date nor delay is specified. The standard CRON expression defining the execution schedule.
actionsAction[]The list of actions executed in the pipeline.
variablesVariable[]The list of variables you can use in the pipeline.
ignore_fail_on_project_statusBooleanIf set to true the status of a given pipeline will not impact the project status on the dashboard.
execution_message_templateStringThe title of every execution in this pipeline. By default it is set to $BUDDY_EXECUTION_REVISION_SUBJECT.
workerStringThe name of the worker on which the pipeline will be launched. Only for Buddy On-premises.
target_site_urlStringThe URL of the target website.

Actions schema

Every pipeline contains a list of actions. The actions are executed in the order provided in the .yml file:

- pipeline: "production"
on: "CLICK"
refs:
- "refs/heads/master"
execution_message_template: "test"
ignore_fail_on_project_status: "true"
actions:
- action: "Execute: npm test"
type: "BUILD"
docker_image_name: "library/node"
docker_image_tag: "6"
execute_commands:
- "npm install"
- "npm test"
setup_commands:
- "npm install -g gulp grunt-cli"
variables:
- key: "username"
value: "Buddy"
settable: true
description: "var_description"
retry_delay: 1
retry_count: 3
- action: "Upload files to buddy.server"
type: "FTP"
input_type: "BUILD_ARTIFACTS"
local_path: "/"
login: "buddy"
password: "password"
host: "buddy.server"
port: "21"
retry_delay: 1
retry_count: 3

Properties

NameTypeDescription
action
Required
StringThe ID of the action.
type
Required
StringThe type of the action.
variablesVariable[]The list of variables you can use the action.
trigger_conditionsTriggerCondition[]The list of trigger conditions to meet so that the action can be triggered.
timeoutIntegerThe timeout in seconds.
disabledBooleanWhen set to true the action is disabled. By default it is set to false.
run_next_parallelBooleanWhen set to true, the subsequent action defined in the pipeline will run in parallel to the current action.
run_only_on_first_failureBooleanDefines whether the action should be executed on each failure. Restricted to and required if the trigger_time is ON_FAILURE.
ignore_errorsBooleanIf set to true the execution will proceed, mark action as a warning and jump to the next action. Doesn't apply to deployment actions.
retry_delayIntegerDelay time between auto retries in minutes.
retry_countIntegerNumber of retries if the action fails.

On top of these properties every action has a set properties unique to its type. You can read how to define each type of action in separate articles.

Variables schema

You can define variables in the following way:

variables:
- key: "my_file"
type: "FILE"
value: "dGVzdA0K"
file_name: "file"
file_path: "/buddy-variables/file"
file_chmod: "644"
file_place: "CONTAINER"
- key: "id_my_key"
value: "secure!xgXxzMBVkpGEp4sRMxUIEL4TFQSZQv6PklzVGeRYPLOKYR/nNXTTKzYABWNGSgFZenjhGy5sMu8SBEDZAsZI9I188jdF3x5cHkxzq0kwvlR/wX9Cglf+PAkn1TsaNxJf4e2i7hufE5PGJoideIqMH30obPH9xDUXKLZl6lhm63HfgyPzyK9DsC7BAgYXHDsqRbh+Ny/pt7WN5RzrXXZ/4u6zaaKR/dGvPmFMVephLCjDOzjbRs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l3DIVeJ6ad51Qs9xGaYJyBE98jvP37It233bTmkWuoOKqO6Irfi7yarMbtTJx/vAYE/MU+R5WsPFvx8gLB7tjjoETKjnFFV0KpH9nrwApHTXb5EimySyVo6BFl9bM2It4o8FwIPMFtECdG2b/Xko9T6KWDISmKDnGYFsWb8Lt8tO4Qm1xQ+Y2AnZFBxH5di+Hu6CwhvTncC8vEetgss+m2X7o0QB7EhJ6SjH9ksbrqg02++TZbzKcwVker1tMp4IcI7R+iBtjvv3YN43VtjIeIXGQtSxehF5bpiN+vSPYvxccfdJUtbtTawBiSlapob1xqx94NaL/8aNbzOt794xORhxtKMIk5VqW8lh378p4vm1WiziWZAIOU+hMB0WWLLVGtivMMk5fW9JJ0FWoVXlUUgmm8coJcjQgPRh5y8lm4u8/PNEMkMiY0Qvl+id0GA07MMjCpu80n0TuNMvD2qJtcKheenbKb/6bpHj+c5HFk7C5A4VBpmEiCdAJvOHXheqi9aq2lHYxM4VyXCQiv5bnZ4mGpiD0jZLQF0YhLgffNdrG3tObcdHJj8iMQbZrRgSInb6pfg1FQVeoLqd0qe5Uzi6L9imVz14eSk9M9+x6F4AbPfX9KxjHsuk5Kao3iz3Ua5pcjJ/2L8Wpmwo8+nl/aXO1is6k9wzdZo4LUDKMUDNCXQrfIFej4zMa9C5gluI46S2QqTxlPHL7YdWK2flt0uLDW3rDlOG2LiJP+MMXwGZdAkqWDz37UoeY3KWSSGfuJXH3K5lGJqbKV9bkldDBOXJ1rfpZ+0qpDc1hB6FzIvitnylXNerXcmQd9GZvVo4dYdmfPDrm9Y+/7sx9tO5IJejnI2ID3DBiVWPKWaL/minxrvL+MQsAwtjBErIEpX/+x5wVnC5LqsNJCguQpejsHlpAp2mC3L.qiYL/5JiylAVf8oeD57u9w=="
type: "SSH_KEY"
encrypted: true
file_name: "id_my_key"
file_path: "~/.ssh/id_my_key"
file_chmod: "600"
file_place: "CONTAINER"
- key: "my_variable"
value: "my_value"
type: "VAR"

Properties

NameTypeDescription
key
Required
StringThe name of the variable.
value
Required
StringThe value of the variable. If the type is FILE, the value must be Base64 encoded.
typeStringThe type of the added variable. Can be one of VAR, SSH_KEY or FILE.
descriptionStringThe optional description of the variable.
encryptedBooleanWhen set to true the variable value will be encrypted and hidden.
settableBooleanWhen set to true the variable value can be shifted between subsequent actions or executions as well as pipelines.
file_placeStringAvailable values: CONTAINER, NONE. Set if type is SSH_KEY or FILE. If it's NONE, the variable can be used as a parameter in an action. For CONTAINER, the given file/key is additionally copied to an action container on each run.
file_nameStringThe name of the file. Set if type is SSH_KEY or FILE.
file_pathStringSpecifies where to copy the file on each run. Set if type is SSH_KEY or FILE.
file_chmodStringFile permission set on copy to a container on each run. Set if type is SSH_KEY or FILE.

Using encrypted variables in YAML with Buddy Encryption Tool

To define a variable with the encrypted value:

  1. Go to the Pipelines tab and click YAML helper in the right menu. Select Generate an encrypted value: Generating a new encrypted value

  2. Provide the input value and click Encrypt. It will produce a hash that you can copy and safely use in your YAML: Setting a new encrypted value

The salt which is used to encrypt the values is unique for each workspace. If you change it, you will need to change all encrypted values in your YAMLs.

The value should be changed only when you move your pipelines with the export/import option – either to another workspace, or from Cloud to the on-premises version.

Event schema

Here's how to define the event triggering the pipeline:

events:
- type: "PUSH"
refs:
- "refs/heads/master"
- "refs/heads/dev-*

Properties

NameTypeDescription
type
Required
StringThe type of the event. Available value: PUSH.
refs
Required
String[]The list of refs for which the pipeline will be triggered in the given event.

Trigger condition schema

You can define trigger conditions in the following way:

trigger_conditions:
- trigger_condition: "VAR_IS"
trigger_variable_value: "expectedValue"
trigger_variable_key: "myVar"
- trigger_condition: "ON_CHANGE"

Properties

NameTypeDescription
trigger_conditionStringDefines when the build action should be run. Can be one of ALWAYS, ON_CHANGE, ON_CHANGE_AT_PATH, VAR_IS, VAR_IS_NOT, VAR_CONTAINS, VAR_NOT_CONTAINS, DATETIME or SUCCESS_PIPELINE. Can't be used in deployment actions.
trigger_condition_pathsString[]Required when trigger_condition is set to ON_CHANGE_AT_PATH.
trigger_variable_keyStringRequired when trigger_condition is set to VAR_IS, VAR_IS_NOT or VAR_CONTAINS or VAR_NOT_CONTAINS. Defines the name of the desired variable.
trigger_variable_valueStringRequired when trigger_condition is set to VAR_IS, VAR_IS_NOT or VAR_CONTAINS or VAR_NOT_CONTAINS. Defines the value of the desired variable which will be compared with its current value.
trigger_hoursInteger[]Available when trigger_condition is set to DATETIME. Defines the time – by default running from 1 to 24.
trigger_daysInteger[]Available when trigger_condition is set to DATETIME. Defines the days running from 1 to 7 where 1 is for Monday.
zone_idStringAvailable when trigger_condition is set to DATETIME. Defines the timezone (by default it is UTC) and takes values from here.
trigger_project_nameStringRequired when trigger_condition is set to SUCCESS_PIPELINE. Defines the name of the project in which the trigger_pipeline_name is.
trigger_pipeline_nameStringRequired when trigger_condition is set to SUCCESS_PIPELINE. Defines the name of the pipeline.

Multiline YAML

To apply multiline in YAML, use the | (pipe) character:

pipeline: |
first line
second line

Please mind that some fields are collections and should retain the collection structure. This applies to SSH and build actions:

- action: "Execute: ls"
type: "BUILD"
execute_commands:
- npm install
- npm test
- npm build

If you want to apply multine in such actions, you need to define it as an element of the execute_commands collection:

- action: "Execute: ls"
type: "BUILD"
execute_commands:
- |
npm install &&
npm test
- npm build