Variables in YAML
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).
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:
- pipeline: "my pipeline" 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: "var_action" value: "value" type: "VAR" - key: "var_action_the_2nd" value: "value1" type: "VAR" variables: - key: "var_pip" value: "val" type: "VAR"
If you decide to configure pipelines with YAML, you can still define all corresponding variables in the GUI, i.e. describe the pipelines and actions in YAML, and add the variables directly in Buddy.
Please mind that if you define the variables in YAML for a specific pipeline/action, all variables in the pipeline/action that were previously defined in the GUI will be overwritten and removed.