({
composeId,
titleLog = "Rebuild deployment",
descriptionLog = "",
}: {
composeId: string;
titleLog: string;
descriptionLog: string;
})
| 341 | }; |
| 342 | |
| 343 | export const rebuildCompose = async ({ |
| 344 | composeId, |
| 345 | titleLog = "Rebuild deployment", |
| 346 | descriptionLog = "", |
| 347 | }: { |
| 348 | composeId: string; |
| 349 | titleLog: string; |
| 350 | descriptionLog: string; |
| 351 | }) => { |
| 352 | const compose = await findComposeById(composeId); |
| 353 | |
| 354 | const deployment = await createDeploymentCompose({ |
| 355 | composeId: composeId, |
| 356 | title: titleLog, |
| 357 | description: descriptionLog, |
| 358 | }); |
| 359 | |
| 360 | try { |
| 361 | let command = "set -e;"; |
| 362 | if (compose.sourceType === "raw") { |
| 363 | command += getCreateComposeFileCommand(compose); |
| 364 | } |
| 365 | |
| 366 | let commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`; |
| 367 | if (compose.serverId) { |
| 368 | await execAsyncRemote(compose.serverId, commandWithLog); |
| 369 | } else { |
| 370 | await execAsync(commandWithLog); |
| 371 | } |
| 372 | |
| 373 | if (compose.sourceType !== "raw") { |
| 374 | command = "set -e;"; |
| 375 | command += await generateApplyPatchesCommand({ |
| 376 | id: compose.composeId, |
| 377 | type: "compose", |
| 378 | serverId: compose.serverId, |
| 379 | }); |
| 380 | commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`; |
| 381 | if (compose.serverId) { |
| 382 | await execAsyncRemote(compose.serverId, commandWithLog); |
| 383 | } else { |
| 384 | await execAsync(commandWithLog); |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | command = "set -e;"; |
| 389 | command += await getBuildComposeCommand(compose); |
| 390 | commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`; |
| 391 | if (compose.serverId) { |
| 392 | await execAsyncRemote(compose.serverId, commandWithLog); |
| 393 | } else { |
| 394 | await execAsync(commandWithLog); |
| 395 | } |
| 396 | |
| 397 | await updateDeploymentStatus(deployment.deploymentId, "done"); |
| 398 | await updateCompose(composeId, { |
| 399 | composeStatus: "done", |
| 400 | }); |
no test coverage detected