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

Strange env var override behavior #1802

Open
aXe1 opened this issue Sep 11, 2024 · 0 comments
Open

Strange env var override behavior #1802

aXe1 opened this issue Sep 11, 2024 · 0 comments
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@aXe1
Copy link

aXe1 commented Sep 11, 2024

If set some variable with shell, and override it with task parameter, then task will in some cases use one parameter and in some - another.

Taskfile.yml

version: 3
env:
  SOME_PATH: '{{if not (empty .PATH_PART)}}/some/path/{{.PATH_PART}}/file.txt{{else}}{{fail "PATH_PART not set!"}}{{end}}'
tasks:
  default:
    cmds:
      - echo _${PATH_PART}_
      - echo _{{.PATH_PART}}_
      - echo _${SOME_PATH}_
      - echo _{{.SOME_PATH}}_

Bug reproduce steps:

$ PATH_PART=foo task PATH_PART=bar
task: [default] echo _${PATH_PART}_
_foo_
task: [default] echo _bar_
_bar_
task: [default] echo _${SOME_PATH}_
_/some/path/bar/file.txt_
task: [default] echo _/some/path/foo/file.txt_
_/some/path/foo/file.txt_

$ task PATH_PART=bar
template: :1:73: executing "" at <fail "PATH_PART not set!">: error calling fail: PATH_PART not set!

$ PATH_PART=foo task
task: [default] echo _${PATH_PART}_
_foo_
task: [default] echo _foo_
_foo_
task: [default] echo _${SOME_PATH}_
_/some/path/foo/file.txt_
task: [default] echo _/some/path/foo/file.txt_
_/some/path/foo/file.txt_
  • Task version: v3.39.0 (h1:Loe6ppP1x38Puv1M2wigp91bH/garCt0vLWkJsiTWNI=)
  • Operating system: Windows 10 Pro x64
  • Experiments enabled:
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Sep 11, 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