Skip to content

dotenv files are loaded before task dependencies are ready #1381

@grishasergii

Description

@grishasergii

Consider the following example where make-env task produces a .env file and my-task task depends on make-env and loads .env. I would expect to see MY_VAR = MY_VALUE after running the task my-task command, but it is MY_VAR = instead. It seems like it loads the dotenv file first (but does not fail because the file does not exist yet?) and then executes all dependencies.

---
version: 3

tasks:
  make-env:
    cmds:
      - echo "MY_VAR=MY_VALUE" >> ./.env
  my-task:
    deps:
      - make-env
    dotenv:
      - ./.env
    cmds:
      - echo "MY_VAR = $MY_VAR"
  • Task version: v3.31.0 (h1:o6iyj9gPJXxvxPi/u/l8e025PmM2BqKgtLNPS2i7hV4=)
  • Operating system: macOS 13.6 (22G120)
  • Experiments enabled: no

Metadata

Metadata

Assignees

Labels

area: envChanges related to environment variables.state: awaiting responseWaiting for issue author to respond.
No fields configured for feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions