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

Using variables in sources section results in invalid "is up to date" #1986

Closed
korverdev opened this issue Jan 2, 2025 · 2 comments
Closed

Comments

@korverdev
Copy link

Description

I'm not sure if this is intended behavior or not, but couldn't find another issue on this so I wanted to at least raise the question.

Variables are seemingly ignored in the sources section, resulting in a bad checksum. To recreate, use the example Taskfile below and run the following commands:

task example
task example DIR=other_dir

Oh, and this project is awesome! Thanks for all the hard work!

Version

v3.40.1

Operating system

Ubuntu 24.04

Experiments Enabled

No response

Example Taskfile

version: "3"

example:
        vars:
            DIR: "packages"
        cmds:
            - echo "Ran"
        sources:
            - "{{.DIR}}"
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Jan 2, 2025
@vmaerten
Copy link
Member

vmaerten commented Jan 2, 2025

Hello !
There are multiple issue in our example. First of all, you cannot override a variable like this. You need to use the default function like this

vars:
  DIR: '{{default "packages" .DIR}}'

In our example, DIR is always 'packages'

The second thing is, we use https://github.com/mattn/go-zglob to match all files that match the patterm. I assume packages is a directory so you need to add a wildcard like :

vars:
  DIR: 'packages/*'

The final taskfile could be something like :

version: "3"
tasks:
  example:
     vars:
       DIR: '{{default "packages" .DIR}}/*'
     cmds:
       - echo "Ran {{.DIR}}"
     sources:
            - "{{.DIR}}"

PS: please, be careful when providing Taskfile, your example is not correct, I cannot copy / past it because tasks as a key is missing

@vmaerten vmaerten closed this as completed Jan 2, 2025
@vmaerten vmaerten added type: question Further information is requested. and removed state: needs triage Waiting to be triaged by a maintainer. type: question Further information is requested. labels Jan 2, 2025
@korverdev
Copy link
Author

Sorry about that. Appreciate the clarification!

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

3 participants