MCPcopy
hub / github.com/Dokploy/dokploy / testGitlabConnection

Function testGitlabConnection

packages/server/src/utils/providers/gitlab.ts:264–293  ·  view source on GitHub ↗
(
	input: z.infer<typeof apiGitlabTestConnection>,
)

Source from the content-addressed store, hash-verified

262};
263
264export const testGitlabConnection = async (
265 input: z.infer<typeof apiGitlabTestConnection>,
266) => {
267 const { gitlabId, groupName } = input;
268
269 if (!gitlabId) {
270 throw new Error("Gitlab provider not found");
271 }
272
273 await refreshGitlabToken(gitlabId);
274
275 const gitlabProvider = await findGitlabById(gitlabId);
276
277 const repositories = await validateGitlabProvider(gitlabProvider);
278
279 const filteredRepos = repositories.filter((repo: any) => {
280 const { full_path, kind } = repo.namespace;
281
282 if (groupName) {
283 return groupName
284 .split(",")
285 .some((name: string) =>
286 full_path.toLowerCase().startsWith(name.trim().toLowerCase()),
287 );
288 }
289 return kind === "user";
290 });
291
292 return filteredRepos.length;
293};
294
295export const validateGitlabProvider = async (gitlabProvider: Gitlab) => {
296 try {

Callers 1

gitlab.tsFile · 0.90

Calls 3

findGitlabByIdFunction · 0.90
refreshGitlabTokenFunction · 0.85
validateGitlabProviderFunction · 0.85

Tested by

no test coverage detected