pritidesai opened a new issue #313: web action annotations are not set URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/313 When we use `wsk` CLI to create a web action like: ``` wsk action create hi tests/usecases/helloworld/actions/hello.js --web yes -v REQUEST: [PUT] https://openwhisk.ng.bluemix.net/api/v1/namespaces/<namespace>/actions/hi?overwrite=false Req Headers { "Authorization": [ "<auth>" ], "Content-Type": [ "application/json" ] } Req Body {{"namespace":"<namespace>","name":"hi","exec":{"kind":"nodejs:default","code":"/**\n * Return a simple greeting message for the whole world.\n */\nfunction main(params) {\n return {payload: 'Hello, world!'};\n}\n"},"annotations":[{"key":"web-export","value":true},{"key":"raw-http","value":false},{"key":"final","value":true}]} } RESPONSE:Got response with code 200 Resp Headers { "Access-Control-Allow-Headers": [ "Authorization, Content-Type" ], "Access-Control-Allow-Origin": [ "*" ], "Connection": [ "Keep-Alive" ], "Content-Type": [ "application/json; charset=UTF-8" ], "Date": [ "Thu, 10 Aug 2017 00:33:48 GMT" ], "Server": [ "nginx/1.11.13" ], "Set-Cookie": [ "DPJSESSIONID=PBC5YS:1663067204; Path=/; Domain=.whisk.ng.bluemix.net" ], "X-Backside-Transport": [ "OK OK" ], } Response body size is 622 bytes Response body received: { "name": "hi", "publish": false, "annotations": [{ "key": "web-export", "value": true }, { "key": "raw-http", "value": false }, { "key": "final", "value": true }, { "key": "exec", "value": "nodejs:6" }], "version": "0.0.1", "exec": { "kind": "nodejs:6", "code": "/**\n * Return a simple greeting message for the whole world.\n */\nfunction main(params) {\n return {payload: 'Hello, world!'};\n}\n", "binary": false }, "parameters": [], "limits": { "timeout": 60000, "memory": 256, "logs": 10 }, "namespace": "<namespace>" } ok: created action hi ``` When I am translating this `wsk` CLI into wskdeploy manifest: ``` wsk action create hi tests/usecases/helloworld/actions/hello.js --web yes ``` ``` package: name: helloworld actions: hello: location: ../tests/usecases/helloworld/actions/hello.js web-export: true ``` manifest_parser.ComposeActions() initializes ActionRecord to: ``` (utils.ActionRecord) { Action: (*whisk.Action)(0xc42018a2d0)({ Namespace: (string) "", Name: (string) (len=6) "hello", Version: (string) "", Exec: (*whisk.Exec)(0xc42013b200)({ Kind: (string) (len=14) "nodejs:default", Code: (*string)(0xc4201310b0)((len=131) "/**\n * Return a simple greeting message for the whole world.\n */\nfunction main(params) {\n return {payload: 'Hello, world!'};\n}\n"), Image: (string) "", Init: (string) "", Main: (string) "", Components: ([]string) <nil> }), Annotations: (whisk.KeyValueArr) <nil>, Parameters: (whisk.KeyValueArr) <nil>, Limits: (*whisk.Limits)(<nil>), Error: (string) "", Code: (int) 0, Publish: (*bool)(0xc420131038)(false) }), Packagename: (string) (len=10) "helloworld", Filepath: (string) (len=145) "<path>/../tests/usecases/helloworld/actions/hello.js" } ``` Note, the Annotations is `<nil>` and missing keys which are needed for creating web actions. I tried adding a bogus annotation in my manifest file: ``` package: name: helloworld actions: hello: location: ../tests/usecases/helloworld/actions/hello.js annotations: foo: bar web-export: true ``` Now, ActionRecord looks something like this: ``` (utils.ActionRecord) { Action: (*whisk.Action)(0xc420188240)({ Namespace: (string) "", Name: (string) (len=6) "hello", Version: (string) "", Exec: (*whisk.Exec)(0xc42001f5c0)({ Kind: (string) (len=14) "nodejs:default", Code: (*string)(0xc420015360)((len=131) "/**\n * Return a simple greeting message for the whole world.\n */\nfunction main(params) {\n return {payload: 'Hello, world!'};\n}\n"), Image: (string) "", Init: (string) "", Main: (string) "", Components: ([]string) <nil> }), Annotations: (whisk.KeyValueArr) (len=4 cap=4) { (whisk.KeyValue) { Key: (string) (len=3) "foo", Value: (string) (len=3) "bar" }, (whisk.KeyValue) { Key: (string) (len=10) "web-export", Value: (bool) true }, (whisk.KeyValue) { Key: (string) (len=8) "raw-http", Value: (bool) false }, (whisk.KeyValue) { Key: (string) (len=5) "final", Value: (bool) true } }, Parameters: (whisk.KeyValueArr) <nil>, Limits: (*whisk.Limits)(<nil>), Error: (string) "", Code: (int) 0, Publish: (*bool)(0xc42001529b)(false) }), Packagename: (string) (len=10) "helloworld", Filepath: (string) (len=145) "<path>/../tests/usecases/helloworld/actions/hello.js" } ``` Annotations for web actions are now set in this case. There is a check in [manifest_parser.ComposeActions](https://github.com/apache/incubator-openwhisk-wskdeploy/blob/master/parsers/manifest_parser.go#L307) to add web annotations only when annotations are not empty. We need to reevaluate this check and remove it if needed. ---------------------------------------------------------------- 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