Skip to content

feat(ui): infer git provider for self-hosted deep links#5726

Open
singhvibhanshu wants to merge 1 commit intoakuity:mainfrom
singhvibhanshu:deep-links
Open

feat(ui): infer git provider for self-hosted deep links#5726
singhvibhanshu wants to merge 1 commit intoakuity:mainfrom
singhvibhanshu:deep-links

Conversation

@singhvibhanshu
Copy link
Contributor

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 like gitlab.internal.net. This PR updates getGitCommitURL to handle these cases by checking if the hostname includes the provider keyword rather than requiring an exact match.

Changes

  • Inference Logic: The utility now detects provider keywords (e.g., gitlab, github, bitbucket) within custom domains to apply the correct URL formatting.
    • Example: gitlab.internal.net is detected as GitLab and gets the required /-/commit/ path.
  • SSH Support: Added logic to normalize SSH remote URLs (git@...) into clickable HTTPS links.
  • Refactor: Switched to URL parsing for safer domain extraction.

Verification

I verified this locally by spinning up a tilt environment 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.
Screenshot from 2026-02-11 15-13-15

2. End-to-End UI Verification:

  • Created a mock Freight pointing to gitlab.internal.net.
  • Clicking the commit hash successfully navigated to https://gitlab.internal.net/.../-/commit/..., confirming the GitLab-specific /-/ segment was applied.
sa

Related Issue

Closes #5480

@singhvibhanshu singhvibhanshu requested a review from a team as a code owner February 11, 2026 10:37
@netlify
Copy link

netlify bot commented Feb 11, 2026

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit 979816d
🔍 Latest deploy log https://app.netlify.com/projects/docs-kargo-io/deploys/698c5ec8fe8e3d00088f0cce
😎 Deploy Preview https://deploy-preview-5726.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.15%. Comparing base (8cd1282) to head (979816d).
⚠️ Report is 3 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: singhvibhanshu <singhvibhanshu@hotmail.com>
@krancour
Copy link
Member

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.

@Marvin9
Copy link
Contributor

Marvin9 commented Feb 13, 2026

@krancour I don't recall that discussion maybe @rpelczar can. But that should be ideal situation, only if url construction is user provided. Thats for the reason we can't just guess based on the fact that url contains "github" or "gitlab" word

@krancour krancour added kind/enhancement An entirely new feature area/ui Affects the UI priority/normal This is the priority for most work labels Feb 14, 2026
@krancour krancour added this to the v1.10.0 milestone Feb 14, 2026
@krancour
Copy link
Member

@rpelczar and I discussed this morning and he suggested using git-url-parse for this. It's actually in our package.json already, but seems not to be used anywhere yet.

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.

@Marvin9
Copy link
Contributor

Marvin9 commented Feb 16, 2026

I need to check but most probably that package won't detect anything outside of providers domain, what this PR is trying to achieve

@singhvibhanshu
Copy link
Contributor Author

@Marvin9
I believe that standard parsers typically rely on the hardcoded list of known domains to determine provider type...
Parser will generally consider gitlab.internal.net as a generic Git server and will probably fails to apply provider specific formatting.
This PR ensures to detect the provider even when the custom domain is being used, ensuring the generation of correct deep links

@rpelczar
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ui Affects the UI kind/enhancement An entirely new feature priority/normal This is the priority for most work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deep links to self-hosted github/gitlab should work automatically through inference

4 participants