Skip to content

Commit 035f883

Browse files
author
Mauricio Siu
committed
fix: use unified server ID for deployment commands in rebuildApplication
- Updated the rebuildApplication function to utilize a consistent server ID by incorporating buildServerId where available. - Refactored deployment command execution to ensure compatibility with the new server ID logic, enhancing deployment reliability.
1 parent 8cff84e commit 035f883

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

packages/server/src/services/application.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ export const rebuildApplication = async ({
287287
descriptionLog: string;
288288
}) => {
289289
const application = await findApplicationById(applicationId);
290+
const serverId = application.buildServerId || application.serverId;
290291
const buildLink = `${await getDokployUrl()}/dashboard/project/${application.environment.projectId}/environment/${application.environmentId}/services/application/${application.applicationId}?tab=deployments`;
291292

292293
const deployment = await createDeployment({
@@ -300,8 +301,8 @@ export const rebuildApplication = async ({
300301
// Check case for docker only
301302
command += getBuildCommand(application);
302303
const commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
303-
if (application.serverId) {
304-
await execAsyncRemote(application.serverId, commandWithLog);
304+
if (serverId) {
305+
await execAsyncRemote(serverId, commandWithLog);
305306
} else {
306307
await execAsync(commandWithLog);
307308
}
@@ -340,8 +341,8 @@ export const rebuildApplication = async ({
340341
}
341342

342343
command += `echo "\nError occurred ❌, check the logs for details." >> ${deployment.logPath};`;
343-
if (application.serverId) {
344-
await execAsyncRemote(application.serverId, command);
344+
if (serverId) {
345+
await execAsyncRemote(serverId, command);
345346
} else {
346347
await execAsync(command);
347348
}

0 commit comments

Comments
 (0)