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

Wildcards & Fingerprinting Don't Work Together #2004

Closed
ionfury opened this issue Jan 17, 2025 · 1 comment
Closed

Wildcards & Fingerprinting Don't Work Together #2004

ionfury opened this issue Jan 17, 2025 · 1 comment

Comments

@ionfury
Copy link

ionfury commented Jan 17, 2025

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}}'
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Jan 17, 2025
@ionfury
Copy link
Author

ionfury commented Jan 17, 2025

I see a solution was posted in #1794, and an enhancement is in the works in #1795. Shame on me for not searching better :)

@ionfury ionfury closed this as completed Jan 17, 2025
@task-bot task-bot removed the state: needs triage Waiting to be triaged by a maintainer. label Jan 17, 2025
ionfury added a commit to ionfury/homelab-modules that referenced this issue Jan 17, 2025
ionfury added a commit to ionfury/homelab-modules that referenced this issue Jan 17, 2025
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

2 participants