launchrctl / launchr

Launchr is a CLI action runner that executes actions inside short-lived local containers.
Apache License 2.0
11 stars 3 forks source link

Ability to pass config values to action command #67

Closed davidferlay closed 1 month ago

davidferlay commented 2 months ago

Current

Expected

iignatevich commented 2 months ago

to test: 1) add to %binary_name config.yaml some vars, like

actions:
  test:
    deep:
      string: str
      int: 100
      bool: true

update your action arg or opt to have new launchr value processor

      process:
        - processor: launchr.GetConfigValue
          options:
            path: actions.test.deep.string
davidferlay commented 2 months ago

Tried with these:

- .plasmactl/config.yaml

sshconfig: port: 1337 user: skilld


Renders as:

➜ ./plasmactl platform:sshconfig skilld

➜ ./plasmactl platform:sshconfig --user uservaluefromoption uservaluefromoption

davidferlay commented 2 months ago

Tested OK with int and string option types

However with bool, when option is not passed to command, default value from action.yaml seem to override the value from config for now:

Renders as :

./plasmactl platform:sshconfig                     
false

In the same time, when option is passed to command, computed value seem to always be true:


- .plasmactl/config.yaml

sshconfig: port: 1337 user: skilld booltest: true


Renders as:

./plasmactl platform:sshconfig --secondoption true true

./plasmactl platform:sshconfig --secondoption false true

davidferlay commented 1 month ago

Something not ok yet:

I think logic should be : cli option > should override config > should override default

Meaning:

image

davidferlay commented 1 month ago

with

then

➜ ./plasmactl platform:sshconfig                     
false <----- expected
➜ ./plasmactl platform:sshconfig --secondoption=true 
true
➜ ./plasmactl platform:sshconfig --secondoption=false
false

working as expected