Skip to content

Add notifications feature to Gitlab Slack Application integration

What does this MR do and why?

This MR is an iteration towards having the GitLab Slack Application integration capable of sending notifications to a Slack workspace.

In this iteration, we just allow for the display of new fields in the GitLab Slack Application integration form (toggled off by a feature flag). The posting of notifications to Slack is a no-op. #373321 (closed) will implement the next step of using the data in the form and posting an actual notification.

#372410 (closed)

How to set up and validate locally

The easiest way to preview these changes is to create data locally.

  1. Enable the feature
    Feature.enable(:integration_slack_app_notifications)
  2. On the rails console:
       project = Project.find_by_full_path(<project-full-path>)
    
       # Create a GitLab Slack Application integration
       integration = project.find_or_initialize_integration('gitlab_slack_application')
       integration.assign_attributes(active: true)
       integration.save!(context: :manual_change)
    
       # Create a mock SlackIntegration record, which normally happens when someone goes through the Slack
       # app installation flow, authorizing with their Slack workspace:
       SlackIntegration.create(integration: integration, team_id: 'foo', team_name: 'foo', alias: 'foo', user_id: 'foo')
  3. View the integration settings page Settings > Integrations > Gitlab Slack application, you should see the new fields.
  4. You should be able to edit and save the values in the form fields.
  5. Now click the red trash can icon to delete the SlackIntegration record (and in doing so, deactivate the integration).
  6. There should be no form fields.

Screenshots

Feature flag disabled Feature flag enabled
image image

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 #372410 (closed)

Edited by Luke Duncalfe

Merge request reports