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

Using -d option brakes path resolution within includes #2080

Closed
0xn3va opened this issue Feb 20, 2025 · 1 comment
Closed

Using -d option brakes path resolution within includes #2080

0xn3va opened this issue Feb 20, 2025 · 1 comment

Comments

@0xn3va
Copy link

0xn3va commented Feb 20, 2025

Description

Hello team,

I tried to set the working directory using the -d option and include task file from another directory but Task incorrectly resolves the path for the included task file. You can follow the next steps to reproduce the issue:

  1. Create temp directory cd $(mktemp -d)

  2. Add shared task file to common.yml:

    version: '3'
    tasks:
      work:
        cmds:
          - echo 'Hello World from Task!'
  3. Add task file to Taskfile.yml:

    version: '3'
    includes:
      common:
        taskfile: "{{.DIR_PATH}}/common.yml"
    tasks:
      default:
        cmds:
          - task common:work
  4. Run the following command to confirm that everything working as expected when -d is not set:

    $ DIR_PATH="$(pwd)" task -t Taskfile.yml
    Hello World from Task!
    
  5. Run the following command to reproduce the error:

    $ DIR_PATH="$(pwd)" task -d "$(mktemp -d)" -t Taskfile.yml 
    task: No Taskfile found at "/var/folders/yp/syl984812xsdsc7qv3zr7y4c0000gp/T/tmp.1inKucKbvp"
    task: Failed to run task "default": exit status 100
    

I tried to set dir within includes but nothing worked.

Version

Task version: 3.41.0 (pypi)

Operating system

macos

Experiments Enabled

No response

Example Taskfile

# common.yml
version: '3'
tasks:
  work:
    cmds:
      - echo 'Hello World from Task!'

# Taskfile.yml
version: '3'
includes:
  common:
    taskfile: "{{.DIR_PATH}}/common.yml"
tasks:
  default:
    cmds:
      - task common:work
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Feb 20, 2025
@0xn3va 0xn3va changed the title Using -d option brakes path resolution within includes when dir is set Using -d option brakes path resolution within includes Feb 21, 2025
@0xn3va
Copy link
Author

0xn3va commented Feb 21, 2025

Sorry for the false alarm! I found that my Taskfile.yml is missing colon in task: common:work

@0xn3va 0xn3va closed this as completed Feb 21, 2025
@task-bot task-bot removed the state: needs triage Waiting to be triaged by a maintainer. label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants