Skip to content
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

Circular includes cause incorrect task execution directory #1860

Open
manzamor-cs opened this issue Oct 9, 2024 · 0 comments
Open

Circular includes cause incorrect task execution directory #1860

manzamor-cs opened this issue Oct 9, 2024 · 0 comments
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@manzamor-cs
Copy link

In my project I'd like to have a file with shared tasks (Tasklib.yaml) included in the Taskfiles of subdirectories. I then want to include the subdirectory Taskfiles in my root directory Taskfile. The project structure looks like this:

.
├── subdir/
│   └── Taskfile.yaml
├── Taskfile.yaml
└── Tasklib.yaml

The root Taskfile.yaml looks like this:

version: '3'

includes:
  subdir:
    taskfile: subdir/Taskfile.yaml
  shared:
    taskfile: Tasklib.yaml

tasks:
  test: ls ; echo

The shared tasks Tasklib.yaml looks like this:

version: '3'

tasks:
  shared-test: ls ; echo

The subdirectory Taskfile.yaml looks like this:

version: '3'

includes:
  shared:
    taskfile: ../Tasklib.yaml
    flatten: true

tasks:
  subdir-test: ls ; echo

When I run task -a, this is the output:

❯ task -a                                                                                                                               
task: Available tasks for this project:
* test:                     
* shared:shared-test:       
* subdir:shared-test:       
* subdir:subdir-test:    

When I run all of the tasks, subdir:shared-test gives a different output, despite running from the same folder and not having the dir property set in the include.

task test ; task shared:shared-test ; task subdir:shared-test ; task subdir:subdir-test                                        
task: [test] ls ; echo
Taskfile.yaml   Tasklib.yaml    subdir

task: [shared:shared-test] ls ; echo
Taskfile.yaml   Tasklib.yaml    subdir

task: [subdir:shared-test] ls ; echo
Taskfile.yaml

task: [subdir:subdir-test] ls ; echo
Taskfile.yaml   Tasklib.yaml    subdir

I'd expect these all to have the same output based on what the documentation states about the execution directory, but I guess having this circular include leads to a different output for the shared task when included from the subdirectory's Taskfile. Sorry if this has been posted before, but I couldn't identify an issue with this exact problem laid out. Please let me know if this is intended or not. Thank you!


  • Task version: 3.39.2
  • Operating system: macOS Sonoma 14.6.1
  • Experiments enabled: false
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Oct 9, 2024
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

No branches or pull requests

2 participants