Skip to content

Dynamic variable resolution does not take into account current directory #2161

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

Open
viktorasm opened this issue Apr 4, 2025 · 0 comments · May be fixed by #2160
Open

Dynamic variable resolution does not take into account current directory #2161

viktorasm opened this issue Apr 4, 2025 · 0 comments · May be fixed by #2160
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@viktorasm
Copy link

viktorasm commented Apr 4, 2025

Description

when creating dynamic variables like files: sh: "find ." in multiple subfolders, they won't be correctly evaluated. Due to internal caching, only the first result will be used.

Posted PR with reproduction and fix: #2160

Sample input

Folder structure:

root/
├── Taskfile.yaml
└── sub1/
    ├── Taskfile.yaml
    └── a
└── sub2/
    ├── Taskfile.yaml
    └── b

Taskfile.yml

version: '3'

run: when_changed
silent: true
output: prefixed

includes:
  s1:
    taskfile: sub1
    dir: sub1
  s2:
    taskfile: sub2
    dir: sub2

tasks:
  all:
    deps:
      - s1:all
      - s2:all

sub1/Taskfile.yaml, sub2/Taskfile.yaml:

version: '3'

vars:
  files:
    sh: "find ."

tasks:
  all:
    cmds:
      - cmd: 'echo  "{{.files}}"'

Actual output:

$ task all
[s2:all] .
[s2:all] ./Taskfile.yml
[s2:all] ./b
[s1:all] .
[s1:all] ./Taskfile.yml
[s1:all] ./b

Note how "s1" lists file "b", which is incorrect.

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Apr 4, 2025
@viktorasm viktorasm changed the title dynamic variable resolution does not take into account current directory Dynamic variable resolution does not take into account current directory Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants