diff --git a/app/helpers/integrations_helper.rb b/app/helpers/integrations_helper.rb index 5dc8ba54ca8100c227ba0e9be5ecac8fc935b56f..a88be976337fb9c71aa593adbea77b740a511f80 100644 --- a/app/helpers/integrations_helper.rb +++ b/app/helpers/integrations_helper.rb @@ -277,11 +277,11 @@ def default_integration_event_description(event) s_("ProjectService|Trigger event for new comments.") when "confidential_note", "confidential_note_events" s_("ProjectService|Trigger event for new comments on confidential issues.") - when "issue", "issue_events" + when "issue", "issue_events", "issues_events" s_("ProjectService|Trigger event when an issue is created, updated, or closed.") - when "confidential_issue", "confidential_issue_events" + when "confidential_issue", "confidential_issue_events", "confidential_issues_events" s_("ProjectService|Trigger event when a confidential issue is created, updated, or closed.") - when "merge_request", "merge_request_events" + when "merge_request", "merge_request_events", "merge_requests_events" s_("ProjectService|Trigger event when a merge request is created, updated, or merged.") when "pipeline", "pipeline_events" s_("ProjectService|Trigger event when a pipeline status changes.") @@ -289,16 +289,20 @@ def default_integration_event_description(event) s_("ProjectService|Trigger event when a wiki page is created or updated.") when "commit", "commit_events" s_("ProjectService|Trigger event when a commit is created or updated.") - when "deployment" + when "deployment", "deployment_events" s_("ProjectService|Trigger event when a deployment starts or finishes.") - when "alert" + when "alert", "alert_events" s_("ProjectService|Trigger event when a new, unique alert is recorded.") - when "incident" + when "incident", "incident_events" s_("ProjectService|Trigger event when an incident is created.") when "group_mention" s_("ProjectService|Trigger event when a group is mentioned in a public context.") when "group_confidential_mention" s_("ProjectService|Trigger event when a group is mentioned in a confidential context.") + when "build_events" + s_("ProjectService|Trigger event when a build is created.") + when "archive_trace_events" + s_('When enabled, job logs are collected by Datadog and displayed along with pipeline execution traces.') end end # rubocop:enable Metrics/CyclomaticComplexity diff --git a/app/models/integrations/base_slack_notification.rb b/app/models/integrations/base_slack_notification.rb index 38f3498c81b4373ea50b55125dab6782d27e8dee..65aec8b278fe30e281db9d67c968cf93a97b24ad 100644 --- a/app/models/integrations/base_slack_notification.rb +++ b/app/models/integrations/base_slack_notification.rb @@ -25,12 +25,15 @@ def get_message(object_kind, data) override :supported_events def supported_events - additional = %w[alert] - additional += %w[group_mention group_confidential_mention] if group_level? + additional = group_level? ? %w[group_mention group_confidential_mention] : [] (super + additional).freeze end + def self.supported_events + super + %w[alert] + end + override :configurable_channels? def configurable_channels? true diff --git a/ee/lib/ee/api/helpers/integrations_helpers.rb b/ee/lib/ee/api/helpers/integrations_helpers.rb index ab19cd7977f3e086aec8faf4b1e44c6c39a748db..1190e372067d9962b75ccaf34e1f8a071e7b47ea 100644 --- a/ee/lib/ee/api/helpers/integrations_helpers.rb +++ b/ee/lib/ee/api/helpers/integrations_helpers.rb @@ -55,19 +55,6 @@ def chat_notification_channels } ].freeze end - - override :chat_notification_events - def chat_notification_events - [ - *super, - { - required: false, - name: :vulnerability_events, - type: ::API::Integrations::Boolean, - desc: 'Enable notifications for vulnerability_events' - } - ].freeze - end end end end diff --git a/lib/api/helpers/integrations_helpers.rb b/lib/api/helpers/integrations_helpers.rb index c1290c1e29390a1ff9e14c2756151fc36fd3659e..8f846fe7348271807e193ff1e85cbc4153c6c25f 100644 --- a/lib/api/helpers/integrations_helpers.rb +++ b/lib/api/helpers/integrations_helpers.rb @@ -124,95 +124,6 @@ def self.chat_notification_channels ].freeze end - def self.chat_notification_events - [ - { - required: false, - name: :commit_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for commit_events' - }, - { - required: false, - name: :push_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for push_events' - }, - { - required: false, - name: :issues_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for issues_events' - }, - { - required: false, - name: :incident_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for incident_events' - }, - { - required: false, - name: :alert_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for alert_events' - }, - { - required: false, - name: :confidential_issues_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for confidential_issues_events' - }, - { - required: false, - name: :merge_requests_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for merge_requests_events' - }, - { - required: false, - name: :note_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for note_events' - }, - { - required: false, - name: :confidential_note_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for confidential_note_events' - }, - { - required: false, - name: :tag_push_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for tag_push_events' - }, - { - required: false, - name: :deployment_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for deployment_events' - }, - { - required: false, - name: :job_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for job_events' - }, - { - required: false, - name: :pipeline_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for pipeline_events' - }, - { - required: false, - name: :wiki_page_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for wiki_page_events' - } - ].freeze - end - def self.integrations { 'apple-app-store' => [ @@ -453,7 +364,6 @@ def self.integrations desc: 'Branches for which notifications are to be sent' }, chat_notification_flags, - chat_notification_events, chat_notification_channels ].flatten, 'drone-ci' => [ @@ -548,8 +458,7 @@ def self.integrations name: :branches_to_be_notified, type: String, desc: 'Branches for which notifications are to be sent' - }, - chat_notification_events + } ].flatten, 'harbor' => [ { @@ -813,8 +722,7 @@ def self.integrations name: :webhook, type: String, desc: 'The Pumble chat webhook. For example, https://api.pumble.com/workspaces/x/...' - }, - chat_notification_events + } ].flatten, 'pushover' => [ { @@ -919,8 +827,7 @@ def self.integrations 'slack' => [ chat_notification_settings, chat_notification_flags, - chat_notification_channels, - chat_notification_events + chat_notification_channels ].flatten, 'microsoft-teams' => [ { @@ -940,8 +847,7 @@ def self.integrations 'mattermost' => [ chat_notification_settings, chat_notification_flags, - chat_notification_channels, - chat_notification_events + chat_notification_channels ].flatten, 'teamcity' => [ { @@ -988,8 +894,7 @@ def self.integrations type: String, desc: 'Unique identifier for the target chat or username of the target channel (in the format @channelusername)' }, - chat_notification_flags, - chat_notification_events + chat_notification_flags ].flatten, 'unify-circuit' => [ { @@ -997,8 +902,7 @@ def self.integrations name: :webhook, type: String, desc: 'The Unify Circuit webhook. e.g. https://circuit.com/rest/v2/webhooks/incoming/…' - }, - chat_notification_events + } ].flatten, 'webex-teams' => [ { @@ -1006,8 +910,7 @@ def self.integrations name: :webhook, type: String, desc: 'The Webex Teams webhook. For example, https://api.ciscospark.com/v1/webhooks/incoming/...' - }, - chat_notification_events + } ].flatten, 'zentao' => [ { @@ -1083,12 +986,17 @@ def self.integration_classes ::Integrations::PipelinesEmail, ::Integrations::Pivotaltracker, ::Integrations::Prometheus, + ::Integrations::Pumble, ::Integrations::Pushover, ::Integrations::Redmine, + ::Integrations::Shimo, ::Integrations::Slack, ::Integrations::SlackSlashCommands, ::Integrations::SquashTm, ::Integrations::Teamcity, + ::Integrations::Telegram, + ::Integrations::UnifyCircuit, + ::Integrations::WebexTeams, ::Integrations::Youtrack, ::Integrations::Zentao ] diff --git a/lib/api/integrations.rb b/lib/api/integrations.rb index 3ec0a723808a566bd07b1e740d08cea89e0b9358..a73e34f54a38bf6a311ac9879751717662b1dd01 100644 --- a/lib/api/integrations.rb +++ b/lib/api/integrations.rb @@ -31,7 +31,7 @@ class Integrations < ::API::Base INTEGRATIONS[integration.to_param.tr("_", "-")] << { required: false, name: event_name.to_sym, - type: String, + type: ::Grape::API::Boolean, desc: IntegrationsHelper.integration_event_description(integration, event_name) } end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 840af45c1fbdc85b2311926be4554b10a66b052a..a4c9567a2c4607f2da1073ccd747d4b294da6ab4 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -36791,6 +36791,9 @@ msgstr "" msgid "ProjectService|Trigger event for pushes to the repository." msgstr "" +msgid "ProjectService|Trigger event when a build is created." +msgstr "" + msgid "ProjectService|Trigger event when a commit is created or updated." msgstr ""