@turboops/cli 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +38 -32
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2539,9 +2539,9 @@ var deployCommand = new Command4("deploy").description("Trigger a deployment (fo
|
|
|
2539
2539
|
).option("-w, --wait", "Wait for deployment to complete", true).option("--no-wait", "Do not wait for deployment to complete").option("--timeout <ms>", "Timeout in milliseconds when waiting", "600000").action(async (environment, options) => {
|
|
2540
2540
|
const { project, environment: env } = await getCommandContextWithEnvironment(environment);
|
|
2541
2541
|
logger.header(`Deploying: ${project.name} \u2192 ${env.name}`);
|
|
2542
|
+
const isFirstStage = !env.stageOrder || env.stageOrder === 0;
|
|
2542
2543
|
let imageTag = options.image;
|
|
2543
2544
|
if (!imageTag) {
|
|
2544
|
-
const isFirstStage = !env.stageOrder || env.stageOrder === 0;
|
|
2545
2545
|
if (isFirstStage) {
|
|
2546
2546
|
const commitSha = detectCiCommitSha();
|
|
2547
2547
|
const ciEnv = detectCiEnvironment();
|
|
@@ -2561,43 +2561,49 @@ var deployCommand = new Command4("deploy").description("Trigger a deployment (fo
|
|
|
2561
2561
|
}
|
|
2562
2562
|
}
|
|
2563
2563
|
let composeFileContent;
|
|
2564
|
-
if (
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
logger.info(`Using compose file: ${composePath}`);
|
|
2572
|
-
} else if (project.detectedConfig?.composePath) {
|
|
2573
|
-
const composePath = resolve2(
|
|
2574
|
-
process.cwd(),
|
|
2575
|
-
project.detectedConfig.composePath
|
|
2576
|
-
);
|
|
2577
|
-
if (existsSync4(composePath)) {
|
|
2564
|
+
if (isFirstStage) {
|
|
2565
|
+
if (typeof options.compose === "string") {
|
|
2566
|
+
const composePath = resolve2(options.compose);
|
|
2567
|
+
if (!existsSync4(composePath)) {
|
|
2568
|
+
logger.error(`Compose file not found: ${composePath}`);
|
|
2569
|
+
process.exit(11 /* CONFIG_ERROR */);
|
|
2570
|
+
}
|
|
2578
2571
|
composeFileContent = readFileSync3(composePath, "utf-8");
|
|
2579
|
-
logger.info(
|
|
2580
|
-
|
|
2572
|
+
logger.info(`Using compose file: ${composePath}`);
|
|
2573
|
+
} else if (project.detectedConfig?.composePath) {
|
|
2574
|
+
const composePath = resolve2(
|
|
2575
|
+
process.cwd(),
|
|
2576
|
+
project.detectedConfig.composePath
|
|
2581
2577
|
);
|
|
2578
|
+
if (existsSync4(composePath)) {
|
|
2579
|
+
composeFileContent = readFileSync3(composePath, "utf-8");
|
|
2580
|
+
logger.info(
|
|
2581
|
+
`Using project compose file: ${project.detectedConfig.composePath}`
|
|
2582
|
+
);
|
|
2583
|
+
}
|
|
2582
2584
|
}
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
const commitSha = detectCiCommitSha();
|
|
2588
|
-
composeFileContent = composeFileContent.replace(
|
|
2589
|
-
/\$\{IMAGE_NAME(?::-[^}]*)?\}/g,
|
|
2590
|
-
imageName
|
|
2591
|
-
);
|
|
2592
|
-
if (commitSha) {
|
|
2585
|
+
if (composeFileContent) {
|
|
2586
|
+
const registryUrl = configService.getRegistryUrl();
|
|
2587
|
+
const imageName = `${registryUrl}/${project.slug}`;
|
|
2588
|
+
const commitSha = detectCiCommitSha();
|
|
2593
2589
|
composeFileContent = composeFileContent.replace(
|
|
2594
|
-
/\$\{
|
|
2595
|
-
|
|
2596
|
-
);
|
|
2597
|
-
logger.info(
|
|
2598
|
-
`Substituted image placeholders: ${imageName}:${commitSha}`
|
|
2590
|
+
/\$\{IMAGE_NAME(?::-[^}]*)?\}/g,
|
|
2591
|
+
imageName
|
|
2599
2592
|
);
|
|
2593
|
+
if (commitSha) {
|
|
2594
|
+
composeFileContent = composeFileContent.replace(
|
|
2595
|
+
/\$\{IMAGE_TAG(?::-[^}]*)?\}/g,
|
|
2596
|
+
commitSha
|
|
2597
|
+
);
|
|
2598
|
+
logger.info(
|
|
2599
|
+
`Substituted image placeholders: ${imageName}:${commitSha}`
|
|
2600
|
+
);
|
|
2601
|
+
}
|
|
2600
2602
|
}
|
|
2603
|
+
} else {
|
|
2604
|
+
logger.info(
|
|
2605
|
+
`Stage "${env.name}" uses promotion \u2014 compose file from previous stage`
|
|
2606
|
+
);
|
|
2601
2607
|
}
|
|
2602
2608
|
logger.info("Triggering deployment...");
|
|
2603
2609
|
const { data: deployment, error } = await apiClient.deploy(
|