upgle opened a new pull request #3138: Add bash kind action URL: https://github.com/apache/incubator-openwhisk/pull/3138 This is a new bash kind action. Related issue is #2927. bash action runtime is based on `openwhisk/dockerskeleton` and action proxy is overrided for bash script. also added jq to handle json in bash script ## How to use ``` cat <<EOF > exec #!/bin/bash echo \$_test EOF ``` It returns only the last line, supports auto boxing. (no need to make json object in script) ``` $ wsk -i action update test exec --kind bash ok: updated action test $ wsk -i action invoke hello -r -p test "Hello World!" { "result": "Hello World!" } ``` ## Using parameters easily The parameters are easy to use as environment variables in bash scripts. access parameters using environment variables is more intuitive and easier to use. [sungjunyoung/openwhisk-bashAction](https://github.com/sungjunyoung/openwhisk-bashAction), This is the repository in which it is implemented 1. Object ```json { "key":{ "key1":"value1", "key2":"value2" } } ``` ```bash #!/bin/bash echo $_key_key1 echo $_key_key2 ``` 2. List ``` { "key":[ {"first":"value1"}, {"second":"value2"} ] } ``` ```bash #!/bin/bash echo $_key_0_first echo $_key_1_second ``` 3. also can be access theme using jq, jq is aleady installed. ```bash #!/bin/bash ARGS=$@ A=`echo "$ARGS" | jq '."a"'` B=`echo "$ARGS" | jq '."b"'` C=`echo "$ARGS" | jq '."c"[0]'` RES=$(($B + $C)) ``` ## Testing ``` ./gradlew tests:test --tests actionContainers.BashActionContainerTests ```
---------------------------------------------------------------- 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
