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

Task-level vars are ignored during 'requires' evaluation #1768

Open
mokeko opened this issue Aug 20, 2024 · 1 comment · May be fixed by #1769
Open

Task-level vars are ignored during 'requires' evaluation #1768

mokeko opened this issue Aug 20, 2024 · 1 comment · May be fixed by #1769
Labels
state: awaiting response Waiting for issue author to respond.

Comments

@mokeko
Copy link

mokeko commented Aug 20, 2024

  • Task version: 3.38.0
  • Operating system: macOS
  • Experiments enabled: No

Taskfile.yml

version: '3'

vars:
  FILE_LEVEL: 'file'

tasks:
  echo:
    #requires:
    #  vars: [FILE_LEVEL, TASK_LEVEL]
    vars:
      TASK_LEVEL: 'task'
    cmds:
      - echo '{{.FILE_LEVEL}}, {{.TASK_LEVEL}}'

When running task echo with this file, it succeeds:

$ task echo
task: [echo] echo 'file, task'
file, task

Since both variables are set, uncommenting requires should not change the behavior of task echo. However, it fails with the message: task: Task "echo" cancelled because it is missing required variables: TASK_LEVEL. Task-level variable seems to be ignored during the evaluation of requires.

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Aug 20, 2024
@mokeko mokeko linked a pull request Aug 20, 2024 that will close this issue
@vmaerten
Copy link
Member

What is your use case for this?
Since FILE_LEVEL will always be defined, why would you include it in requires?

@vmaerten vmaerten added state: awaiting response Waiting for issue author to respond. and removed state: needs triage Waiting to be triaged by a maintainer. labels Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: awaiting response Waiting for issue author to respond.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants