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

Global dynamic variables are set in wrong folder #442

Open
thetillhoff opened this issue Feb 16, 2021 · 0 comments
Open

Global dynamic variables are set in wrong folder #442

thetillhoff opened this issue Feb 16, 2021 · 0 comments

Comments

@thetillhoff
Copy link

  • Task version: 3.2.2
  • Operating System: Ubuntu 20.04

Since version 3.2.0 (and #384), task executes the dynamic variable commands (set with sh: bash ...) in the directory of the task they are used in. This is even the case if they are declared globally (-> not in a specific task).
Previously, they were executed in the current directory.

Intuitively, I'd say global variables should be set either in the current directory for global ones and variables which are set at task-level should be executed in the directory of the task.

I think it depends how one understands those dynamic variables: Are they intended to be used as "insert specified command here" or as variable which will be set at runtime? For me, dynamic variable means the latter.

Nevertheless, it was possible to use VERSION: {sh: "bash {{ .PWD }}/scripts/version.sh"} to still make it work somehow. (Instead of defining the relative path for each task where it is used)

Example Taskfile showing the issue

version: '2'

vars:
  VERSION: {sh: "bash scripts/version.sh"}

replace-versions:
    desc: Replace versions
    cmds:
      - |
          sed -i.bak -e "s#version: 0.0.0#version: {{.VERSION}}#g"
@thetillhoff thetillhoff added the type: bug Something not working as intended. label Feb 16, 2021
@pd93 pd93 removed the type: bug Something not working as intended. label Dec 16, 2024
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