-
-
Notifications
You must be signed in to change notification settings - Fork 763
Description
Description
I am attempting to use wildcard tasks along with fingerprinting to create task runners for my open tofu homelab modules. I am using nested wildcard tasks to be able to run all tests, module tests, or a specific test. I am expecting the .task/checksum fingerprinting each unique invocation of the wildcard task, to prevent unnnessecary work.
However, the .task/checksum is only fingerprinting the last invocation of the wildcard task. Meaning that when running through a collection of wildcard tasks, the fingerprinting does not prevent any unnecessary work because a single file (.task/checksum/tofu-test_-_-) is being used to fingerprint multiple different invocations of the wildcard task.
I have created a simplified example of the issue here.
Running task copy calls task paste-* on each item. The .task/checksum/paste-- file stores the fingerprint of each call, replacing the previous one. This means that each call to task copy runs the full copy each time, even though the inputs and outputs have not changed.
I would imagine the correct behavior would be for .task/checksum to store the specific invocation of the wildcard task to prevent overwriting the checksum.
Please let me know if there is an issue in my implementation. Thanks!
Version
Task version: 3.40.1 ()
Operating system
ProductName: macOS ProductVersion: 14.4.1 BuildVersion: 23E224
Experiments Enabled
No response
Example Taskfile
# Needs additional local files created, see: https://github.com/ionfury/homelab-modules/blob/taskfile-wildcard-issue-example/.taskfiles/example/taskfile.yaml
---
version: "3"
tasks:
copy:
desc: Copys items from resources to outputs.
vars:
TASKS:
sh: ls {{.ROOT_DIR}}/resources
cmds:
- for: { var: TASKS }
task: paste-{{.ITEM}}
paste-*:
desc: Pastes an item in outputs.
vars:
ITEM: "{{index .MATCH 0}}"
cmds:
- touch {{.ROOT_DIR}}/outputs/{{.ITEM}}
sources:
- '{{.ROOT_DIR}}/resources/{{.ITEM}}'
generates:
- '{{.ROOT_DIR}}/outputs/{{.ITEM}}'