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
- configuration is performed via
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.
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 YAML 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
refs
orevents.refs
containrefs/heads/X
- all pipelines whose
refs
orevents.refs
are set to a wildcard matching branchX
- all pipelines in which
refs
orevents
aren't set, provided that branchX
is the default branch
Pushing the file with tag X
will reconfigure:
- all pipelines whose
refs
orevents.refs
containrefs/tags/X
- all pipelines whose
refs
orevents.refs
are 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
Generating a new action
Once you configure the action details, click Generate YAML:
Generating YAML
After that, a pop-up with the generated YAML will appear:
Action configured in YAML
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"
on: "CLICK"
refs:
- "refs/heads/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"
on: "EVENT"
events:
- type: "PUSH"
refs:
- "refs/heads/dev"
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"
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:
Setting encryption salt
Then use the YAML helper to generate encrypted values for your buddy.yml
:
Generating an encrypted value
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:
YAML processing logs
Last modified on April 26, 2022