Environment Variables

Spark uses environment variables for cloud authentication and for parametrizing test files.

CLI variables

These control Spark's behavior at runtime:

VariableDescription
SPARK_TOKENAPI token for cloud mode (use in CI)
SPARK_CLOUD_URLCloud API server URL (required for --cloud mode)
SPARK_WEBLINKBase URL for artifact links in CLI output

YAML expansion

Any $SPARK_* variable in test files and config files is expanded before parsing. This lets you parametrize tests without hardcoding values.

services:
  - name: app
    image: $SPARK_APP_IMAGE
    environment:
      DATABASE_URL: $SPARK_DATABASE_URL
SPARK_APP_IMAGE=myapp:latest SPARK_DATABASE_URL=postgres://... spark run ./tests
Only SPARK_ prefixed variables are expanded. This is a safety measure — other environment variables (like PATH, HOME, or anything containing credentials) are left untouched and never injected into your test definitions.