feat(ui): infer git provider for self-hosted deep links#5726
feat(ui): infer git provider for self-hosted deep links#5726singhvibhanshu wants to merge 1 commit intoakuity:mainfrom
Conversation
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5726 +/- ##
=======================================
Coverage 56.15% 56.15%
=======================================
Files 448 448
Lines 37661 37661
=======================================
Hits 21148 21148
Misses 15256 15256
Partials 1257 1257 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: singhvibhanshu <singhvibhanshu@hotmail.com>
1407d1c to
979816d
Compare
|
This is an improvement over what we started with, however, there is a more complete/robust implementation of this algorithm on the back end. I'm wondering if it makes sense for the API server to expose a small utility endpoint for constructing navigable commit URLs. I vaguely recall having had a conversation about this at some point in the past. We may not have. If we did, I don't remember the rationale that we landed on for not doing that. I'm wondering if @rpelczar or @Marvin9 knows why we're doing it this way. Was it that we need to do this often and the UI would be overly chatty with the API server? Regardless of the answers, front end is @rpelczar's and @Marvin9's domain. You guys decide what's best here and if you happen to prefer a back end endpoint for this, let me know. |
|
@rpelczar and I discussed this morning and he suggested using git-url-parse for this. It's actually in our Building out a utility endpoint in our API server to unify how the front end and back end parse and construct git URLs, that's something we'll defer to a later time, if we do it at all. |
|
I need to check but most probably that package won't detect anything outside of providers domain, what this PR is trying to achieve |
|
@Marvin9 |
|
@Marvin9 It covers custom domains. Just look at the test here: https://github.com/argoproj/argo-cd/blob/master/ui/src/app/shared/components/urls.test.ts |
Description
Fixes broken deep links for self-hosted and enterprise Git providers (e.g., GitLab Self-Managed, GitHub Enterprise).
Currently, the UI does an exact match on the domain (e.g.,
domain === 'github.com'), which fails for custom domains likegitlab.internal.net. This PR updatesgetGitCommitURLto handle these cases by checking if the hostname includes the provider keyword rather than requiring an exact match.Changes
gitlab,github,bitbucket) within custom domains to apply the correct URL formatting.gitlab.internal.netis detected as GitLab and gets the required/-/commit/path.git@...) into clickable HTTPS links.URLparsing for safer domain extraction.Verification
I verified this locally by spinning up a
tiltenvironment and creating a mock Freight pointing to a self-hosted GitLab instance (gitlab.internal.net).1. Logic Verification:

Console logs showing the utility correctly identifying providers from custom domains.
2. End-to-End UI Verification:
gitlab.internal.net.https://gitlab.internal.net/.../-/commit/..., confirming the GitLab-specific/-/segment was applied.Related Issue
Closes #5480