defenseunicorns / maru-runner

The Unicorn Task Runner
Apache License 2.0
10 stars 0 forks source link

envPath doesn't play nice with includes #129

Open RothAndrew opened 1 month ago

RothAndrew commented 1 month ago

Environment

App version: UDS CLI v0.13.0

Steps to reproduce

tasks:

Given the above, if I run uds run bar:hello I correctly get "Hello There!". If I run uds run hello I don't.

If I change envPath to .env then uds run hello works fine and uds run bar:hello throws:

ERROR:  Failed to run action: open subdir/.env: no such file or directory
RothAndrew commented 1 month ago

IMO paths should always be relative to the source file directory. So, in the example above the correct value for envPath should be ../.env and both uds run hello and uds run bar:hello as well as cd subdir && uds run -f bar.yaml hello should all act the same

Similar issues will be found in actions.dir and actions.cmd

I suppose remote includes would need to be a special case, in that they would need to use paths relative to the file path where the tasks.yaml file is

RothAndrew commented 1 month ago

Workaround:

# subdir/bar.yaml

tasks:
  - name: hello
    actions:
      - cmd: |
             set -a; source .env; set +a
             echo "$KENOBI"
RothAndrew commented 1 month ago

Note for github actions runners, for some reason sh doesn't have source so you'll get an error source: not found. Do this instead:

tasks:
  - name: hello
    actions:
      - cmd: |
          set -a; source .env; set +a
          echo "$KENOBI"
        shell:
          darwin: bash
          linux: bash