-
-
Notifications
You must be signed in to change notification settings - Fork 231
Open
Description
Dagu Multiple Dotenv Files Bug
Issue Summary
Affected Versions: < 1.30.2
Fixed In: v1.30.2
Severity: Critical - breaks environment variable layering
Problem
In dagu versions prior to 1.30.2, when specifying multiple dotenv files in a workflow, only the first file is loaded. Subsequent files are silently ignored.
# BROKEN in < 1.30.2
dotenv:
- /opt/project/bundles/k3s/envs/k3s.env # Loaded
- /opt/project/bundles/k3s/args.env # IGNORED!This breaks configuration layering pattern where bundle defaults are loaded first and Terraform-provided args override them.
Expected Behavior (v1.30.2+)
Per dagu documentation:
"All files are loaded sequentially in order. Variables from later files override variables from earlier files."
Symptoms
- Environment variables from args.env not available in workflow steps
- Role detection fails (agents detect as servers)
- Bundle defaults cannot be overridden by Terraform args
- Dagu only logs "Loaded .env file" for the first file
Diagnosis
Run a test workflow to verify which variables are passed to steps:
name: test-dotenv
dotenv:
- /opt/project/bundles/k3s/envs/k3s.env
- /opt/project/bundles/k3s/args.env
steps:
- name: check
command: bash -c "env | grep DAG_K3S > /tmp/vars.txt"sudo dagu start /tmp/test-dotenv.yaml && cat /tmp/vars.txtIf only k3s.env variables appear (and not args.env variables like DAG_K3S_ROLE), you're affected.
Solution
Upgrade dagu to v1.30.2 or later:
# Check current version
dagu version
# Download and install v1.30.2+
curl -fsSL "https://github.com/dagu-org/dagu/releases/download/v1.30.2/dagu_1.30.2_linux_amd64.tar.gz" | tar -xzf - -C /tmp
sudo mv /tmp/dagu /usr/local/bin/Workarounds (if upgrade not possible)
- Single merged env file: Combine all env files into one before workflow execution
- Source in command:
command: bash -c "source /path/to/args.env && your-command" - Reverse order: Put the most important file first (but loses override capability)
References
- Dagu v1.30.2 Release Notes - "Fixed loading of multiple
.envfiles" - Dagu YAML Reference - dotenv documentation
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels