apache / openwhisk

Apache OpenWhisk is an open source serverless cloud platform
https://openwhisk.apache.org/
Apache License 2.0
6.54k stars 1.17k forks source link

Need something like apiHost or endpoint when registering a webhook #1311

Closed skaegi closed 7 years ago

skaegi commented 8 years ago

When creating a new trigger based on a feed/action the set of parameters that get passed in are... lifeCycleEvent triggerName authKey

It would be good to also pass something like "endpoint" or "triggerUrl" or support "whisk.getEndpoint()" so that we have a generic means of creating the webhook URL.

The current pattern getting promoted is like this... https://github.com/openwhisk/openwhisk-catalog/blob/master/packages/github/webhook.js#L34 ...where the "endpoint" param is set on the package. It's workable but a pain and maybe slightly error-prone.

This is going to be one of if not the most common trigger creation patterns and it's worth providing first-class support for it.

rabbah commented 8 years ago

You could pass that explicitly as part of the feed creation? (As a workaround.)

wsk trigger create T --feed F --param endpoint xxx.yyy.zzz

rabbah commented 8 years ago

This is related to https://github.com/openwhisk/openwhisk/issues/616, https://github.com/openwhisk/openwhisk/issues/218 and https://github.com/openwhisk/openwhisk/issues/387. We should add the endpoint to the context available to all the runtimes.

skaegi commented 8 years ago

:) re: workaround yep using this currently...

wsk trigger create myT -f myF -p endpoint `wsk property get --apihost | awk -F"([ ][ ]+)|(\t+)" '{print $2}'`

or the package variant

wsk package create myP -p endpoint `wsk property get --apihost | awk -F"([ ][ ]+)|(\t+)" '{print $2}'`

... for anyone else who is doing this sort of thing in an install script

rabbah commented 7 years ago

All actions now receive as part of their context the __OW_API_HOST in the environment variables.