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

[Bug:] Custom task directory (set with dir) is not created before initializing dynamic variable #1841

Open
ColorfulRhino opened this issue Sep 27, 2024 · 1 comment
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@ColorfulRhino
Copy link

Consider the following task using a custom dir:

version: '3'

tasks:
  test:
    dir: test-dir
    vars:
      TEST_VAR: "This is a test"
    cmds:
      - echo "This is a test. Using TEST_VAR with value: ${TEST_VAR}"

The above task will create the directory test-dir before executing the command if it is not already created.

However, when using a dynamic variable instead, like this:

version: '3'

tasks:
  test:
    dir: test-dir
    vars:
      TEST_VAR:
        sh: curl https://taskfile.dev
    cmds:
      - echo "This is a test. Using TEST_VAR with value: ${TEST_VAR}"

It fails to execute when the directory test-dir does not yet exist:
task: Command "curl https://taskfile.dev" failed: chdir /home/user/test-dir: no such file or directory

Expected behaviour:
The directory should be created before trying to execute the dynamic variable initialization command.


  • Task version: v3.39.2
  • Operating system: Ubuntu 24.04
  • Experiments enabled: no
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Sep 27, 2024
@ColorfulRhino
Copy link
Author

This issue may be a duplicate of #1838 but since that issue is difficult to read and understand I am not quite sure.

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