How to nest variables
yujunz opened this issue · comments
Yujun Zhang commented
Trying to nest variable in another variable but seems not working. How should I handle such case in robo?
deploy:
summary: deploy longhorn system
exec: kapp deploy {{.kapp.flags}}
delete:
summary: delete longhorn system
exec: kapp delete {{.kapp.flags}}
port-forward:
summary: port-forward service to localhost
exec: kubectl port-forward -n longhorn-system svc/longhorn-frontend 8080:80
variables:
kapp:
namespace: kapp
app: longhorn-system
flags: --namespace {{.kapp.namespace}} --app {{.kapp.app}} --diff-changes
❯ robo variables
kapp.app: longhorn-system
kapp.flags: --namespace {{.kapp.namespace}} --app {{.kapp.app}} --diff-changes
kapp.namespace: kapp
Amir Abushareb commented
That's not supported, before we go ahead and add that feature though, can you elaborate some more? what are you trying to do?
For example, why not change deploy
and delete
to accept the namespace and app name via regular args, like:
robo deploy kapp loghorn-system
robo delete kapp loghorn-system
Yujun Zhang commented
Thanks.
I was trying to have some shortcuts for regular kapp actions with less typing and keep the code D.R.Y.
I end up with copy and paste of the flags.