Skip to content

Change incident template on project selection in slack modal

Rajendra Kadam requested to merge 374966-project-incident-template-in-slack into master

What does this MR do and why?

If a project has defined an incident template for incident creation. We need to load it in the description section of the Slack modal.

This MR adds support for this use case.

If a project has a template, it is shown, if it doesn't, it is not shown.

Slack sends the block_actions event type to handle input changes to input blocks.

I decided to build it in a generic format rather than incident-specific as it will support future work for ~"group::integrations" for their use case in creating and handling issues.

So we have a service to route the block_actions event type. Within block_actions we can segregate further depending on which input block was edited and process it accordingly.

Screenshots or screen recordings

Screen_Recording_2022-12-16_at_11.19.30_AM

How to set up and validate locally

  1. Follow the steps mentioned in https://gitlab.com/gitlab-org/manage/integrations/team/-/blob/main/integrations/slack.md to setup slack dev env.
  2. Open the incident modal using /dev-gitlab incident declare
  3. Try selecting other projects from the project selector dropdown and see the description change if there is a template defined already.

Note

  1. You can create templates by following the instructions at https://docs.gitlab.com/ee/user/project/description_templates.html#create-an-issue-template
  2. You can set it as an incident template, by selecting Settings > Monitor, and then expanding Alerts section and selecting Alert settings.
  3. Select the template name from the dropdown that you created in Step 1. The content of this file will be shown in the description section of the Slack modal.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #374966 (closed)

Edited by Rajendra Kadam

Merge request reports