Skip to content

Commit 7727e3b

Browse files
authored
chore(github): remove all reinstall_id logic (#67782)
The last mention of `reinstall_id` in query parameters was removed in https://github.com/getsentry/sentry/pull/18740/files#diff-2400e6ada8288507a26e3a20012883a30eb2687a6803a4b9c1b182b6c953a9a4L90
1 parent fed05aa commit 7727e3b

File tree

4 files changed

+1
-56
lines changed

4 files changed

+1
-56
lines changed

src/sentry/integrations/github/integration.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,6 @@ def build_integration(self, state: Mapping[str, str]) -> Mapping[str, Any]:
342342
if state.get("sender"):
343343
integration["metadata"]["sender"] = state["sender"]
344344

345-
if state.get("reinstall_id"):
346-
integration["reinstall_id"] = state["reinstall_id"]
347-
348345
return integration
349346

350347
def setup(self) -> None:
@@ -361,9 +358,6 @@ def get_app_url(self) -> str:
361358
return f"https://github.com/apps/{slugify(name)}"
362359

363360
def dispatch(self, request: Request, pipeline: Pipeline) -> HttpResponse:
364-
if "reinstall_id" in request.GET:
365-
pipeline.bind_state("reinstall_id", request.GET["reinstall_id"])
366-
367361
if "installation_id" not in request.GET:
368362
return self.redirect(self.get_app_url())
369363

src/sentry/integrations/github_enterprise/integration.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,6 @@ def build_integration(self, state):
419419
"idp_config": state["oauth_config_information"],
420420
}
421421

422-
if state.get("reinstall_id"):
423-
integration["reinstall_id"] = state["reinstall_id"]
424-
425422
return integration
426423

427424
def setup(self):
@@ -442,8 +439,6 @@ def get_app_url(self, installation_data):
442439

443440
def dispatch(self, request: Request, pipeline) -> HttpResponse:
444441
installation_data = pipeline.fetch_state(key="installation_data")
445-
if "reinstall_id" in request.GET:
446-
pipeline.bind_state("reinstall_id", request.GET["reinstall_id"])
447442

448443
if "installation_id" in request.GET:
449444
pipeline.bind_state("installation_id", request.GET["installation_id"])

src/sentry/integrations/pipeline.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,7 @@ def finish_pipeline(self):
124124
return response
125125

126126
def _finish_pipeline(self, data):
127-
if "reinstall_id" in data:
128-
self.integration = Integration.objects.get(
129-
provider=self.provider.integration_key, id=data["reinstall_id"]
130-
)
131-
self.integration.update(external_id=data["external_id"], status=ObjectStatus.ACTIVE)
132-
self.integration.get_installation(self.organization.id).reinstall()
133-
elif "expect_exists" in data:
127+
if "expect_exists" in data:
134128
self.integration = Integration.objects.get(
135129
provider=self.provider.integration_key, external_id=data["external_id"]
136130
)

tests/sentry/integrations/github/test_integration.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -349,44 +349,6 @@ def test_installation_not_found(self):
349349
)
350350
assert b"The GitHub installation could not be found." in resp.content
351351

352-
@responses.activate
353-
def test_reinstall_flow(self):
354-
self._stub_github()
355-
self.assert_setup_flow()
356-
357-
integration = Integration.objects.get(provider=self.provider.key)
358-
integration.update(status=ObjectStatus.DISABLED)
359-
assert integration.status == ObjectStatus.DISABLED
360-
assert integration.external_id == self.installation_id
361-
362-
resp = self.client.get(
363-
"{}?{}".format(self.init_path, urlencode({"reinstall_id": integration.id}))
364-
)
365-
366-
assert resp.status_code == 302
367-
redirect = urlparse(resp["Location"])
368-
assert redirect.scheme == "https"
369-
assert redirect.netloc == "github.com"
370-
assert redirect.path == "/apps/sentry-test-app"
371-
372-
# New Installation
373-
self.installation_id = "install_2"
374-
375-
self._stub_github()
376-
377-
resp = self.client.get(
378-
"{}?{}".format(self.setup_path, urlencode({"installation_id": self.installation_id}))
379-
)
380-
381-
assert resp.status_code == 200
382-
383-
auth_header = responses.calls[0].request.headers["Authorization"]
384-
assert auth_header == "Bearer jwt_token_1"
385-
386-
integration = Integration.objects.get(provider=self.provider.key)
387-
assert integration.status == ObjectStatus.ACTIVE
388-
assert integration.external_id == self.installation_id
389-
390352
@responses.activate
391353
def test_disable_plugin_when_fully_migrated(self):
392354
self._stub_github()

0 commit comments

Comments
 (0)