From ce58800b36d5f2c96f9e788ea082ac60b58ac83d Mon Sep 17 00:00:00 2001 From: Julia McGhee Date: Sat, 21 Mar 2026 22:15:18 +0000 Subject: [PATCH] Fix Gitea repo search: correct service name and add UI support - GITEA_URL was pointing to gitea.platform.svc but the Helm chart names the HTTP service gitea-helm-http.platform.svc - Add Gitea badge (GT, green) to repo search results UI - Update placeholder and credential hint to mention Gitea - Rewrite internal service URLs to external gitea.coreworlds.io in search results so agents can clone from outside the cluster - Add error logging to diagnose search failures --- apps/harness/k8s/base/deployment.yaml | 2 +- .../src/components/harness-dashboard.tsx | 12 ++++++------ apps/harness/src/lib/repo-search.ts | 17 +++++++++++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/apps/harness/k8s/base/deployment.yaml b/apps/harness/k8s/base/deployment.yaml index 6006b73..ab13e9c 100644 --- a/apps/harness/k8s/base/deployment.yaml +++ b/apps/harness/k8s/base/deployment.yaml @@ -40,7 +40,7 @@ spec: name: harness-mcp-credentials key: gitea-token - name: GITEA_URL - value: "http://gitea.platform.svc:3000" + value: "http://gitea-helm-http.platform.svc:3000" - name: HARNESS_PG_MCP_URL valueFrom: secretKeyRef: diff --git a/apps/harness/src/components/harness-dashboard.tsx b/apps/harness/src/components/harness-dashboard.tsx index 4cdab6a..5b26890 100644 --- a/apps/harness/src/components/harness-dashboard.tsx +++ b/apps/harness/src/components/harness-dashboard.tsx @@ -660,7 +660,7 @@ function RepoSearch({ onSelect, mobile }: { return (
No git credentials configured. - Add GitHub or GitLab tokens in the credentials section below to search repositories. + Add GitHub, GitLab, or Gitea tokens in the credentials section below to search repositories.
); } @@ -670,7 +670,7 @@ function RepoSearch({ onSelect, mobile }: { setQuery(e.target.value)} - placeholder="Search GitHub / GitLab repos..." + placeholder="Search GitHub / GitLab / Gitea repos..." /> {loading && Searching...} {results.length > 0 && ( @@ -689,11 +689,11 @@ function RepoSearch({ onSelect, mobile }: { - {repo.provider === "github" ? "GH" : "GL"} + {repo.provider === "github" ? "GH" : repo.provider === "gitea" ? "GT" : "GL"} {repo.fullName} {repo.private && ( diff --git a/apps/harness/src/lib/repo-search.ts b/apps/harness/src/lib/repo-search.ts index 3717568..f084972 100644 --- a/apps/harness/src/lib/repo-search.ts +++ b/apps/harness/src/lib/repo-search.ts @@ -118,21 +118,30 @@ async function searchGitea(query: string): Promise { } ); - if (!res.ok) continue; + if (!res.ok) { + console.error(`[repo-search] Gitea search failed: ${res.status} ${res.statusText}`); + continue; + } const data = await res.json(); + // Rewrite internal service URLs to external Gitea URL + const externalUrl = process.env.GITEA_EXTERNAL_URL || "https://gitea.coreworlds.io"; for (const repo of data.data || []) { + let htmlUrl: string = repo.html_url || ""; + if (baseUrl !== externalUrl && htmlUrl.startsWith(baseUrl)) { + htmlUrl = externalUrl + htmlUrl.slice(baseUrl.length); + } results.push({ provider: "gitea", fullName: repo.full_name, - url: repo.html_url, + url: htmlUrl, description: repo.description || "", defaultBranch: repo.default_branch || "main", private: repo.private, }); } - } catch { - // skip failed credential + } catch (err) { + console.error(`[repo-search] Gitea search error:`, err); } }