Skip to content

Refreshing sources hash on file save on yaml filesΒ #200

@WesselAtWork

Description

@WesselAtWork

On yaml file saves, the Task extension automaticity refreshes something that causes sources defined (that includes the yaml file) to be rehashed.
This means that the moment I change the yaml file, it's hash is updated leading to a situation where no tasks with it in the sources will ever be able to run because the hash is always refreshed before a task is executed.

I know it's something the Task Extension is doing, because when I disable the extension, the problem goes away.

This only happens to yaml files defined in the sources list.

Example

Where is a setup that should display the strange behaviour.

Taskfile,yml

version: '3'

tasks:
  default:
    cmds:
    - task: txt
    - task: json
    - task: yaml
  yaml:
    sources: ["*.yaml"]
    cmds:
      - cmd: echo Yaml Test
  txt:
    sources: ["*.txt"]
    cmds:
      - cmd: echo Text Test
  json:
    sources: ["*.json"]
    cmds:
      - cmd: echo Json Test

test.yaml

test: test

test.json

{
    "test": "test"
}

test.txt

test

Change the yaml file and then save it to observe the hash changin in the checksums folder

Debug

I opend the output dialoug for task: Task (Debug) and noticed that when I save the test.yaml file, it cuases this message to apear

Detected changes to taskfile
Searching for taskfile in: "c:\testing"
Found taskfile: "c:\testing\Taskfile.yml"

I thought it might be somehow picking up the Taskfile, but moving the test.yaml to a sub directory and then updating the sources yielded the same result.

Platform

  • Task version: 3.44.1
  • Operating System: Windows amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions