[GitHub] csantanapr commented on issue #3138: Add bash kind action
csantanapr commented on issue #3138: Add bash kind action URL: https://github.com/apache/incubator-openwhisk/pull/3138#issuecomment-366863338 Recent changes to dockerSkeleton runtime now allows for better support for bash actions. Using `--native` with a simple script is the recommend way for bash actions. For example: bash.sh reads a line from \ ``` $ cat bash.sh #!/bin/bash read 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\" }" ``` ``` wsk action update bash bash.sh --native ``` ``` ok: updated action bash ``` ``` wsk action invoke bash -p a A -p b 123 -p c '[1,2,3]' -r ``` ```json { "result": 124 } ``` ``` wsk activation logs --last --strip ``` ``` A is "A" ``` docs will update to reflect this new usage. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] csantanapr commented on issue #3138: Add bash kind action
csantanapr commented on issue #3138: Add bash kind action URL: https://github.com/apache/incubator-openwhisk/pull/3138#issuecomment-366863338 Recent changes to dockerSkeleton runtime now allows for better support for bash actions. Using `--native` with a simple script is the recommend way for bash actions. For example: bash.sh reads a line from \ ``` $ cat bash.sh #!/bin/bash read ARGS A=`echo "$ARGS" | jq '."a"'` B=`echo "$ARGS" | jq '."b"'` C=`echo "$ARGS" | jq '."c"[0]'` RES=$(($B + $C)) echo A is $A ``` ``` wsk action update bash bash.sh --native ``` ``` ok: updated action bash ``` ``` wsk action invoke bash -p a A -p b 123 -p c '[1,2,3]' -r ``` ```json { "result": 124 } ``` ``` wsk activation logs --last --strip ``` ``` A is "A" ``` docs will update to reflect this new usage. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] csantanapr commented on issue #3138: Add bash kind action
csantanapr commented on issue #3138: Add bash kind action URL: https://github.com/apache/incubator-openwhisk/pull/3138#issuecomment-359554938 In addition as pointed by @rabbah we could add `perl` to the dockerskeleton image, and support perl scripts also with a single image. In terms of the extra step of converting the json input to environments variables I don't feel good about it. 1. redundant work spent passing as env and argv 2. the custom convention of underscores and such not very attractive, I prefer the using jq to parse the json string. 3. I don't like passing all my parameters which would include api keys and passwords, secrets I could be using a 3rd party library or module and I don't want them sniffing to my private input parameters, I prefer to be explicit and when using this 3rd party pass enough to make them work. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] csantanapr commented on issue #3138: Add bash kind action
csantanapr commented on issue #3138: Add bash kind action URL: https://github.com/apache/incubator-openwhisk/pull/3138#issuecomment-359550615 I don't think we need a new image or a new runtime, dockerskeleton should be able to handle bash, perl, any scripting language I think today you can do ``` wsk action create foo foo.sh --native ``` changing to use `--kind bash` is not shorter If you want `jq` support we should add that to the dockerskeleton image If what you want is shorter syntax then we could update the CLI to sugar certain extentions (i.e. .bash, .sh, .pl) To detect the `.sh` and remmap that to --native (docker kind with default dockerskeleton): ``` wsk action create foo foo.sh ``` 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: us...@infra.apache.org With regards, Apache Git Services