rabbah commented on issue #2927: [Feature request] bash kind action
URL: 
https://github.com/apache/incubator-openwhisk/issues/2927#issuecomment-347010085
 
 
   @sungjunyoung thanks for sharing your changes - looks like the main change 
you made is to recursively project the JSON object's fields into env vars. Did 
you consider using `jq` instead?
   
   ```bash
   > cat exec 
   #!/bin/bash
   
   apk update && apk add jq 
   
   ARGS=$@
   A=`echo "$ARGS" | jq '."a"'`
   B=`echo "$ARGS" | jq '."b"'`
   C=`echo "$ARGS" | jq '."c"[0]'`
   RES=$(($B + $C))
   
   echo A is $A
   echo "{\"result\": $RES }"
   ```
   
   ```bash
   > wsk action create bash exec --native
   ok: created action bash
   
   > wsk action invoke bash -p a A -p b 123 -p c '[1,2,3]' -r
   {
       "result": 124
   }
   ```
   
   `jq` isn't installed in the base dockers skeleton image yet but that'll be 
useful to add. It would avoid modifying the proxy as an alternative.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to