Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/codeowners-coverage-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2196,8 +2196,6 @@ tests/sentry/plugins/interfaces/__init__.py
tests/sentry/plugins/interfaces/test_releasehook.py
tests/sentry/plugins/sentry_useragents/__init__.py
tests/sentry/plugins/sentry_useragents/test_models.py
tests/sentry/plugins/sentry_webhooks/__init__.py
tests/sentry/plugins/sentry_webhooks/test_plugin.py
tests/sentry/plugins/test_config.py
tests/sentry/plugins/test_helpers.py
tests/sentry/plugins/test_integration_repository.py
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,6 @@ module = [
"sentry.plugins.sentry_interface_types.*",
"sentry.plugins.sentry_urls.*",
"sentry.plugins.sentry_useragents.*",
"sentry.plugins.sentry_webhooks.*",
"sentry.plugins.utils",
"sentry.processing.*",
"sentry.processing_errors.*",
Expand Down
1 change: 0 additions & 1 deletion src/sentry/conf/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ def env(
"sentry.plugins.sentry_interface_types.apps.Config",
"sentry.plugins.sentry_urls.apps.Config",
"sentry.plugins.sentry_useragents.apps.Config",
"sentry.plugins.sentry_webhooks.apps.Config",
"social_auth",
"sudo",
"sentry.eventstream",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
from sentry.sentry_apps.utils.errors import SentryAppBaseError
from sentry.utils import json
from sentry.workflow_engine.models.action import Action
from sentry.workflow_engine.processors.action import get_notification_plugins_for_org
from sentry.workflow_engine.processors.action import (
get_legacy_webhook_service,
get_notification_plugins_for_org,
)

from .types import BaseActionValidatorHandler

Expand Down Expand Up @@ -257,6 +260,9 @@ class WebhookActionValidatorHandler(BaseActionValidatorHandler):

def _get_services(self) -> list[Any]:
plugins = get_notification_plugins_for_org(self.organization)
legacy_webhook = get_legacy_webhook_service(self.organization)
if legacy_webhook and not any(p.slug == "webhooks" for p in plugins):
plugins.append(legacy_webhook)
sentry_apps = app_service.find_alertable_services(organization_id=self.organization.id)
return [
*plugins,
Expand Down
1 change: 0 additions & 1 deletion src/sentry/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"jira",
"pagerduty",
"opsgenie",
"webhooks",
"amazon-sqs",
"asana",
"trello",
Expand Down
Empty file.
12 changes: 0 additions & 12 deletions src/sentry/plugins/sentry_webhooks/apps.py

This file was deleted.

22 changes: 0 additions & 22 deletions src/sentry/plugins/sentry_webhooks/client.py

This file was deleted.

152 changes: 0 additions & 152 deletions src/sentry/plugins/sentry_webhooks/plugin.py

This file was deleted.

7 changes: 0 additions & 7 deletions src/sentry/rules/actions/notify_event.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from collections.abc import Generator, Sequence

from sentry import features
from sentry.plugins.base import plugins
from sentry.rules.actions.base import EventAction
from sentry.rules.actions.services import LegacyPluginService
Expand All @@ -20,16 +19,10 @@ class NotifyEventAction(EventAction):
def get_plugins(self) -> Sequence[LegacyPluginService]:
from sentry.plugins.bases.notify import NotificationPlugin

skip_webhooks = features.has(
"organizations:legacy-webhook-disable-old-path", self.project.organization
)

results = []
for plugin in plugins.for_project(self.project, version=1):
if not isinstance(plugin, NotificationPlugin):
continue
if skip_webhooks and plugin.slug == "webhooks":
continue
results.append(LegacyPluginService(plugin))

return results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from sentry.workflow_engine.processors.action import (
get_available_action_integrations_for_org,
get_integration_services,
get_legacy_webhook_service,
get_notification_plugins_for_org,
)
from sentry.workflow_engine.registry import action_handler_registry
Expand Down Expand Up @@ -142,9 +143,12 @@ def get(
)

# add webhook action
# service options include plugins and sentry apps without components
# service options include legacy webhooks, plugins, and sentry apps without components
elif action_type == Action.Type.WEBHOOK:
plugins = get_notification_plugins_for_org(organization)
legacy_webhook = get_legacy_webhook_service(organization)
if legacy_webhook and not any(p.slug == "webhooks" for p in plugins):
plugins.append(legacy_webhook)
sentry_apps: list[PluginService] = [
SentryAppService(context.installation.sentry_app)
for context in alertable_apps_without_components
Expand Down
24 changes: 24 additions & 0 deletions src/sentry/workflow_engine/processors/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from sentry.integrations.services.integration import RpcIntegration, integration_service
from sentry.integrations.types import IntegrationProviderSlug
from sentry.models.group import Group
from sentry.models.options.project_option import ProjectOption
from sentry.models.organization import Organization
from sentry.models.project import Project
from sentry.plugins.base import plugins
Expand Down Expand Up @@ -365,6 +366,29 @@ def get_notification_plugins_for_org(organization: Organization) -> list[PluginS
return list(plugin_map.values())


class _LegacyWebhookStub:
slug = "webhooks"

def get_title(self) -> str:
return "WebHooks"


def get_legacy_webhook_service(organization: Organization) -> PluginService | None:
"""
Check if any project in the org has legacy webhooks enabled and return a
service for ACI discovery. This is independent of the plugin system.
"""
has_webhooks = ProjectOption.objects.filter(
project__organization_id=organization.id,
project__status=ObjectStatus.ACTIVE,
key="webhooks:enabled",
value=True,
).exists()
if has_webhooks:
return PluginService(_LegacyWebhookStub())
return None


def get_integration_services(organization_id: int) -> dict[int, list[tuple[int, str]]]:
"""
Get all Pagerduty services and Opsgenie teams for an organization's integrations.
Expand Down
Empty file.
Loading
Loading