Add services for create integration exclusions
What does this MR do and why?
Add services for create integration exclusions
For integrations at the instance level we have custom settings that can be configured at the group and project levels by project/group maintainers.
For instance specific integrations (e.g Beyond Identity) this change introduces a similar concept except the only difference in the custom setting is whether or not the integration is active such settings are only configurable by instance admins.
This commit introduces services to create and destroy such settings. Where destroying in this context is just using the same settings as the instance integration.
For context they will be used from here: !151965 (merged)
Query plans
From Integrations::Exclusions::CreateService
INSERT INTO "integrations" ("project_id",
"type_new",
"active",
"inherit_from_id",
"created_at",
"updated_at")
VALUES (278964,
'Integrations::BeyondIdentity',
FALSE,
NULL,
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP) ON CONFLICT ("project_id","type_new") DO
UPDATE
SET updated_at=(CASE
WHEN ("integrations"."active" IS NOT DISTINCT
FROM excluded."active"
AND "integrations"."inherit_from_id" IS NOT DISTINCT
FROM excluded."inherit_from_id") THEN "integrations".updated_at
ELSE CURRENT_TIMESTAMP
END),
"active"=excluded."active",
"inherit_from_id"=excluded."inherit_from_id" RETURNING "id"
From Integrations::Exclusions::DestroyService
SELECT "integrations".*
FROM "integrations"
WHERE "integrations"."type_new" = 'Integrations::BeyondIdentity'
AND "integrations"."project_id" = 278964
AND "integrations"."active" = FALSE
ORDER BY "integrations"."id" ASC LIMIT 1
SELECT "integrations".*
FROM "integrations"
WHERE "integrations"."type_new" = 'Integrations::BeyondIdentity'
AND "integrations"."instance" = TRUE
AND "integrations"."type_new" IN ('Integrations::Asana',
'Integrations::Assembla',
'Integrations::Bamboo',
'Integrations::BeyondIdentity',
'Integrations::Bugzilla',
'Integrations::Buildkite',
'Integrations::Campfire',
'Integrations::Clickup',
'Integrations::Confluence',
'Integrations::CustomIssueTracker',
'Integrations::Datadog',
'Integrations::DiffblueCover',
'Integrations::Discord',
'Integrations::DroneCi',
'Integrations::EmailsOnPush',
'Integrations::Ewm',
'Integrations::ExternalWiki',
'Integrations::GitGuardian',
'Integrations::HangoutsChat',
'Integrations::Harbor',
'Integrations::Irker',
'Integrations::Jira',
'Integrations::Mattermost',
'Integrations::MattermostSlashCommands',
'Integrations::MicrosoftTeams',
'Integrations::MockCi',
'Integrations::MockMonitoring',
'Integrations::Packagist',
'Integrations::Phorge',
'Integrations::PipelinesEmail',
'Integrations::Pivotaltracker',
'Integrations::Prometheus',
'Integrations::Pumble',
'Integrations::Pushover',
'Integrations::Redmine',
'Integrations::Slack',
'Integrations::SlackSlashCommands',
'Integrations::SquashTm',
'Integrations::Teamcity',
'Integrations::Telegram',
'Integrations::UnifyCircuit',
'Integrations::WebexTeams',
'Integrations::Youtrack',
'Integrations::Zentao')
ORDER BY "integrations"."id" ASC LIMIT 1
UPDATE
"integrations"
SET
"active" = TRUE,
"push_events" = TRUE,
"issues_events" = TRUE,
"merge_requests_events" = TRUE,
"tag_push_events" = TRUE,
"note_events" = TRUE,
"category" = 'common',
"wiki_page_events" = TRUE,
"pipeline_events" = TRUE,
"confidential_issues_events" = TRUE,
"commit_events" = TRUE,
"job_events" = TRUE,
"confidential_note_events" = TRUE,
"deployment_events" = FALSE,
"comment_on_event_enabled" = TRUE,
"comment_detail" = NULL,
"inherit_from_id" = 327,
"alert_events" = TRUE,
"type_new" = 'Integrations::BeyondIdentity',
"vulnerability_events" = FALSE,
"archive_trace_events" = FALSE,
"incident_events" = FALSE,
"group_mention_events" = FALSE,
"group_confidential_mention_events" = FALSE,
"encrypted_properties" = '\xdf5dd470cbf65d91d6accd0b2bbcc1e047d98bbea8fda2ffd3f063c28d5ab358543e231c34',
"encrypted_properties_iv" = '\x59d86a42fc56d98e768c1afa',
"updated_at" = '2024-05-03 16:36:10.802343'
WHERE
"integrations"."id" = 330
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #454372