YAML variables

Environment variables in Buddy can be defined with one of four scopes: workspace, project, pipeline, and action. The scope defines where the variable can be applied.

For example, a variable with the project scope can be applied across all pipelines and actions in its parent project, whereas an ENV VAR restricted to a pipeline can be applied to all actions in that particular pipeline (and nowhere else).

Warning
In YAML, you can only define variables with pipeline or action scope. Workspace and project variables need to be defined via the GUI.

The variables are described as a table with keys & values:

yaml
​​- pipeline: "Test application" on: "CLICK" refs: - "refs/heads/development" priority: "NORMAL" fail_on_prepare_env_warning: true actions: - action: "Execute: npm test" type: "BUILD" working_directory: "/buddy/git-repo" docker_image_name: "library/node" docker_image_tag: "12" execute_commands: - "npm install" - "npm test" volume_mappings: - "/:/buddy/git-repo" cache_base_image: true shell: "BASH" variables: - key: "action_first_variable" value: "value1" type: "VAR" - key: "action_second_variable" value: "value2" type: "VAR" variables: - key: "pipeline_variable" value: "value" type: "VAR"

Defining variables

Encryption

Sensitive data such as tokens and server credentials should be encrypted before being added to the YAML definition.

To encrypt a specific value, go to the project settings and use the encrypt option from the YAML tools dropdown menu:

Image loading...

Enter the value that you want to hide and click the button to encrypt it. The encrypted value now can be pasted to your YAML file.

Image loading...

Salt

The data is encrypted using the salt that can be defined in the workspace settings:

Image loading...

Warning
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 self-hosted version.

Last modified on Sep 23, 2024