Knowledge

Introduction to YAML

Buddy allows you to configure pipelines in two ways:

  1. GUI - configuration is performed via website or API
  2. YAML - configuration is performed via buddy.yml located in the repository

By default, the mode is set to GUI. This part of documentation will explain how to activate and use YAML configuration with Buddy.

How to switch the config mode to YAML

The mode can be switched in one of two ways:

  • If there aren't any pipelines in the project, just push buddy.yml to the repository
  • If the pipelines already exist, go to Pipelines, flip the switch to YAML, and push buddy.yml to the repo.

WARNING: Please mind that once you switch to YAML all pipelines in the project will be removed. They will be reproduced back again as soon as the config file has been pushed to the repo.

Reproducing pipelines with <code>buddy.yml</code>
Reproducing pipelines with buddy.yml

How to switch the config mode to GUI

If you have a project where you used YAML before but want to configure the pipelines with the GUI again, just flip the switch back to GUI:

Switching config mode to GUI
Switching config mode to GUI

Buddy.yml and branches

Pipelines are defined in the buddy.yml file. Pushing the file to the branch X will reconfigure:

  • all pipelines whose ref_name is set to branch X
  • all pipelines whose ref_name is set to a wildcard matching branch X
  • all pipelines whose ref_name is set to None in the GUI, provided that branch X is the default branch

YAML helper

To make the configuration easier you can use the YAML Helper to:

  • export the configuration of the pipelines defined in the project
  • define a pipeline in the GUI so you can see how it should look in YAML
  • define an action in the GUI so you can see hot it should look in YAML
YAML helper
YAML helper

Pipelines in the .yml file are defined in the form of a list. Here's an example config file with definitions of two pipelines:

- pipeline: "production"
  trigger_mode: "MANUAL"
  ref_name: "master"
  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"
  - action: "Upload files to winserver.sls"
    type: "FTP"
    input_type: "BUILD_ARTIFACTS"
    local_path: "/"
    login: "pass"
    password: "testtest"
    host: "winserver.sls"
    port: "21"
- pipeline: "build server"
  trigger_mode: "ON_EVERY_PUSH"
  ref_name: "*"
  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"

The schema for pipelines and actions is described in details in the next article.


Solving problems

If the pipeline definition in buddy.yml is incorrect, the pipeline will not be added. In order to debug what went wrong, follow these steps:

  1. Go to the project's Activity stream
  2. Find the push containing the commit with the new version of buddy.yml

Clicking the commit will launch the logs covering the process of the file:

YAML processing logs
YAML processing logs

Get started now

14 days of unlimited trial. No credit card required.