openwhisk-catalog icon indicating copy to clipboard operation
openwhisk-catalog copied to clipboard

Github is failing to clean up webhooks during DELETE lifecycle

Open eweiter opened this issue 7 years ago • 1 comments

I was using the IBM Cloud Functions UI and I noticed the following behavior for Github trigger.

When I would create a trigger it would appear to create the Trigger and the Feed fine. The feed calls response was: {"duration":589,"name":"webhook","subject":"[email protected]","activationId":"e8ec3315288c4457ac3315288cf457d1","publish":false,"annotations":[{"key":"path","value":"whisk.system/github/webhook"},{"key":"waitTime","value":37},{"key":"kind","value":"nodejs:6"},{"key":"limits","value":{"timeout":60000,"memory":256,"logs":10}},{"key":"initTime","value":249}],"version":"0.0.264","response":{"result":{"response":"{\"type\":\"Repository\",\"id\":20159188,\"name\":\"web\",\"active\":true,\"events\":[\"push\"],\"config\":{\"url\":\"https://xxx:[email protected]:443/api/v1/namespaces/eweiter%40us.ibm.com_dev/triggers/JasonTest\",\"content_type\":\"json\",\"insecure_ssl\":\"0\"},\"updated_at\":\"2018-01-16T17:52:37Z\",\"created_at\":\"2018-01-16T17:52:37Z\",\"url\":\"https://api.github.com/repos/eweiter/bumblefoot/hooks/20159188\",\"test_url\":\"https://api.github.com/repos/eweiter/bumblefoot/hooks/20159188/test\",\"ping_url\":\"https://api.github.com/repos/eweiter/bumblefoot/hooks/20159188/pings\",\"last_response\":{\"code\":null,\"status\":\"unused\",\"message\":null}}"},"success":true,"status":"success"},"end":1516125157900,"logs":[],"start":1516125157311,"namespace":"[email protected]_dev"} To me it is showing that a "Push" event was created and that it is Active.

However when I go to delete that Trigger, the Feed deletion encounters an error. The Feed deletion response was: {"duration":207,"name":"webhook","subject":"[email protected]","activationId":"6a3da00bcc7448e6bda00bcc7438e60d","publish":false,"annotations":[{"key":"limits","value":{"timeout":60000,"memory":256,"logs":10}},{"key":"path","value":"whisk.system/github/webhook"},{"key":"kind","value":"nodejs:6"},{"key":"waitTime","value":23}],"version":"0.0.264","response":{"result":{"error":"Found no existing webhooks for trigger URL https://xxx:[email protected]:443/api/v1/namespaces/eweiter%40us.ibm.com_dev/triggers/JasonTest"},"success":false,"status":"application error"},"end":1516125185130,"logs":[],"start":1516125184923,"namespace":"[email protected]_dev"} Where it is telling me that it couldn't find any hooks on that trigger to delete and it is returning a status code of 502.

Steps to recreate:

  1. Create a Trigger with the Github feed using the "push" event
  2. Delete the Trigger

eweiter avatar Jan 16 '18 18:01 eweiter

This happens if we edit the generated webhook manually from the GitHub site. Sometimes the callBackUrl will be slightly changed if you just pressed the edit button of the webhook (whether you did any changes or not).

The callBackUrl which GitHub package sends to create the webhook includes the TCP port name 443. But if we try to edit the webhook, GitHub will remove the port name (which is not mandatorily needed to find the trigger location) from the callBackUrl. When the package tries to delete the webhook, they look for the previous callbackUrl and it is not available anymore causing a failure in deleting the webhook. If we can update the git package to generate the callBackUrl without the port name, then we can mitigate this problem.

Example callBackUrls before edit: https://auth@apihost:443/api/v1/namespaces/_/triggers/myGitTrigger after edit: https://auth@apihost/api/v1/namespaces/_/triggers/myGitTrigger

prabhashthere avatar Oct 03 '18 07:10 prabhashthere