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).

Defining variables

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"

Please mind that if you define a pipeline or action variable in YAML, all variables with that scope previously defined in the GUI will be overwritten and removed. Once you switch to YAML, it is no longer possible to add pipeline and action variables via the GUI.

Get Started

Sign up for free and deploy your project in less than 10 minutes.