Giter Club home page Giter Club logo

Comments (3)

trulede avatar trulede commented on June 26, 2024

This is relating to import/included tasks. Where are the default values defined? Variables specified at the inclusion have a fairly low priority:
https://taskfile.dev/usage/#variables

My own experiment show that this behavior is not working as expected. Global variables take precedence over variables defined at inclusion.

Taskfile

version: "3"
 
# should only be used if var not declared _anywhere_ else (BUG)
vars: 
  FOO: "FUBAR" 
 
includes:
  a:    
    taskfile: ./a/Taskfile.yml
    vars:
      FOO: "BAR"
  b:  
    taskfile: ./a/Taskfile.yml
    vars:
      FOO: "RAB"
      
tasks:
  one:
    cmds:
      - task a:two 
      - task b:two

a/Taskfile

version: "3"

# overrides variables defined on the inclusion of this Taskfile (OK)
#vars:
# FOO: "FOO"  

tasks:
  two:
    # overrides variables defined on the inclusion of this Taskfile (OK)
    #    vars:
    #      FOO: "BAR"
    cmds:
      - echo {{.FOO}}

$ ~/go/bin/task one
task: [one] task a:two
task: [a:two] echo FUBAR
FUBAR
task: [one] task b:two
task: [b:two] echo FUBAR
FUBAR

I don't think this is covered by the tests (global vars or environment vars). Seems like a bug. But is it the problem you observe?

from task.

blakewatters avatar blakewatters commented on June 26, 2024

Yes @trulede, you are correct. These are top-level variables that previously I was able to override at inclusion time. Now the global variables are taking precedence over the variables set at inclusion time.

This is definitely a bug/regression that has been introduced in the last several versions. Task is not honoring the precedence contract described in https://taskfile.dev/usage/#variables

from task.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.