mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-24 12:48:47 +00:00
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.
This commit is contained in:
@@ -287,6 +287,7 @@ export const rebuildApplication = async ({
|
|||||||
descriptionLog: string;
|
descriptionLog: string;
|
||||||
}) => {
|
}) => {
|
||||||
const application = await findApplicationById(applicationId);
|
const application = await findApplicationById(applicationId);
|
||||||
|
const serverId = application.buildServerId || application.serverId;
|
||||||
const buildLink = `${await getDokployUrl()}/dashboard/project/${application.environment.projectId}/environment/${application.environmentId}/services/application/${application.applicationId}?tab=deployments`;
|
const buildLink = `${await getDokployUrl()}/dashboard/project/${application.environment.projectId}/environment/${application.environmentId}/services/application/${application.applicationId}?tab=deployments`;
|
||||||
|
|
||||||
const deployment = await createDeployment({
|
const deployment = await createDeployment({
|
||||||
@@ -300,8 +301,8 @@ export const rebuildApplication = async ({
|
|||||||
// Check case for docker only
|
// Check case for docker only
|
||||||
command += getBuildCommand(application);
|
command += getBuildCommand(application);
|
||||||
const commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
|
const commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
|
||||||
if (application.serverId) {
|
if (serverId) {
|
||||||
await execAsyncRemote(application.serverId, commandWithLog);
|
await execAsyncRemote(serverId, commandWithLog);
|
||||||
} else {
|
} else {
|
||||||
await execAsync(commandWithLog);
|
await execAsync(commandWithLog);
|
||||||
}
|
}
|
||||||
@@ -340,8 +341,8 @@ export const rebuildApplication = async ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
command += `echo "\nError occurred ❌, check the logs for details." >> ${deployment.logPath};`;
|
command += `echo "\nError occurred ❌, check the logs for details." >> ${deployment.logPath};`;
|
||||||
if (application.serverId) {
|
if (serverId) {
|
||||||
await execAsyncRemote(application.serverId, command);
|
await execAsyncRemote(serverId, command);
|
||||||
} else {
|
} else {
|
||||||
await execAsync(command);
|
await execAsync(command);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user