Custom Variables

Configure environment variables at execution, project, and organization levels. Includes secret management and variable groups.

Environment variables are key-value pairs that your executions can read and write. Valohai gives you flexible options for defining them at different scopes.

You can set environment variables in four ways:

  • Inline commands — Quick export MY_VAR=value in your step commands

  • Step definitions — Explicit variables in valohai.yaml

  • Project level — Shared across all project executions

  • Organization level — Grouped variables across multiple projects

Execution Environment Variables

Inline Commands

Set variables directly in your step commands:

- step:
    name: train-model
    image: python:3.11
    command:
    - export MODE="1"
    - export POST="clip"
    - python train.py

This approach works but won't be tracked in Valohai's interface.

Step Definitions

Define expected variables explicitly in your valohai.yaml:

- step:
    name: train-model
    image: python:3.11
    command: python train.py
    environment-variables:
      - name: MODE
        default: "1"
      - name: POST
        default: "clip"

Variable properties:

  • name — Variable name passed to the execution

  • description — (optional) Human-readable explanation

  • default — (optional) Default value if not specified

  • optional — (optional) Set to false to make required

💡 Step-defined variables appear in the UI when creating executions and can be modified via CLI or API.

Project Environment Variables

Project variables work well for API keys, database connections, or shared configuration across executions.

To create project variables:

  1. Navigate to Project Settings

  2. Open "Environment Variables" tab

  3. Enter variable name and value

  4. Check "Secret" to hide the value in the UI

  5. Click "Add" then "Save"

To use project variables:

Check Inherit project's environment variables and secrets when creating executions.

💡 Secret variables are hidden in the UI but can still be printed in execution logs by users with project access.

Organization Environment Variables

Organization admins can create variable groups shared across multiple projects. This centralizes management and simplifies tasks like key rotation.

Creating Variable Groups

  1. Click your username in the top-right corner

  2. Select "Manage <organization>"

  3. Open "Environment Variables" tab

  4. Click "Create new environment variable group"

  5. Name your group and select target projects

  6. Add variables with names and values

  7. Mark sensitive values as "Secret"

  8. Click "Save"

Example Setup

The screenshot below shows two environment variable groups:

  • Production — Used by "fun-tensorflow" and "productionproject" projects

  • Staging — Used exclusively by "staging" project

Both groups contain public and secret variables for their respective environments.

Using Variable Groups

Organization variable groups appear under each project's "Env Variables" tab. Non-admin users can view group names and public values but cannot modify them.

Last updated

Was this helpful?