-
-
Notifications
You must be signed in to change notification settings - Fork 617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotenv not working at task level #997
Comments
I am not able to reproduce this. Also running Arch on master and your example works fine for me:
# .env
VAR=test # Taskfile.yml
version: "3"
silent: true
tasks:
test:
dotenv: [".env"]
cmds:
- echo $VAR Outputs:
Are you sure your copy of |
Interesting. I have go-task-bin-3.20.0-1, tried reinstalling, didn't help. At the same time, in a container with ubuntu - it works |
Me and a colleague stumbled upon this issue today. Using the provided example we have been able to reproduce this issue on task |
@endorama That's interesting.. I don't believe there were any changes in Otherwise, I might close this until someone is able to repro again since it isn't currently effecting anyone in the latest release. |
Closing this for now. If anyone is able to repro this, please feel free to leave a comment and we can reopen. |
I have this exact issue on arm64, taskfile version 3.30.1. local taskfile:
Output: "foo". But comment out the top-level dotenv clause and "foo" does not print. |
@pd93, I can reproduce this, too. I've tested it with latest build (v3.32.0) on Windows and Ubuntu. Only top-level dotenv is evaluated, on task-level it is ignored. Looking at the strace output, the |
@c-s-w. I'm still unable to reproduce this (v3.32.0) on Linux. I used @MattiasMartens's example to test along with the following MYVAR=foo Running
If you can provide a sample |
@pd93 I'm testing it with these files: https://gist.github.com/c-s-w/7ae4e3c9b87e3e3735b05fd2a6aea542 |
@andreynering What's the expected behaviour here? The docs do not mention that you should be able to use variables defined in a However, if I move the |
@pd93 Having the variables available via the templating engine allows the usage of |
@pd93 I'd say that this is a bug. It should be available for templating, yes. |
Here is a slightly more verbose repro of what I am now understanding is four different cases.
Output on my machine (arm64, 3.32.0):
Output with file-wide .env un-commented:
|
Same issue on mac on version Task version: v3.35.1
getting the following
|
Created a pull-request that fixes this issue: #1627 |
I am running into this problem too. I'm not sure what a clean way is to have config be different for different environments. I like @tuwid 's approach, and it is what I wanted to do too, but doesn't seem to work still. |
I am also encountering this problem. Until this is resolved, I am running my tasks on Windows using the following command: $env:ENV='dev' ; task set-context |
Can this #1627 get merged? Running into the same issue |
dotenv file .env:
VAR=test
Taskfile.yml:
Result:
nothing
With global dotenv works good
Task version: master
Operating System: Arch Linux
The text was updated successfully, but these errors were encountered: