Skip to main content
Structure your YAML configs and CI workflows to handle multiple environments with shared base definitions and per-environment overrides.

File structure

Separate files per environment

The simplest approach — one file per environment:
Each file is self-contained. Deploy the right file based on the branch or CI environment.

Base + environment files

Share common definitions in a base file and add environment-specific resources in separate files:
Deploy with multiple -f flags:
Sections from all files are concatenated. Resource names must be disjoint across files — defining the same monitor name in two files is a validation error, not an override. There is no per-resource override merging; to vary a monitor between environments, use environment variables (below) or separate self-contained files. The one exception is defaults.monitors, which shallow-merges across files (later files win per field).

Using environment variables

Share a single file and vary behavior with environment variables:
Set different values in each CI environment:
${VAR} interpolation only works in string fields (URLs, tokens, names). Numeric fields like frequencySeconds cannot be interpolated — the value would arrive as a string and fail schema validation. To vary frequencies per environment, use separate files per environment.

GitHub Actions

Using environments

Sequential with approval

Configure the production environment in GitHub Settings to require manual approval.

GitLab CI

Terraform

Use Terraform workspaces or separate state files:
Or use separate directories:

Best practices

  • Separate API tokens per environment for isolation
  • Deploy staging first, then promote to production
  • Use GitHub Environments or equivalent for approval gates on production
  • Pin CLI versions for reproducible builds across environments
  • Keep environment differences minimal — vary URLs and frequencies, not monitor structure

Next steps

GitHub Actions

Full setup-devhelm action reference.

Environments CLI

Manage environments from the command line.