-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set gitHostFactory for gitlab self hosted instances #4775
Conversation
@fgLouro is attempting to deploy a commit to the GitButler Team on Vercel. A member of the Team first needs to authorize it. |
e3808c0
to
76987e8
Compare
5946df9
to
8bff511
Compare
@@ -8,7 +8,8 @@ describe.concurrent('GitHubBranch', () => { | |||
const repo = { | |||
source: 'github.com', | |||
name: 'test-repo', | |||
owner: 'test-owner' | |||
owner: 'test-owner', | |||
resource: 'test-resource' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not add these unless necessary for the test to pass?
apps/desktop/src/lib/url/gitUrl.ts
Outdated
@@ -4,20 +4,22 @@ export type RepoInfo = { | |||
source: string; | |||
name: string; | |||
owner: string; | |||
resource: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And make this optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be misleading to use an optional attribute for the resource
?
The gitUrlParse
function seems to always return a resource
attribute when the url is valid, even if it's an empty 'resource' it's not undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I forgot what it represents, and sorry for the back and forth here. I think.. we should only have one field for url, instead of calling it source and resource. If you agree, would you mind creating a type and replacing the one we borrow from the parsing lib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Back and forth is how good software is made 😄
You mean removing the resource
and source
from the RepoInfo
type and have only a url
attribute which will be the value of resource
(the full url)?
I think the source
is only used in DefaultGitHostFactory
class, so should be easy to replace it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly! I would probably go with domain
over url
since it is likely to have additional things like scheme, path, etc. Also, my previous message was probably confusing because I forgot we have our own RepoInfo
type, I thought we were using the one returned from git-url-parse
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtsgrd Done!
Removed all references of source
and resource
in favour or using domain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A'ight, awesome. Let's ship it!
☕️ Reasoning
The
DefaultGitHostFactory
class assumes that gitlab domain is alwaysgitlab.com
, which is not correct for self hosted instances of gitlab, and leads to branch link buttons to be unusable.🧢 Changes
resource
toRepoInfo
type to be used for adding the correctbaseUrl
resource
for gitlab subdomain to initialize thegitHostFactory
with a Gitlab class🎫 Affected issues
Fixes: #4558 (comment)
Things to consider
Self hosted instance might not have
gitlab
in their subdomain, which will result in the same issue.