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

Function rebuildPreviewApplication

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

Source from the content-addressed store, hash-verified

466};
467
468export const rebuildPreviewApplication = async ({
469 applicationId,
470 titleLog = "Rebuild Preview Deployment",
471 descriptionLog = "",
472 previewDeploymentId,
473}: {
474 applicationId: string;
475 titleLog: string;
476 descriptionLog: string;
477 previewDeploymentId: string;
478}) => {
479 const application = await findApplicationById(applicationId);
480 const previewDeployment =
481 await findPreviewDeploymentById(previewDeploymentId);
482
483 const deployment = await createDeploymentPreview({
484 title: titleLog,
485 description: descriptionLog,
486 previewDeploymentId: previewDeploymentId,
487 });
488
489 const previewDomain = getDomainHost(previewDeployment?.domain as Domain);
490 const issueParams = {
491 owner: application?.owner || "",
492 repository: application?.repository || "",
493 issue_number: previewDeployment.pullRequestNumber,
494 comment_id: Number.parseInt(previewDeployment.pullRequestCommentId),
495 githubId: application?.githubId || "",
496 };
497
498 try {
499 const commentExists = await issueCommentExists({
500 ...issueParams,
501 });
502 if (!commentExists) {
503 const result = await createPreviewDeploymentComment({
504 ...issueParams,
505 previewDomain,
506 appName: previewDeployment.appName,
507 githubId: application?.githubId || "",
508 previewDeploymentId,
509 });
510
511 if (!result) {
512 throw new TRPCError({
513 code: "NOT_FOUND",
514 message: "Pull request comment not found",
515 });
516 }
517
518 issueParams.comment_id = Number.parseInt(result?.pullRequestCommentId);
519 }
520
521 const buildingComment = getIssueComment(
522 application.name,
523 "running",
524 previewDomain,
525 );

Callers 2

createDeploymentWorkerFunction · 0.90
deployFunction · 0.90

Calls 15

createDeploymentPreviewFunction · 0.90
getDomainHostFunction · 0.90
issueCommentExistsFunction · 0.90
getIssueCommentFunction · 0.90
updateIssueCommentFunction · 0.90
getBuildCommandFunction · 0.90
execAsyncRemoteFunction · 0.90
execAsyncFunction · 0.90
mechanizeDockerContainerFunction · 0.90
updateDeploymentStatusFunction · 0.90

Tested by

no test coverage detected