Globals

Overview

Some of the settings that can be specified for steps can also be specified in the globals section - this means that they will be applied to all steps in the pipeline. Thanks to this, you don’t have to redeclare settings (like environment variables) in each step, but set it globally for the whole pipeline instead.

Note

Objects from the global section will be passed to steps in the pipeline only when it makes sense. See the globals reference for more details.

Examples

Environment variables

Below is an example of setting up a global environment variables and overriding them on step level.

globals:
  environment:
  - name: GLOBAL_ENV
    value: global-value

steps:
- name: step1
  dockerRun:
    image: busybox
    script: "printenv GLOBAL_ENV"

- name: step2
  dockerRun:
    image: busybox
    script: "printenv GLOBAL_ENV"
    environment:
    - name: GLOBAL_ENV
      value: local-value

Files

Here’s an example of setting up a global file and overriding it on step level.

globals:
  files:
  - path: /mnt/file
    fromSecret: global-secret

steps:
- name: step1
  dockerRun:
    image: busybox
    script: "cat /mnt/file"

- name: step2
  dockerRun:
    image: busybox
    script: "cat /mnt/file"
    files:
    - path: /mnt/file
      fromSecret: local-secret