pritidesai opened a new issue #311: Action Function V/S Location
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/311
 
 
   We have Action field "Function" described as:
   
   function | true | string | N/A | Required source location (path inclusive) 
of the Action code either                                                       
          ? Relative to the Package manifest file. ? Relative to the specified 
Repository.
   
   For a sample manifest file:
   
   ```
   package:
     name: helloworld
     actions:
       hello1:
         function: ../tests/usecases/helloworld/actions/hello.js
   ```
   
   wskdeploy fails with:
   
   ```
   2017/08/09 13:38:00 Error: Action hello1 has no source code location set.
   2017/08/09 13:38:00 Error happened during execution, please type 'wskdeploy 
-h' for help messages.
   ```
   
   ComposeActions initialized ActionRecord with following values, note that the 
code is <nil> here:
   
   ```
   (*whisk.Action)(0xc42019a1b0)({
    Namespace: (string) "",
    Name: (string) (len=6) "hello1",
    Version: (string) "",
    Exec: (*whisk.Exec)(0xc42014fa40)({
     Kind: (string) "",
     **Code: (*string)(<nil>),**
     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)(0xc42012d380)(false)
   })
   ```
   
   The same manifest file but replacing Function with Location works just fine 
and deploys `hello1`:
   
   ```
   package:
     name: helloworld
     actions:
       hello1:
         location: ../tests/usecases/helloworld/actions/hello.js
   ```
   
   ComposeActions produces ActionRecord:
   
   ```
   (*whisk.Action)(0xc42019a3f0)({
    Namespace: (string) "",
    Name: (string) (len=6) "hello1",
    Version: (string) "",
    Exec: (*whisk.Exec)(0xc42014fb60)({
     Kind: (string) (len=14) "nodejs:default",
     Code: (*string)(0xc42012d3c0)((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)(0xc42012d383)(false)
   })
   ```
   
   We should either update wskdeploy specification or update code to honor 
"function" and "location" both.
   
   Also, in case of action files coming in from GitHub, for example, 
[webhook/manifest.yml](https://github.com/apache/incubator-openwhisk-wskdeploy/blob/master/tests/usecases/webhook/manifest.yml#L8),
 none of the fields "function" nor "location" is supported.
   
   Manifest file with `location`:
   
   ```
   package:
     name: helloworld
     actions:
       hello2:
         location: 
https://raw.githubusercontent.com/apache/incubator-openwhisk-wskdeploy/master/tests/usecases/helloworld/manifest.yaml
   ```
   
   ```
   2017/08/09 14:33:23 open 
parsers/https://raw.githubusercontent.com/apache/incubator-openwhisk-wskdeploy/master/tests/usecases/helloworld/manifest.yaml:
 no such file or directory
   2017/08/09 14:33:23 Error happened during execution, please type 'wskdeploy 
-h' for help messages.
   ```
   
   Manifest file with `function`:
   
   ```
   package:
     name: helloworld
     actions:
       hello2:
         function: 
https://raw.githubusercontent.com/apache/incubator-openwhisk-wskdeploy/master/tests/usecases/helloworld/manifest.yaml
   ```
   
   ```
   2017/08/09 14:35:30 Error: Action hello2 has no source code location set.
   2017/08/09 14:35:30 Error happened during execution, please type 'wskdeploy 
-h' for help messages.
   ```
   
   ComposeActions produces ActionRecord with a GitHub location is specified in 
`function`: 
   
   ```
   (*whisk.Action)(0xc42019a240)({
    Namespace: (string) "",
    Name: (string) (len=6) "hello3",
    Version: (string) "",
    Exec: (*whisk.Exec)(0xc42014faa0)({
     Kind: (string) "",
     Code: (*string)(<nil>),
     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)(0xc42012d381)(false)
   })
   ```
 
----------------------------------------------------------------
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

Reply via email to