garden
garden copied to clipboard
Custom command args.$rest not working properly with alias
Bug
Current Behavior
When passing the global flag using alias -l=debug
in the custom command that is used in a exec.command with join
helper function, it is not being get it. Otherwise if I pass as --log-level=debug
it works.
I've found same issue to -e
alias. Didn't test all, so it might have others.
Expected behavior
Alias of flags should be available in the args.$rest
for custom commands when using exec.command.
Reproducible example
kind: Command
name: my-script
description:
short: Run that script we keep using
exec:
command:
- sh
- -c
- |
echo "I'm a super important script, here we go!"
echo flag: ${join(args.$rest, ' ')}
Running garden my-script -l=debug
my-script
Running exec command: sh -c echo "I'm a super important script, here we go!"
echo flag:
I'm a super important script, here we go!
flag:
Done flushing all events and log entries.
Done flushing all events and log entries.
Running garden my-script --log-level=debug
my-script
Running exec command: sh -c echo "I'm a super important script, here we go!"
echo flag: --log-level=debug
I'm a super important script, here we go!
flag: --log-level=debug
Done flushing all events and log entries.
Done flushing all events and log entries.
Workaround
Suggested solution(s)
Additional context
Your environment
- OS: linux distro
- How I'm running Kubernetes: GKE
garden version
0.12.40-edge-5e9ec2f8
Hi @thsig
Was this labeled as feature request
because of the log-level
not being considered today?
I'm having a similar issue with the log-level
. It seems like the log-level
is not being read by the exec: or gardenCommand:
during the custom-command
call. I have other options ie. --skip-dependencies
that work okay.
❯ garden version
0.12.43-edge-c161c60a
kind: Command
name: services-selected
args:
- name: services
- name: environment
# exec:
# command:
# - sh
# - -c
# - |
# garden deploy ${string(replace(args.services, '"', ''))} --env ${args.environment} -l 2
gardenCommand:
- deploy
- ${string(replace(args.services, '"', ''))}
- --env
- ${args.environment}
# - --skip-dependencies
- $concat: ${args.$rest}
# - --log-leve=info
Using gardenCommand
If I run garden services-selected test2-test dev -l 2
or --log-level=info
The run happens with no extra verbosity.
If I do either of the following changes to the command:
# - $concat: ${args.$rest}
- --log-level=info
OR
- --log-level
- info
OR
- --log-level=2
OR
- -l
- "2"
And run garden services-selected test2-test dev
The run happens with no extra verbosity.
Using exec
Then if I changed to use exec
instead of gardenCommand
exec:
command:
- sh
- -c
- |
garden deploy ${string(replace(args.services, '"', ''))} --env ${args.environment} -l 2
OR
garden deploy ${string(replace(args.services, '"', ''))} --env ${args.environment} --log-level=info
OR
garden deploy ${string(replace(args.services, '"', ''))} --env ${args.environment} --l=info
and run: garden services-selected test2-test dev
The run happens with no extra verbosity.
Now, as I mentioned, there is no problem when I add other option or flag
. For example when I uncomment or add --skip-dependencies
they do get skipped as expected.
Thanks!
This issue has been automatically marked as stale because it hasn't had any activity in 90 days. It will be closed in 14 days if no further activity occurs (e.g. changing labels, comments, commits, etc.). Please feel free to tag a maintainer and ask them to remove the label if you think it doesn't apply. Thank you for submitting this issue and helping make Garden a better product!
This issue has been automatically marked as stale because it hasn't had any activity in 90 days. It will be closed in 14 days if no further activity occurs (e.g. changing labels, comments, commits, etc.). Please feel free to tag a maintainer and ask them to remove the label if you think it doesn't apply. Thank you for submitting this issue and helping make Garden a better product!