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

Function deployPreviewApplication

packages/server/src/services/application.ts:348–466  ·  view source on GitHub ↗
({
	applicationId,
	titleLog = "Preview Deployment",
	descriptionLog = "",
	previewDeploymentId,
}: {
	applicationId: string;
	titleLog: string;
	descriptionLog: string;
	previewDeploymentId: string;
})

Source from the content-addressed store, hash-verified

346};
347
348export const deployPreviewApplication = async ({
349 applicationId,
350 titleLog = "Preview Deployment",
351 descriptionLog = "",
352 previewDeploymentId,
353}: {
354 applicationId: string;
355 titleLog: string;
356 descriptionLog: string;
357 previewDeploymentId: string;
358}) => {
359 const application = await findApplicationById(applicationId);
360
361 const deployment = await createDeploymentPreview({
362 title: titleLog,
363 description: descriptionLog,
364 previewDeploymentId: previewDeploymentId,
365 });
366
367 const previewDeployment =
368 await findPreviewDeploymentById(previewDeploymentId);
369
370 await updatePreviewDeployment(previewDeploymentId, {
371 createdAt: new Date().toISOString(),
372 });
373
374 const previewDomain = getDomainHost(previewDeployment?.domain as Domain);
375 const issueParams = {
376 owner: application?.owner || "",
377 repository: application?.repository || "",
378 issue_number: previewDeployment.pullRequestNumber,
379 comment_id: Number.parseInt(previewDeployment.pullRequestCommentId),
380 githubId: application?.githubId || "",
381 };
382 try {
383 const commentExists = await issueCommentExists({
384 ...issueParams,
385 });
386 if (!commentExists) {
387 const result = await createPreviewDeploymentComment({
388 ...issueParams,
389 previewDomain,
390 appName: previewDeployment.appName,
391 githubId: application?.githubId || "",
392 previewDeploymentId,
393 });
394
395 if (!result) {
396 throw new TRPCError({
397 code: "NOT_FOUND",
398 message: "Pull request comment not found",
399 });
400 }
401
402 issueParams.comment_id = Number.parseInt(result?.pullRequestCommentId);
403 }
404 const buildingComment = getIssueComment(
405 application.name,

Callers 2

createDeploymentWorkerFunction · 0.90
deployFunction · 0.90

Calls 15

createDeploymentPreviewFunction · 0.90
updatePreviewDeploymentFunction · 0.90
getDomainHostFunction · 0.90
issueCommentExistsFunction · 0.90
getIssueCommentFunction · 0.90
updateIssueCommentFunction · 0.90
cloneGithubRepositoryFunction · 0.90
getBuildCommandFunction · 0.90
execAsyncRemoteFunction · 0.90
execAsyncFunction · 0.90

Tested by

no test coverage detected