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

Template function breaks the "requires" feature #1950

Open
NorbertHauriel opened this issue Dec 12, 2024 · 0 comments
Open

Template function breaks the "requires" feature #1950

NorbertHauriel opened this issue Dec 12, 2024 · 0 comments
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@NorbertHauriel
Copy link
Contributor

NorbertHauriel commented Dec 12, 2024

This could be the exact same, or similar issue as #1557, but there is no reproduction happening there, so I decided to make a new issue, because I found a way to reproduce the "requires" breakage. The required variable is not enforced in the below example.

Expected: "task: Task "default" cancelled because it is missing required variables: MY_VAR"
Result: "template: :1:28: executing "" at <" ">: invalid value; expected string"
Taskfile:

version: 3
tasks:
  default:
    requires:
      vars: [MY_VAR]
    cmd: |
      {{range .MY_VAR | splitList " " }}
      {{end}}

When not using the template function, the required variable feature works as expected.
Result: "task: Task "default" cancelled because it is missing required variables: MY_VAR"

version: 3
tasks:
  default:
    requires:
      vars: [MY_VAR]
    cmd: |
      {{range .MY_VAR }}
      {{end}}
  • Task version: v3.40.0
  • Operating system: Linux, macOS
  • Experiments enabled: no
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Dec 12, 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