Skip to content

feat(github-enterprise): Add API-driven pipeline backend for GHE integration setup#114366

Merged
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/feat-github-enterprise-add-api-driven-pipeline-backend-for-ghe-integration-setup
May 26, 2026
Merged

feat(github-enterprise): Add API-driven pipeline backend for GHE integration setup#114366
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/feat-github-enterprise-add-api-driven-pipeline-backend-for-ghe-integration-setup

Conversation

@evanpurkhiser
Copy link
Copy Markdown
Member

Implement get_pipeline_api_steps() on GitHubEnterpriseIntegrationProvider with three steps: installation config (URL, app credentials, keys), app install redirect (popup-based GitHub app installation with polling), and a late-bound OAuth step constructed from the config step's data. Includes serializers for each step and updates build_integration() to handle both legacy and API state paths.

Ref VDY-40

@evanpurkhiser evanpurkhiser requested review from a team as code owners April 29, 2026 20:48
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Apr 29, 2026

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 29, 2026
@evanpurkhiser evanpurkhiser marked this pull request as draft April 29, 2026 20:49
Comment thread src/sentry/integrations/github_enterprise/integration.py
Comment thread src/sentry/integrations/github_enterprise/integration.py Outdated
@getsantry
Copy link
Copy Markdown
Contributor

getsantry Bot commented May 21, 2026

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry Bot added the Stale label May 21, 2026
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-github-enterprise-add-api-driven-pipeline-backend-for-ghe-integration-setup branch from a0cb2a8 to 0ead907 Compare May 21, 2026 17:37
Comment thread src/sentry/integrations/github_enterprise/integration.py
@getsantry getsantry Bot removed the Stale label May 22, 2026
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-github-enterprise-add-api-driven-pipeline-backend-for-ghe-integration-setup branch from 0ead907 to 4b21e39 Compare May 26, 2026 15:37
@evanpurkhiser evanpurkhiser marked this pull request as ready for review May 26, 2026 15:58
Comment thread src/sentry/integrations/github_enterprise/integration.py Outdated
Comment thread src/sentry/integrations/github_enterprise/integration.py Outdated
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-github-enterprise-add-api-driven-pipeline-backend-for-ghe-integration-setup branch from 4b21e39 to 1726074 Compare May 26, 2026 18:44
Comment thread src/sentry/integrations/github_enterprise/integration.py Outdated
Comment thread src/sentry/integrations/github_enterprise/integration.py
Comment thread src/sentry/integrations/github_enterprise/integration.py Outdated
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-github-enterprise-add-api-driven-pipeline-backend-for-ghe-integration-setup branch 3 times, most recently from 6c1a048 to f5d0fc3 Compare May 26, 2026 19:08
url = URLField(required=True)
id = CharField(required=True)
name = CharField(required=True)
public_link = URLField(required=False, allow_blank=True, default="")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The new GHEInstallationConfigSerializer uses URLField, which requires a URL scheme. This is a regression from the old form that accepted URLs without a scheme like github.example.com.
Severity: MEDIUM

Suggested Fix

Modify the GHEInstallationConfigSerializer to handle URLs without a scheme, similar to the old form-based logic. This could involve using a custom field or overriding the validate_url method to prepend https:// if a scheme is missing before validation. This would restore the previous, more user-friendly behavior.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/sentry/integrations/github_enterprise/integration.py#L565

Potential issue: The new API endpoint for configuring GitHub Enterprise integrations,
which uses `GHEInstallationConfigSerializer`, now requires the URL to include a scheme
(e.g., `https://`). This is because it uses `rest_framework.fields.URLField` for
validation. The previous form-based implementation was more lenient, using
`forms.CharField` and custom logic to handle URLs submitted without a scheme, such as
`github.example.com`. This change introduces a regression where users may encounter
unexpected validation errors for input that was previously accepted.

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f5d0fc3. Configure here.

pipeline: IntegrationPipeline,
request: HttpRequest,
) -> PipelineStepResult:
validated_data["url"] = urlparse(validated_data["url"]).netloc.lower()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API URL host normalization mismatch

Medium Severity

The GHEInstallationConfigApiStep incorrectly parses installation URLs when the hostname is in the path (e.g., example.com instead of https://example.com). This results in an empty host, leading to malformed OAuth URLs and bypassing the github.com feature gate.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f5d0fc3. Configure here.

Comment thread src/sentry/integrations/github_enterprise/integration.py
…gration setup

Implement `get_pipeline_api_steps()` on `GitHubEnterpriseIntegrationProvider`
with three steps: installation config (URL, app credentials, keys),
app install redirect (popup-based GitHub app installation with polling),
and a late-bound OAuth step constructed from the config step's data.
Includes serializers for each step and updates `build_integration()` to
handle both legacy and API state paths.

Ref [VDY-40](https://linear.app/getsentry/issue/VDY-40/github-enterprise-api-driven-integration-setup)
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-github-enterprise-add-api-driven-pipeline-backend-for-ghe-integration-setup branch from f5d0fc3 to 5c9c3ba Compare May 26, 2026 19:23
@evanpurkhiser evanpurkhiser enabled auto-merge (squash) May 26, 2026 19:36
@evanpurkhiser evanpurkhiser merged commit cd5e6c0 into master May 26, 2026
62 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/feat-github-enterprise-add-api-driven-pipeline-backend-for-ghe-integration-setup branch May 26, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants