Skip to content

[BUG] Enable dotenv will make go template pipeline be invalid. #1232

@100gle

Description

@100gle
  • Task version: v3.25.0 (h1:XtIEtWpQSbIf2FGU+44/QB1whFf2sBUB/02W7ZQSz0U=)
  • Operating system: Windows 10
  • Experiments enabled: false

How to reproduce it?

When I don't include dotenv key in config file, all things work well:

version: '3'

vars:
  ROOT: 
    sh: echo {{toSlash .ROOT_DIR}}
  DOCKER: 
    sh: echo {{.ROOT}}/docker

tasks:
  foo:
    cmds: 
      - echo {{.DOCKER}}
# in my directory: D:/Reops/test
$ task foo
task: [foo] echo D:/Repos/test/docker
D:/Repos/test/docker

But when I add dotenv keys in config file with an empty .env file(created but no content):

version: '3'

dotenv: 
  - .env

vars:
  ROOT: 
    sh: echo {{toSlash .ROOT_DIR}}
  DOCKER: 
    sh: echo {{.ROOT}}/docker

tasks:
  foo:
    cmds: 
      - echo {{.DOCKER}}

then run task again and the console will show:

$ task foo
template: :1:15: executing "" at <.ROOT_DIR>: invalid value; expected string

Metadata

Metadata

Assignees

Labels

area: templatingChanges related to the templating engine.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions