YAML / GUI introduction
Buddy allows you to configure pipelines in two ways:
- GUI - configuration is performed via website or API
- 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.
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.
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:
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 branchX
- all pipelines whose
ref_name
is set to a wildcard matching branchX
- all pipelines whose
ref_name
is set toNone
in the GUI, provided that branchX
is the default branch
Pushing the file with tag X
will reconfigure:
- all pipelines whose
ref_name
is set to tagX
- all pipelines whose
ref_name
is set to a wildcard matching tagX
YAML helper
To make the configuration easier you can use the YAML Helper to:
- dump 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 how it should look in YAML
Once you configure the action details, click Generate YAML:
After that, a pop-up with the generated YAML will appear:
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.
Multiple YAML-file support
Users that have many pipelines in a single project can split the definitions into multiple files that Buddy will read and parse:
- The
buddy.yml
file in the root folder of the repository (this doesn't change) - All
*.yml
files in the .buddy directory
If a pipeline with the same ID is defined in several entries and/or files, the pipeline will be configured according to the last definition in line (files are processed alphabetically).
- YAML syntax does not change
- There is no limit on the number of pipelines per file
Encrypted variables
To encrypt the variables in yaml you need to set a salt in Workspace Preferences first:
Then use the YAML helper to generate encrypted values for your buddy.yml
:
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:
- Go to the project’s Activity stream
- 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: