Workflow Environment Variables
· 2 min read
Workflows now support environment variables at both workflow and step levels with hierarchical merging.
What Changed
You can now define environment variables in workflow YAML files at two levels:
- Workflow-level: Applied to all steps in the workflow
- Step-level: Applied to a specific step, overriding workflow-level variables with the same key
Environment variables are merged hierarchically, with step-level values taking precedence over workflow-level values for the same keys.
Example
workflows:
deploy:
description: Deploy with custom environment
env:
FOO: bar
BAZ: workflow-value
steps:
- command: echo "$FOO - $BAZ"
type: shell
env:
BAZ: step-value
Running this workflow outputs bar - step-value because:
FOOis inherited from the workflow level (bar)BAZis overridden by the step level (step-value)
Why This Matters
This feature enables several use cases:
- Consistent environment setup: Define common variables once at the workflow level
- Step-specific overrides: Override variables for specific steps without duplicating configuration
- Integration with external tools: Pass environment variables to shell commands and Terraform
Environment Variable Precedence
The full precedence order (lowest to highest priority):
- System environment variables
- Global env from
atmos.yaml - Workflow-level
env - Step-level
env - Auth identity env vars (if
identityis specified)
Get Involved
Have questions or feedback? Join us on Slack or open an issue on GitHub.
