myke icon indicating copy to clipboard operation
myke copied to clipboard

discovery: top-level .env files ignored in discovered tasks

Open licarth opened this issue 6 years ago • 0 comments

Example

With this directory structure

root/
├── myke.yml (A)
├── myke.env.local (C)
└── sub/
    └── myke.yml (B)

(A) being :

project: root
discover:
  - sub

(B) being :

project: sub
tasks:
  deploy:
    cmd: echo "deploy with {{.OPTIONAL_ARGS}}"

(C) being :

OPTIONAL_ARGS="myOptionalArgs"

Current behaviour

cd root && myke deploy will return "deploy with ".

root/myke.env.local will be ignored for tasks that are discovered in subs

Behaviour I expect cd root && myke deploy to return "deploy with myOptionalArgs".

Current workarounds If we want myke to pick up the extra args, we have to do one of the following :

  • OPTIONAL_ARGS="myOptionalArgs" myke deploy which is slightly verbose. Or export or source to inject it in the env ourselves.
  • proxy our sub/task with a task in root/myke.yml which kind of makes discovery useless.
  • move our root/myke.env.local to sub/. But in real life we have many of those.

Other cases

Additional myke.env.local in sub

root/
├── myke.yml (A)
├── myke.env.local (C)
└── sub/
    ├── myke.yml (B)
    └── myke.env.local (D)

I believe values in (C) should override values in (D), when conflicting. Means export values in (D) first, then values in (C).

licarth avatar Aug 20 '18 10:08 licarth