kuttl icon indicating copy to clipboard operation
kuttl copied to clipboard

Document Enhance Shell Expansion with Defaults

Open kensipe opened this issue 5 years ago • 2 comments

https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

Would like to have a default value if ENV VAR not set as in:

${parameter:-word}

This should already work for *.sh shell scripts... but it would be great if the command expansion included it.

example:

apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
  - command: kubectl kudo install kafka --namespace kafka-mwt -P ${KAFKA_PARAMETER_FILE:-params-kind}.yaml
    ignoredFailure: true

kensipe avatar Jun 12 '20 13:06 kensipe

looks like this will require rewriting env.go core from golang core... features are not exposed to control this behavior :(

kensipe avatar Jun 12 '20 19:06 kensipe

I really like the idea of enhanced shell expansions with defaults.. but this should work fine with - script: or shell commands... since there is a reasonable solution. This change this to documentation of how to.

kensipe avatar Jul 17 '20 19:07 kensipe