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
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -660,7 +660,7 @@ function RepoSearch({ onSelect, mobile }: {
|
||||
return (
|
||||
<div style={{ background: tokens.color.bg2, border: `1px solid ${tokens.color.warnDim}`, padding: tokens.space[3], display: "flex", flexDirection: "column", gap: tokens.space[2] }}>
|
||||
<Mono size={tokens.size.sm} color={tokens.color.warn}>No git credentials configured.</Mono>
|
||||
<Mono size={tokens.size.sm} color={tokens.color.text2}>Add GitHub or GitLab tokens in the credentials section below to search repositories.</Mono>
|
||||
<Mono size={tokens.size.sm} color={tokens.color.text2}>Add GitHub, GitLab, or Gitea tokens in the credentials section below to search repositories.</Mono>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -670,7 +670,7 @@ function RepoSearch({ onSelect, mobile }: {
|
||||
<Input
|
||||
value={query}
|
||||
onChange={e => setQuery(e.target.value)}
|
||||
placeholder="Search GitHub / GitLab repos..."
|
||||
placeholder="Search GitHub / GitLab / Gitea repos..."
|
||||
/>
|
||||
{loading && <Mono size={tokens.size.sm} color={tokens.color.text3}>Searching...</Mono>}
|
||||
{results.length > 0 && (
|
||||
@@ -689,11 +689,11 @@ function RepoSearch({ onSelect, mobile }: {
|
||||
<span style={{
|
||||
padding: "1px 6px", fontSize: tokens.size.xs,
|
||||
fontFamily: tokens.font.mono, letterSpacing: tokens.tracking.wide,
|
||||
background: repo.provider === "github" ? tokens.color.bg3 : tokens.color.purpleDim,
|
||||
color: repo.provider === "github" ? tokens.color.text1 : tokens.color.purple,
|
||||
border: `1px solid ${repo.provider === "github" ? tokens.color.border0 : tokens.color.purpleDim}`,
|
||||
background: repo.provider === "github" ? tokens.color.bg3 : repo.provider === "gitea" ? tokens.color.passDim : tokens.color.purpleDim,
|
||||
color: repo.provider === "github" ? tokens.color.text1 : repo.provider === "gitea" ? tokens.color.pass : tokens.color.purple,
|
||||
border: `1px solid ${repo.provider === "github" ? tokens.color.border0 : repo.provider === "gitea" ? tokens.color.passDim : tokens.color.purpleDim}`,
|
||||
}}>
|
||||
{repo.provider === "github" ? "GH" : "GL"}
|
||||
{repo.provider === "github" ? "GH" : repo.provider === "gitea" ? "GT" : "GL"}
|
||||
</span>
|
||||
<Mono size={tokens.size.sm} color={tokens.color.text0}>{repo.fullName}</Mono>
|
||||
{repo.private && (
|
||||
|
||||
@@ -118,21 +118,30 @@ async function searchGitea(query: string): Promise<RepoResult[]> {
|
||||
}
|
||||
);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user