Skip to content

Commit 4f29506

Browse files
committed
chore(integrations): Gate disabling repositories behind a separate flag
Being cautious with this auto sync work and gating a potentially destructive operation behind a deletion flag.
1 parent 4ad63e2 commit 4f29506

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/sentry/features/temporary.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def register_temporary_features(manager: FeatureManager) -> None:
149149
manager.add("organizations:github-repo-auto-sync", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
150150
manager.add("organizations:github-repo-auto-sync-apply", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
151151
manager.add("organizations:github-repo-auto-sync-webhook", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
152+
manager.add("organizations:scm-repo-auto-sync-removal", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
152153
manager.add("organizations:github_enterprise-repo-auto-sync", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
153154
manager.add("organizations:github_enterprise-repo-auto-sync-apply", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
154155
manager.add("organizations:gitlab-repo-auto-sync", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)

src/sentry/integrations/github/tasks/sync_repos_on_install_change.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _sync_repos_for_org(
140140
provider=integration.provider,
141141
)
142142

143-
if repos_removed:
143+
if repos_removed and features.has("organizations:scm-repo-auto-sync-removal", rpc_org):
144144
# Look up repos before disabling to get their IDs and names
145145
external_ids = [str(repo["id"]) for repo in repos_removed]
146146
existing_repos = repository_service.get_repositories(

src/sentry/integrations/source_code_management/sync_repos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def sync_repos_for_org(organization_integration_id: int) -> None:
247247
provider=provider_key,
248248
)
249249

250-
if removed_ids:
250+
if removed_ids and _has_feature("organizations:scm-repo-auto-sync-removal", rpc_org):
251251
repository_service.disable_repositories_by_external_ids(
252252
organization_id=organization_id,
253253
integration_id=integration.id,

0 commit comments

Comments
 (0)