keptn-sandbox / slackbot-service

Slackbot to trigger evaluations of quality gates and receive results in Slack
Apache License 2.0
4 stars 2 forks source link

Ask Slackbot for approval of deployments #9

Closed jetzlstorfer closed 4 years ago

jetzlstorfer commented 4 years ago

Similar to this https://github.com/keptn/keptn/issues/1749

  1. Ask the Slackbot for all open approvals in a project OR get a message if a new event is awaiting approval
  2. Approve the deployment via the Slackbot (it has to send a approval-finished event).

What has to be done:

  1. Subscribe to sh.keptn.event.approval.triggered events with a subscriber (for this, the Keptn bot service has to run in the same cluster as the Keptn installation and a subscriber has to be added (similar to other Keptn integrations)
  2. For each approval.triggered event create a link back to the bridge (for reference: https://deploy-preview-579--keptn.netlify.app/docs/0.7.x/reference/bridge/deep_linking/ ) and ask the user for approval.
  3. Send an sh.keptn.event.approval.finished event with a result pass or failed back to Keptn

Payload of the events that are involved can be found here:

jetzlstorfer commented 4 years ago

Another issue that might be interesting for reference: https://github.com/keptn/keptn/issues/1835

jetzlstorfer commented 4 years ago

Updated initial description of issue

grabnerandi commented 4 years ago

I think having the approval feature with the slack bot would be great as it avoids having to keep an eye on the bridge!

jetzlstorfer commented 4 years ago

After discussion with @zohaib85 we came up with the following plan:

  1. we will replace the subscription method with a polling/user action to get new approval events. Eg., @keptnbot get approvals or poll for new approvals every X seconds
  2. the Slackbot will present the open approvals as a message in Slack to the user
  3. the user sends a message to the slackbot to approve or decline the request, e.g., @keptnbot decline approval-request :contextID
  4. the Slackbot sends this message to Keptn

further action items: @zohaib85 will do more research if we can embed a webserver into the Slackbot service to make it possible to listen for events and also provide buttons in the Slackbot (they need a webserver with endpoints available and registered on the slack-app)