@turboops/cli 1.0.0-dev.610 → 1.0.0-dev.612
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 +134 -51
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -664,6 +664,12 @@ var apiClient = {
|
|
|
664
664
|
async createStage(data) {
|
|
665
665
|
return this.request("POST", "/deployment/stages/simple", data);
|
|
666
666
|
},
|
|
667
|
+
/**
|
|
668
|
+
* Create a project token (for CI/CD)
|
|
669
|
+
*/
|
|
670
|
+
async createProjectToken(data) {
|
|
671
|
+
return this.request("POST", "/deployment/tokens/simple", data);
|
|
672
|
+
},
|
|
667
673
|
/**
|
|
668
674
|
* Get deployment-ready servers
|
|
669
675
|
*/
|
|
@@ -1706,6 +1712,18 @@ async function createNewProject(slug, verbose = false) {
|
|
|
1706
1712
|
process.exit(13 /* API_ERROR */);
|
|
1707
1713
|
}
|
|
1708
1714
|
logger.success(`Projekt "${newProject.name}" wurde erstellt!`);
|
|
1715
|
+
if (newProject.projectToken) {
|
|
1716
|
+
logger.newline();
|
|
1717
|
+
logger.header("CI/CD Projekt-Token");
|
|
1718
|
+
console.log(chalk5.yellow.bold(" WICHTIG: Diesen Token jetzt kopieren - er wird nur einmal angezeigt!"));
|
|
1719
|
+
logger.newline();
|
|
1720
|
+
console.log(chalk5.cyan(" Token: ") + chalk5.green.bold(newProject.projectToken));
|
|
1721
|
+
logger.newline();
|
|
1722
|
+
console.log(chalk5.dim(" Diesen Token als CI/CD Secret hinterlegen:"));
|
|
1723
|
+
console.log(chalk5.dim(" \u2192 GitLab: Settings \u2192 CI/CD \u2192 Variables \u2192 TURBOOPS_TOKEN"));
|
|
1724
|
+
console.log(chalk5.dim(" \u2192 GitHub: Settings \u2192 Secrets \u2192 Actions \u2192 TURBOOPS_TOKEN"));
|
|
1725
|
+
logger.newline();
|
|
1726
|
+
}
|
|
1709
1727
|
configService.setProject(newProject.slug);
|
|
1710
1728
|
logger.newline();
|
|
1711
1729
|
const { shouldCreateStage } = await prompts2({
|
|
@@ -1877,30 +1895,40 @@ async function showFinalSummary(project) {
|
|
|
1877
1895
|
console.log(` ${chalk5.bold(env.slug)} - ${env.name} (${env.type})`);
|
|
1878
1896
|
}
|
|
1879
1897
|
}
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
"
|
|
1900
|
-
"
|
|
1901
|
-
|
|
1902
|
-
"
|
|
1903
|
-
|
|
1898
|
+
if (project.projectToken) {
|
|
1899
|
+
logger.newline();
|
|
1900
|
+
logger.header("N\xE4chste Schritte");
|
|
1901
|
+
logger.list([
|
|
1902
|
+
`Token als CI/CD Secret hinterlegen (${chalk5.bold("TURBOOPS_TOKEN")})`,
|
|
1903
|
+
"Pipeline committen und pushen",
|
|
1904
|
+
"`turbo status` ausf\xFChren um Deployments zu pr\xFCfen"
|
|
1905
|
+
]);
|
|
1906
|
+
} else {
|
|
1907
|
+
logger.newline();
|
|
1908
|
+
logger.header("CI/CD Token einrichten");
|
|
1909
|
+
console.log(chalk5.cyan(" 1. Projekt-Token erstellen:"));
|
|
1910
|
+
console.log(` ${chalk5.dim("\u2192")} TurboOps Web-UI \xF6ffnen`);
|
|
1911
|
+
console.log(` ${chalk5.dim("\u2192")} Projekt "${project.name}" ausw\xE4hlen`);
|
|
1912
|
+
console.log(` ${chalk5.dim("\u2192")} Settings \u2192 Tokens \u2192 "Neuer Token"`);
|
|
1913
|
+
logger.newline();
|
|
1914
|
+
console.log(chalk5.cyan(" 2. Token als CI/CD Secret hinterlegen:"));
|
|
1915
|
+
console.log(chalk5.dim(" GitLab:"));
|
|
1916
|
+
console.log(` ${chalk5.dim("\u2192")} Settings \u2192 CI/CD \u2192 Variables`);
|
|
1917
|
+
console.log(` ${chalk5.dim("\u2192")} Variable: ${chalk5.bold("TURBOOPS_TOKEN")} = <dein-token>`);
|
|
1918
|
+
console.log(` ${chalk5.dim("\u2192")} Flags: Protected, Masked`);
|
|
1919
|
+
logger.newline();
|
|
1920
|
+
console.log(chalk5.dim(" GitHub:"));
|
|
1921
|
+
console.log(` ${chalk5.dim("\u2192")} Settings \u2192 Secrets and variables \u2192 Actions`);
|
|
1922
|
+
console.log(` ${chalk5.dim("\u2192")} New repository secret: ${chalk5.bold("TURBOOPS_TOKEN")}`);
|
|
1923
|
+
logger.newline();
|
|
1924
|
+
logger.header("N\xE4chste Schritte");
|
|
1925
|
+
logger.list([
|
|
1926
|
+
"Projekt-Token in TurboOps erstellen (siehe oben)",
|
|
1927
|
+
"Token als CI/CD Secret hinterlegen",
|
|
1928
|
+
"Pipeline committen und pushen",
|
|
1929
|
+
"`turbo status` ausf\xFChren um Deployments zu pr\xFCfen"
|
|
1930
|
+
]);
|
|
1931
|
+
}
|
|
1904
1932
|
}
|
|
1905
1933
|
async function offerAiAssistance(projectSlug, projectId, verbose = false) {
|
|
1906
1934
|
const detection = await detectProjectConfig();
|
|
@@ -2198,23 +2226,61 @@ Modifiziere die Datei "${pipelineFile}" entsprechend.` : `Erstelle eine neue ${p
|
|
|
2198
2226
|
Projekt-Slug: ${projectSlug}
|
|
2199
2227
|
Pipeline-Datei: ${pipelineFile}
|
|
2200
2228
|
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2229
|
+
WICHTIG - Branch-zu-Stage-Zuordnung (STRIKT EINHALTEN!):
|
|
2230
|
+
- dev Stage \u2192 deployed NUR wenn Branch == "dev"
|
|
2231
|
+
- test Stage \u2192 deployed NUR wenn Branch == "test"
|
|
2232
|
+
- prod Stage \u2192 deployed NUR wenn Branch == "main"
|
|
2233
|
+
|
|
2234
|
+
PIPELINE-STRUKTUR:
|
|
2235
|
+
|
|
2236
|
+
1. BUILD-JOB (l\xE4uft auf ALLEN Branches: dev, test, main):
|
|
2237
|
+
stages: [build, deploy-dev, deploy-test, deploy-prod]
|
|
2238
|
+
|
|
2239
|
+
build:
|
|
2240
|
+
image: docker:24-dind
|
|
2241
|
+
services: [docker:24-dind]
|
|
2242
|
+
before_script:
|
|
2243
|
+
- docker login -u ${projectSlug} -p \${TURBOOPS_TOKEN} registry.turbo-ops.de
|
|
2244
|
+
script:
|
|
2245
|
+
- docker compose build
|
|
2246
|
+
- docker compose push
|
|
2247
|
+
rules:
|
|
2248
|
+
- if: $CI_COMMIT_BRANCH # L\xE4uft auf ALLEN Branches!
|
|
2249
|
+
|
|
2250
|
+
2. DEPLOY-JOBS (jeder NUR auf seinem Branch!):
|
|
2251
|
+
|
|
2252
|
+
deploy-dev:
|
|
2253
|
+
image: node:20-alpine
|
|
2254
|
+
before_script:
|
|
2255
|
+
- npm install -g @turboops/cli
|
|
2256
|
+
- turbo config set token \${TURBOOPS_TOKEN}
|
|
2257
|
+
script:
|
|
2258
|
+
- turbo deploy dev --image registry.turbo-ops.de/${projectSlug}:\${CI_COMMIT_SHA} --wait
|
|
2259
|
+
rules:
|
|
2260
|
+
- if: $CI_COMMIT_BRANCH == "dev" # NUR auf dev Branch!
|
|
2261
|
+
needs: [build]
|
|
2262
|
+
|
|
2263
|
+
deploy-test:
|
|
2264
|
+
script:
|
|
2265
|
+
- turbo deploy test --wait # Kein --image, Auto-Promotion von dev
|
|
2266
|
+
rules:
|
|
2267
|
+
- if: $CI_COMMIT_BRANCH == "test" # NUR auf test Branch!
|
|
2268
|
+
needs: [deploy-dev]
|
|
2269
|
+
|
|
2270
|
+
deploy-prod:
|
|
2271
|
+
script:
|
|
2272
|
+
- turbo deploy prod --wait # Kein --image, Auto-Promotion von test
|
|
2273
|
+
rules:
|
|
2274
|
+
- if: $CI_COMMIT_BRANCH == "main" # NUR auf main Branch!
|
|
2275
|
+
when: manual
|
|
2276
|
+
needs: [deploy-test]
|
|
2277
|
+
|
|
2278
|
+
WICHTIG:
|
|
2279
|
+
- Der Build l\xE4uft auf ALLEN Branches (dev, test, main)
|
|
2280
|
+
- Jeder Deploy-Job l\xE4uft NUR auf seinem zugeordneten Branch
|
|
2281
|
+
- --image nur bei deploy-dev (erste Stage), danach Auto-Promotion
|
|
2282
|
+
- Registry-URL: registry.turbo-ops.de/${projectSlug}
|
|
2283
|
+
- Secrets ben\xF6tigt: TURBOOPS_TOKEN
|
|
2218
2284
|
|
|
2219
2285
|
Erstelle die Datei "${pipelineFile}".`;
|
|
2220
2286
|
const success = await aiToolsService.runWithPrompt(tool, prompt, verbose);
|
|
@@ -2553,17 +2619,34 @@ async function integratePipelineWithAI2(pipelineType, projectSlug, pipelinePath)
|
|
|
2553
2619
|
Projekt-Slug: ${projectSlug}
|
|
2554
2620
|
Pipeline-Datei: ${pipelinePath}
|
|
2555
2621
|
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2622
|
+
WICHTIG - Branch-zu-Stage-Zuordnung:
|
|
2623
|
+
- dev Stage \u2192 wird NUR auf dem "dev" Branch deployed
|
|
2624
|
+
- test Stage \u2192 wird NUR auf dem "test" Branch deployed
|
|
2625
|
+
- prod Stage \u2192 wird NUR auf dem "main" Branch deployed
|
|
2626
|
+
|
|
2627
|
+
PIPELINE-STRUKTUR:
|
|
2628
|
+
1. Build-Job: L\xE4uft auf ALLEN Branches (dev, test, main)
|
|
2629
|
+
- Docker Images bauen mit docker-compose build
|
|
2630
|
+
- Images pushen mit docker-compose push
|
|
2631
|
+
- Registry: registry.turbo-ops.de/${projectSlug}
|
|
2632
|
+
|
|
2633
|
+
2. Deploy-Jobs: Jeder Job l\xE4uft NUR auf seinem Branch!
|
|
2634
|
+
- deploy-dev: rules: if: $CI_COMMIT_BRANCH == "dev"
|
|
2635
|
+
- deploy-test: rules: if: $CI_COMMIT_BRANCH == "test"
|
|
2636
|
+
- deploy-prod: rules: if: $CI_COMMIT_BRANCH == "main" (when: manual)
|
|
2637
|
+
|
|
2638
|
+
DEPLOY-BEFEHLE:
|
|
2639
|
+
- TurboOps CLI installieren: npm install -g @turboops/cli
|
|
2640
|
+
- Token setzen: turbo config set token \${TURBOOPS_TOKEN}
|
|
2641
|
+
- Deploy mit Image (nur erste Stage): turbo deploy dev --image registry.turbo-ops.de/${projectSlug}:\${CI_COMMIT_SHA} --wait
|
|
2642
|
+
- Deploy ohne Image (test/prod - Auto-Promotion): turbo deploy test --wait
|
|
2643
|
+
|
|
2644
|
+
DEPENDENCIES:
|
|
2645
|
+
- deploy-dev needs: [build]
|
|
2646
|
+
- deploy-test needs: [deploy-dev]
|
|
2647
|
+
- deploy-prod needs: [deploy-test]
|
|
2564
2648
|
|
|
2565
|
-
Secrets
|
|
2566
|
-
- TURBOOPS_TOKEN: TurboOps Projekt-Token
|
|
2649
|
+
Secrets ben\xF6tigt: TURBOOPS_TOKEN
|
|
2567
2650
|
|
|
2568
2651
|
Modifiziere die Datei "${pipelinePath}" entsprechend.`;
|
|
2569
2652
|
const success = await aiToolsService.runWithPrompt(tool, prompt);
|