Skip to content

Commit eddf585

Browse files
committed
Add GitHub domain checker component for integration guidance
1 parent ee6bf77 commit eddf585

File tree

3 files changed

+150
-10
lines changed

3 files changed

+150
-10
lines changed

docs/organization/integrations/source-code-mgmt/gitlab/index.mdx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
title: GitLab
33
sidebar_order: 1
4-
description: "Learn more about Sentrys GitLab integration and how it helps you track and resolve bugs faster by using data from your GitLab commits."
4+
description: "Learn more about Sentry's GitLab integration and how it helps you track and resolve bugs faster by using data from your GitLab commits."
55
---
66

7+
<GitHubDomainChecker />
8+
79
## Install
810

911
<Alert>
@@ -30,15 +32,15 @@ Sentry owner, manager, or admin permissions and GitLab owner or maintainer permi
3032

3133
![Connect Sentry to a GitLab instance](./img/add-installation.png)
3234

33-
1. In the pop-up window, complete the instructions to create a Sentry app within GitLab. Once youre finished, click "Next".
35+
1. In the pop-up window, complete the instructions to create a Sentry app within GitLab. Once you're finished, click "Next".
3436

3537
![Configuration modal and Sentry app within GitLab](./img/configuration-modal.png)
3638

3739
1. Fill out the resulting GitLab Configuration form with the following information:
3840

3941
1. The GitLab URL is the base URL for your GitLab instance. If using gitlab.com, enter https://gitlab.com/.
4042

41-
2. Find the GitLab Group Path in your groups GitLab page. Groups might contain subgroups and projects. You should not specify the URL to any specific project, just to a group or subgroup.
43+
2. Find the GitLab Group Path in your group's GitLab page. Groups might contain subgroups and projects. You should not specify the URL to any specific project, just to a group or subgroup.
4244

4345
![GitLab page showing group path](./img/gitlab-groups.png)
4446

@@ -52,13 +54,13 @@ Sentry owner, manager, or admin permissions and GitLab owner or maintainer permi
5254

5355
1. In the resulting panel, click "Authorize".
5456

55-
1. In Sentry, return to Organization Settings > **Integrations**. Youll see a new instance of GitLab underneath the list of integrations.
57+
1. In Sentry, return to Organization Settings > **Integrations**. You'll see a new instance of GitLab underneath the list of integrations.
5658

57-
1. Next to your GitLab Instance, click "Configure". _Its important to configure to receive the full benefits of commit tracking._
59+
1. Next to your GitLab Instance, click "Configure". _It's important to configure to receive the full benefits of commit tracking._
5860

5961
![GitLab instance with connected group and highlighted configure button](./img/configure-button.png)
6062

61-
1. On the resulting page, click "Add Repository" to select which repositories in which youd like to begin tracking commits.
63+
1. On the resulting page, click "Add Repository" to select which repositories in which you'd like to begin tracking commits.
6264

6365
![Add repository](./img/add-repo.png)
6466

@@ -157,7 +159,7 @@ For certain native platforms, the stack trace will look different. In cases like
157159

158160
![Highlighting where in the UI to find the file path for native stack traces](./img/code-mappings-stacktrace-native.png)
159161

160-
If you arent sure, you can look at the event JSON by clicking on the `{}` button in the event header. Find the text in the frame's `filename` or `abs_path`.
162+
If you aren't sure, you can look at the event JSON by clicking on the `{}` button in the event header. Find the text in the frame's `filename` or `abs_path`.
161163

162164
<Include name="common-imgs/code-mappings-event-json" />
163165

@@ -220,11 +222,11 @@ For more details, see the full documentation for [Code Owners](/product/issues/o
220222

221223
- Why am I getting a `500` response during installation or configuration?
222224

223-
- First, make sure youve allowed our IPs, which can be found [here](/security-legal-pii/security/ip-ranges/). The 500 response is coming from GitLab, so you may need to try again or double-check that your settings and permissions are correct in GitLab. You must have both owner/manager/admin permissions in Sentry as well as owner permissions in GitLab to successfully install this integration.
225+
- First, make sure you've allowed our IPs, which can be found [here](/security-legal-pii/security/ip-ranges/). The 500 response is coming from GitLab, so you may need to try again or double-check that your settings and permissions are correct in GitLab. You must have both owner/manager/admin permissions in Sentry as well as owner permissions in GitLab to successfully install this integration.
224226

225227
- Why am I seeing an "Invalid Repository Names" error?
226228

227-
- GitLab takes into account the whitespace before and after the `/` . On the Repositories page (Organization Settings > Repositories), youll notice a space (for example, "Owner / Repo" as opposed to "Owner/Repo"), which will need to be included in any command youre running. If you are using GitLabs [environment variables](https://docs.gitlab.com/ee/ci/variables/#debug-tracing) to pass the repository as `CI_PROJECT_PATH` in a cURL request for example, it may not include the spaces and youll need to hardcode the name in order for it to work.
229+
- GitLab takes into account the whitespace before and after the `/` . On the Repositories page (Organization Settings > Repositories), you'll notice a space (for example, "Owner / Repo" as opposed to "Owner/Repo"), which will need to be included in any command you're running. If you are using GitLab's [environment variables](https://docs.gitlab.com/ee/ci/variables/#debug-tracing) to pass the repository as `CI_PROJECT_PATH` in a cURL request for example, it may not include the spaces and you'll need to hardcode the name in order for it to work.
228230

229231
- Why am I always the reporter?
230-
- When using the GitLab integration to create issues, the reporter field is populated as the person who set up the integration by default — this is not configurable.
232+
- When using the GitLab integration to create issues, the "reporter" field is populated as the person who set up the integration by default — this is not configurable.
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
'use client';
2+
3+
import {useState, type KeyboardEvent} from 'react';
4+
import {Button} from '@radix-ui/themes';
5+
6+
const MAX_COMPONENTS_ON_PAGE = 100;
7+
8+
export function GitHubDomainChecker() {
9+
const [domain, setDomain] = useState('');
10+
const [result, setResult] = useState<{
11+
type: 'github' | 'enterprise' | null;
12+
message: string;
13+
}>({type: null, message: ''});
14+
15+
const checkDomain = () => {
16+
if (!domain.trim()) {
17+
setResult({type: null, message: 'Please enter a domain'});
18+
return;
19+
}
20+
21+
const cleanDomain = domain.trim().toLowerCase();
22+
23+
// Remove protocol if present
24+
const domainWithoutProtocol = cleanDomain.replace(/^https?:\/\//, '');
25+
26+
// Remove trailing slash and path
27+
const baseDomain = domainWithoutProtocol.split('/')[0];
28+
29+
if (baseDomain === 'github.com' || baseDomain === 'www.github.com') {
30+
setResult({
31+
type: 'github',
32+
message: 'You should use the regular GitHub integration. This is GitHub.com, the public GitHub service.',
33+
});
34+
} else if (baseDomain.includes('github')) {
35+
setResult({
36+
type: 'enterprise',
37+
message: 'You should use GitHub Enterprise integration. This appears to be a GitHub Enterprise Server instance.',
38+
});
39+
} else {
40+
setResult({
41+
type: 'enterprise',
42+
message: 'You should use GitHub Enterprise integration. This appears to be a custom GitHub Enterprise Server domain.',
43+
});
44+
}
45+
};
46+
47+
const handleKeyPress = (e: KeyboardEvent<HTMLInputElement>) => {
48+
if (e.key === 'Enter') {
49+
checkDomain();
50+
}
51+
};
52+
53+
const inputClassName =
54+
'form-input w-full rounded-md border-[1.5px] focus:ring-2 focus:ring-accent-purple/20 border-gray-200';
55+
56+
// This is to avoid conflicts in case multiple instances of this component are used on the page
57+
const randomCounter = Math.round(Math.random() * MAX_COMPONENTS_ON_PAGE);
58+
59+
return (
60+
<div className="space-y-4 p-6 border border-gray-100 rounded bg-gray-50">
61+
<div>
62+
<h3 className="text-lg font-medium mb-2">GitHub Domain Checker</h3>
63+
<p className="text-sm text-gray-600 mb-4">
64+
Enter your GitHub domain below to determine whether you should use the GitHub or GitHub Enterprise integration.
65+
</p>
66+
</div>
67+
68+
<div className="flex w-full gap-2">
69+
<div className="flex-1">
70+
<label htmlFor={`github-domain-${randomCounter}`} className="sr-only">
71+
GitHub Domain
72+
</label>
73+
<input
74+
id={`github-domain-${randomCounter}`}
75+
type="text"
76+
value={domain}
77+
placeholder="e.g., github.com or github.yourcompany.com"
78+
className={inputClassName}
79+
onChange={ev => setDomain(ev.target.value)}
80+
onKeyPress={handleKeyPress}
81+
/>
82+
</div>
83+
<Button
84+
type="button"
85+
size="3"
86+
onClick={checkDomain}
87+
className="rounded-md"
88+
>
89+
Check Domain
90+
</Button>
91+
</div>
92+
93+
{result.message && (
94+
<div className={`p-4 rounded-md ${
95+
result.type === 'github'
96+
? 'bg-green-50 border border-green-200'
97+
: result.type === 'enterprise'
98+
? 'bg-blue-50 border border-blue-200'
99+
: 'bg-yellow-50 border border-yellow-200'
100+
}`}>
101+
<div className="flex items-start">
102+
<div className={`flex-shrink-0 w-5 h-5 rounded-full mr-3 mt-0.5 ${
103+
result.type === 'github'
104+
? 'bg-green-500'
105+
: result.type === 'enterprise'
106+
? 'bg-blue-500'
107+
: 'bg-yellow-500'
108+
}`} />
109+
<div>
110+
<p className={`font-medium ${
111+
result.type === 'github'
112+
? 'text-green-800'
113+
: result.type === 'enterprise'
114+
? 'text-blue-800'
115+
: 'text-yellow-800'
116+
}`}>
117+
{result.type === 'github' ? 'Use GitHub Integration' :
118+
result.type === 'enterprise' ? 'Use GitHub Enterprise Integration' :
119+
'Domain Check'}
120+
</p>
121+
<p className={`text-sm mt-1 ${
122+
result.type === 'github'
123+
? 'text-green-700'
124+
: result.type === 'enterprise'
125+
? 'text-blue-700'
126+
: 'text-yellow-700'
127+
}`}>
128+
{result.message}
129+
</p>
130+
</div>
131+
</div>
132+
</div>
133+
)}
134+
</div>
135+
);
136+
}

src/mdxComponents.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {DefinitionList} from './components/definitionList';
1313
import {DevDocsCardGrid} from './components/devDocsCardGrid';
1414
import DocImage from './components/docImage';
1515
import {Expandable} from './components/expandable';
16+
import {GitHubDomainChecker} from './components/githubDomainChecker';
1617
import {GuideGrid} from './components/guideGrid';
1718
import {JsBundleList} from './components/jsBundleList';
1819
import {LambdaLayerDetail} from './components/lambdaLayerDetail';
@@ -63,6 +64,7 @@ export function mdxComponents(
6364
ConfigValue,
6465
DefinitionList,
6566
Expandable,
67+
GitHubDomainChecker,
6668
GuideGrid,
6769
JsBundleList,
6870
LambdaLayerDetail,

0 commit comments

Comments
 (0)