Commit 8936d625 authored by Sven Groot's avatar Sven Groot

Add feature flag for deployment notifications

parent 8720f46a
......@@ -241,6 +241,7 @@ module Integrations
def notify_for_ref?(data)
return true if data[:object_kind] == 'tag_push'
return true if data[:object_kind] == 'deployment' && !Feature.enabled?(:chat_notification_deployment_protected_branch_filter, project)
ref = data[:ref] || data.dig(:object_attributes, :ref)
return true if ref.blank? # No need to check protected branches when there is no ref
......
---
name: chat_notification_deployment_protected_branch_filter
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74423
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/349131
milestone: '14.7'
type: development
group: group::integrations
default_enabled: false
......@@ -693,6 +693,16 @@ RSpec.shared_examples Integrations::SlackMattermostNotifier do |service_name|
context 'notification enabled for all branches' do
it_behaves_like "triggered #{service_name} service", event_type: "pipeline", branches_to_be_notified: "all"
end
context 'when chat_notification_deployment_protected_branch_filter is disabled' do
before do
stub_feature_flags(chat_notification_deployment_protected_branch_filter: false)
end
context 'notification enabled only for default branch' do
it_behaves_like "triggered #{service_name} service", event_type: "pipeline", branches_to_be_notified: "default"
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment