Skip to content

fix(core/dotenv): accept export-prefixed lines in .env files - #13293

Merged
marcosnils merged 1 commit into
dagger:mainfrom
marcosnils:push-ykyuqywxvrsy
Jun 2, 2026
Merged

marcosnils merged 1 commit into
dagger:mainfrom
marcosnils:push-ykyuqywxvrsy

Conversation

@marcosnils

Copy link
Copy Markdown
Contributor

Auto-loaded .env files (working dir + ancestors) aborted every Dagger command when a line used the common export KEY=value convention, with parse error: "export FOO=bar": not a bare assignment. The shell parser treats export FOO=bar as a command call, so it had no bare assignment.

Strip an optional leading export keyword in all dotenv parsing paths (parseEntry, AllRaw, Exists) and in EnvFile.WithContents so the internal representation stores the clean key. export is a widely supported dotenv idiom (direnv, set -a; . ./.env, shell source, most loaders).

Fixes #13291

Auto-loaded .env files (working dir + ancestors) aborted every Dagger
command when a line used the common `export KEY=value` convention, with
`parse error: "export FOO=bar": not a bare assignment`. The shell parser
treats `export FOO=bar` as a command call, so it had no bare assignment.

Strip an optional leading `export` keyword in all dotenv parsing paths
(parseEntry, AllRaw, Exists) and in EnvFile.WithContents so the internal
representation stores the clean key. `export` is a widely supported dotenv
idiom (direnv, `set -a; . ./.env`, shell `source`, most loaders).

Fixes dagger#13291

Signed-off-by: Marcos Nils <[email protected]>
@marcosnils marcosnils added this to the v0.21.4 milestone Jun 1, 2026
@marcosnils
marcosnils requested a review from shykes June 1, 2026 13:13
@marcosnils marcosnils removed this from the v0.21.4 milestone Jun 2, 2026
@marcosnils
marcosnils merged commit 2452472 into dagger:main Jun 2, 2026
77 checks passed
tiborvass added a commit that referenced this pull request Jun 5, 2026
…ash in fd0021b

This merge commit restores the history link between 1.0-beta branch and main.
It was lost with merge commit fd0021b which
squashed the branch e45e7e4

Git tree on #13327 before squash-merging into 1.0-beta:

```
* e45e7e4 Run dagger generate
*   a01677a Merge main into 1.0-beta
|\
| * 1588421 chore: update daggerverse from 0.21.0 to 0.21.4 (#13328)
| * 20b2554 Simplify function call return handling (#13319)
| * 316ca15 Fix snapshot owner lease attach/remove race (#13321)
| * 6cfdcb4 fix(layercopy): follow source symlinks when copying directory contents (#13326)
| * 16e85ca Container exists expand option (#13310)
| * 54f9811 chore: post-release during v0.21.4 (#13316)
| * de85595 ci: bump default engine version to v0.21.3 (#13315)
| * 81bb907 chore: prep for v0.21.4 (#13314)
| * 0fd148e Show root usage when dagger has no args
| * 219b696 Volatile vars (#13223)
| * fae340c fix(layercopy): materialize resolved parent dirs when writing through… (#13308)
| * b720144 bump dang (#13306)
| * 41a7910 fix(engine): lease parent layer content for tarball export (#13307)
| * b2d43ba fix(core): attach never-cached module function results (#13298)
| * 6a7b3a7 fix incorrect artifact caching issue when releasing  (#13285)
| * 2452472 fix(core/dotenv): accept `export`-prefixed lines in .env files (#13293)
| * 24b06e7 fix: allow empty setSecret name (#13304)
| * f7ea195 fix: handle 1Password secrets with spaces (#13297)
* | 74e1a66 another pass on docs (#13325)
...
|/
* 8cc840f fix(sdk/typescript): resolve referenced values in decorator arguments (#13292)
```

Ran `git merge -s ours 1588421` on 1.0-beta to get this desired git tree:

```
*   ??gitsha?? [1.0-beta] restore merge history with main@15884210ff lost due to squash in fd0021b
|\
| * 1588421 chore: update daggerverse from 0.21.0 to 0.21.4 (#13328)
| ...
* | 94ebacb (origin/1.0-beta) update sdk docs, type-system docs, and interfaces (#13338)
* | 64eba3f (tag: v1.0.0-beta.3) [1.0-beta] feat: support synthetic workspaces (#13217)
* | fd0021b Merge main into 1.0-beta (#13327)
* | c6dd435 fix(cli): refine cloud check replay
```
tiborvass added a commit that referenced this pull request Jun 6, 2026
…ash in fd0021b

This merge commit restores the history link between 1.0-beta branch and main.
It was lost with merge commit fd0021b which
squashed the branch e45e7e4

Git tree on #13327 before squash-merging into 1.0-beta:

```
* e45e7e4 Run dagger generate
*   a01677a Merge main into 1.0-beta
|\
| * 1588421 chore: update daggerverse from 0.21.0 to 0.21.4 (#13328)
| * 20b2554 Simplify function call return handling (#13319)
| * 316ca15 Fix snapshot owner lease attach/remove race (#13321)
| * 6cfdcb4 fix(layercopy): follow source symlinks when copying directory contents (#13326)
| * 16e85ca Container exists expand option (#13310)
| * 54f9811 chore: post-release during v0.21.4 (#13316)
| * de85595 ci: bump default engine version to v0.21.3 (#13315)
| * 81bb907 chore: prep for v0.21.4 (#13314)
| * 0fd148e Show root usage when dagger has no args
| * 219b696 Volatile vars (#13223)
| * fae340c fix(layercopy): materialize resolved parent dirs when writing through… (#13308)
| * b720144 bump dang (#13306)
| * 41a7910 fix(engine): lease parent layer content for tarball export (#13307)
| * b2d43ba fix(core): attach never-cached module function results (#13298)
| * 6a7b3a7 fix incorrect artifact caching issue when releasing  (#13285)
| * 2452472 fix(core/dotenv): accept `export`-prefixed lines in .env files (#13293)
| * 24b06e7 fix: allow empty setSecret name (#13304)
| * f7ea195 fix: handle 1Password secrets with spaces (#13297)
* | 74e1a66 another pass on docs (#13325)
...
|/
* 8cc840f fix(sdk/typescript): resolve referenced values in decorator arguments (#13292)
```

Ran `git merge -s ours 1588421` on 1.0-beta to get this desired git tree:

```
*   ??gitsha?? [1.0-beta] restore merge history with main@15884210ff lost due to squash in fd0021b
|\
| * 1588421 chore: update daggerverse from 0.21.0 to 0.21.4 (#13328)
| ...
* | 94ebacb update sdk docs, type-system docs, and interfaces (#13338)
* | 64eba3f [1.0-beta] feat: support synthetic workspaces (#13217)
* | fd0021b Merge main into 1.0-beta (#13327)
* | c6dd435 fix(cli): refine cloud check replay
* | 74e1a66 another pass on docs (#13325)
```
@marcosnils
marcosnils deleted the push-ykyuqywxvrsy branch July 18, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.env loading aborts all commands when a .env in the working dir (or any ancestor) uses export-prefixed lines

2 participants