Skip to content

dir in task is buggy when using variables #1838

@ccxuy

Description

@ccxuy

Task version: Task version: v3.38.0 (h1:O7kgA6BfwktXHPrheByQO46p3teKtRuq1EpGnFxNzbo=)
Operating system: Ubuntu 2204
Experiments enabled: No

version: '3'

includes:
  taska:
    taskfile: tmp/a.yml

tasks:
  empty:
    cmds:
      - task: taska:task1
version: '3'

vars:
  location:
    sh: echo "/tmp"

tasks:
  task1:
    dir: "{{.location}}"
    cmds:
      - echo "dir is {{.location}}"
      - pwd
> task empty
task: [taska:task1] echo "dir is /tmp"
dir is /tmp
task: [taska:task1] pwd
/home/xxxx/tmp

I suppose it should be /tmp? If I change to dir: "/{{.location}}", it become what I expect.

  task1:
    dir: "/{{.location}}"
    cmds:
      - echo "dir is {{.location}}"
      - pwd
> task empty
task: [taska:task1] echo "dir is /tmp"
dir is /tmp
task: [taska:task1] pwd
/tmp

also, if I change to:

includes:
  taska: tmp/a.yml

output is also correct:

> task empty
task: [taska:task1] echo "dir is /tmp"
dir is /tmp
task: [taska:task1] pwd
/tmp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions