@eudiplo/cli 8.0.2-main.3b6a116 → 8.0.2-main.4c3e735
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/README.md +5 -1
- package/dist/commands/deployment/action.d.ts +1 -1
- package/dist/commands/deployment/action.d.ts.map +1 -1
- package/dist/commands/deployment/action.js.map +1 -1
- package/dist/commands/deployment/index.d.ts.map +1 -1
- package/dist/commands/deployment/index.js +7 -4
- package/dist/commands/deployment/index.js.map +1 -1
- package/dist/commands/open/action.d.ts +9 -0
- package/dist/commands/open/action.d.ts.map +1 -0
- package/dist/commands/open/action.js +41 -0
- package/dist/commands/open/action.js.map +1 -0
- package/dist/commands/open/index.d.ts +5 -0
- package/dist/commands/open/index.d.ts.map +1 -0
- package/dist/commands/open/index.js +15 -0
- package/dist/commands/open/index.js.map +1 -0
- package/dist/commands/upgrade/action.d.ts +3 -0
- package/dist/commands/upgrade/action.d.ts.map +1 -0
- package/dist/commands/upgrade/action.js +95 -0
- package/dist/commands/upgrade/action.js.map +1 -0
- package/dist/commands/upgrade/index.d.ts +5 -0
- package/dist/commands/upgrade/index.d.ts.map +1 -0
- package/dist/commands/upgrade/index.js +15 -0
- package/dist/commands/upgrade/index.js.map +1 -0
- package/dist/index.js +622 -66
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +4 -0
- package/dist/runtime.js.map +1 -1
- package/dist/services/browser.d.ts +30 -0
- package/dist/services/browser.d.ts.map +1 -0
- package/dist/services/browser.js +102 -0
- package/dist/services/browser.js.map +1 -0
- package/dist/services/compose-args.d.ts +28 -0
- package/dist/services/compose-args.d.ts.map +1 -0
- package/dist/services/compose-args.js +117 -0
- package/dist/services/compose-args.js.map +1 -0
- package/dist/services/compose-upgrade.d.ts +40 -0
- package/dist/services/compose-upgrade.d.ts.map +1 -0
- package/dist/services/compose-upgrade.js +102 -0
- package/dist/services/compose-upgrade.js.map +1 -0
- package/dist/services/deployment-drivers.d.ts +8 -1
- package/dist/services/deployment-drivers.d.ts.map +1 -1
- package/dist/services/deployment-drivers.js +85 -19
- package/dist/services/deployment-drivers.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/schemas/KeyChainConfigFile.schema.json +7 -3
- package/templates/schemas/KeyChainImportDto.schema.json +7 -3
package/README.md
CHANGED
|
@@ -90,7 +90,11 @@ eudiplo init --target compose --demo --image-tag main
|
|
|
90
90
|
eudiplo init --target compose --no-client
|
|
91
91
|
eudiplo up
|
|
92
92
|
eudiplo down
|
|
93
|
-
eudiplo
|
|
93
|
+
eudiplo ps
|
|
94
|
+
eudiplo logs --service eudiplo --follow --tail 100 --since 10m
|
|
95
|
+
eudiplo restart --service eudiplo-client
|
|
96
|
+
eudiplo pull
|
|
97
|
+
eudiplo upgrade --image-tag 8.1.0
|
|
94
98
|
eudiplo demo --reset --force
|
|
95
99
|
```
|
|
96
100
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CliConfig, CommandContext, ParsedArgs } from "../../types.js";
|
|
2
|
-
export declare function runDriverCommand(config: CliConfig, command: "up" | "down" | "logs" | "ps" | "restart", parsed: ParsedArgs, context: CommandContext): Promise<number>;
|
|
2
|
+
export declare function runDriverCommand(config: CliConfig, command: "up" | "down" | "logs" | "ps" | "restart" | "pull", parsed: ParsedArgs, context: CommandContext): Promise<number>;
|
|
3
3
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/deployment/action.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5E,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/deployment/action.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5E,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAC3D,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,cAAc,GACxB,OAAO,CAAC,MAAM,CAAC,CAoBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/commands/deployment/action.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,kBAAkB,GACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGvE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,MAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/commands/deployment/action.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,kBAAkB,GACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGvE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,MAAiB,EACjB,OAA2D,EAC3D,MAAkB,EAClB,OAAuB;IAEvB,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS;YACjC,CAAC,CAAC,gBAAgB;YAClB,CAAC,CAAC,iBAAiB,CAAC;QACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,YAAY,KAAK,UAAU,KAAK,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,OAAO,CAAC;QACX,YAAY;QACZ,QAAQ;QACR,IAAI,EAAE,MAAM,CAAC,WAAW;QACxB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO;KACV,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/deployment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/deployment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAqB1E,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,WAAW,GACzB,OAAO,EAAE,CA4CX"}
|
|
@@ -7,28 +7,31 @@ const descriptions = {
|
|
|
7
7
|
logs: "Stream logs for the selected deployment",
|
|
8
8
|
ps: "List the running containers or pods for the selected deployment",
|
|
9
9
|
restart: "Restart the workloads of the selected deployment",
|
|
10
|
+
pull: "Download the configured images without changing configuration",
|
|
10
11
|
};
|
|
11
12
|
// Commands that act on a single workload rather than the whole deployment.
|
|
12
13
|
const serviceScoped = new Set([
|
|
13
14
|
"logs",
|
|
14
15
|
"restart",
|
|
16
|
+
"pull",
|
|
15
17
|
]);
|
|
16
18
|
export function createDeploymentCommands(context, setExitCode) {
|
|
17
|
-
return ["up", "down", "logs", "ps", "restart"].map((name) => {
|
|
19
|
+
return ["up", "down", "logs", "ps", "restart", "pull"].map((name) => {
|
|
18
20
|
const command = new Command(name)
|
|
19
21
|
.description(descriptions[name])
|
|
20
22
|
.argument("[args...]", "additional arguments passed to the deployment runtime")
|
|
21
23
|
.option("--instance <name>", "select a configured instance");
|
|
22
24
|
if (serviceScoped.has(name)) {
|
|
23
|
-
command.option("--service <name>", "select a configured workload (Kubernetes
|
|
25
|
+
command.option("--service <name>", "select a single service (Compose) or configured workload (Kubernetes)");
|
|
24
26
|
}
|
|
25
27
|
if (name === "logs") {
|
|
26
28
|
command
|
|
27
29
|
.option("--follow", "stream new output as it arrives")
|
|
28
|
-
.option("--tail <lines>", "number of recent lines to show")
|
|
30
|
+
.option("--tail <lines>", "number of recent lines to show")
|
|
31
|
+
.option("--since <time>", "show logs since a duration (10m, 2h) or timestamp (Compose instances)");
|
|
29
32
|
}
|
|
30
33
|
if (name === "restart") {
|
|
31
|
-
command.option("--no-wait", "return without waiting for the rollout to finish");
|
|
34
|
+
command.option("--no-wait", "return without waiting for the rollout to finish (Kubernetes instances)");
|
|
32
35
|
}
|
|
33
36
|
return command.action(async (args, options) => {
|
|
34
37
|
const { config } = await loadCliState(context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/deployment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAoB,MAAM,cAAc,CAAC;AAC1E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M,CACV,kBAAkB,EAClB,uEAAuE,CAC1E,CAAC;QACN,CAAC;QACD,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;YAClB,OAAO;iBACF,MAAM,CAAC,UAAU,EAAE,iCAAiC,CAAC;iBACrD,MAAM,CAAC,gBAAgB,EAAE,gCAAgC,CAAC;iBAC1D,MAAM,CACH,gBAAgB,EAChB,uEAAuE,CAC1E,CAAC;QACV,CAAC;QACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,CAAC,MAAM,CACV,WAAW,EACX,yEAAyE,CAC5E,CAAC;QACN,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;YAC1C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;YAC/C,WAAW,CACP,MAAM,gBAAgB,CAClB,MAAM,EACN,IAAI,EACJ,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,EAC1C,OAAO,CACV,CACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type BrowserLauncher } from "../../services/browser.js";
|
|
2
|
+
import type { CliConfig, CommandContext, ParsedArgs } from "../../types.js";
|
|
3
|
+
export interface OpenDependencies {
|
|
4
|
+
platform: NodeJS.Platform;
|
|
5
|
+
launch: (launcher: BrowserLauncher) => Promise<boolean>;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveOpenTarget(instanceName: string, instance: CliConfig["instances"][string], docs: boolean): string;
|
|
8
|
+
export declare function runOpenCommand(config: CliConfig, parsed: ParsedArgs, context: CommandContext, dependencies?: OpenDependencies): Promise<number>;
|
|
9
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/open/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,eAAe,EAIvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,MAAM,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3D;AAOD,wBAAgB,iBAAiB,CAC7B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EACxC,IAAI,EAAE,OAAO,GACd,MAAM,CAeR;AAED,wBAAsB,cAAc,CAChC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,cAAc,EACvB,YAAY,GAAE,gBAAsC,GACrD,OAAO,CAAC,MAAM,CAAC,CA0BjB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { assertWebUrl, chooseLauncher, launchBrowser, pathLookup, } from "../../services/browser.js";
|
|
2
|
+
import { resolveInstance } from "../../services/instance-selection.js";
|
|
3
|
+
const defaultDependencies = {
|
|
4
|
+
platform: process.platform,
|
|
5
|
+
launch: launchBrowser,
|
|
6
|
+
};
|
|
7
|
+
export function resolveOpenTarget(instanceName, instance, docs) {
|
|
8
|
+
if (docs) {
|
|
9
|
+
// Resolve relative to the instance URL so a path prefix such as
|
|
10
|
+
// https://example.com/eudiplo is kept.
|
|
11
|
+
const base = instance.url.endsWith("/")
|
|
12
|
+
? instance.url
|
|
13
|
+
: `${instance.url}/`;
|
|
14
|
+
return assertWebUrl(new URL("api/docs", base).href).href;
|
|
15
|
+
}
|
|
16
|
+
if (!instance.clientUrl) {
|
|
17
|
+
throw new Error(`Instance ${instanceName} has no web client URL. Use --docs to open the API documentation instead.`);
|
|
18
|
+
}
|
|
19
|
+
return assertWebUrl(instance.clientUrl).href;
|
|
20
|
+
}
|
|
21
|
+
export async function runOpenCommand(config, parsed, context, dependencies = defaultDependencies) {
|
|
22
|
+
const [instanceName, instance] = resolveInstance(config, parsed);
|
|
23
|
+
const url = resolveOpenTarget(instanceName, instance, parsed.flags.docs === true);
|
|
24
|
+
// Scripts, pipes and CI get the URL on stdout and nothing else.
|
|
25
|
+
if (parsed.flags.print === true || context.interactive !== true) {
|
|
26
|
+
context.stdout.write(`${url}\n`);
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
const launcher = await chooseLauncher(url, {
|
|
30
|
+
platform: dependencies.platform,
|
|
31
|
+
env: context.env,
|
|
32
|
+
which: pathLookup(context.env, dependencies.platform),
|
|
33
|
+
});
|
|
34
|
+
if (!launcher || !(await dependencies.launch(launcher))) {
|
|
35
|
+
context.stdout.write(`No browser is available here. Open: ${url}\n`);
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
context.stdout.write(`Opening ${url}\n`);
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/commands/open/action.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EAEZ,cAAc,EACd,aAAa,EACb,UAAU,GACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAQvE,MAAM,mBAAmB,GAAqB;IAC1C,QAAQ,EAAE,OAAO,CAAC,QAAQ;IAC1B,MAAM,EAAE,aAAa;CACxB,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAC7B,YAAoB,EACpB,QAAwC,EACxC,IAAa;IAEb,IAAI,IAAI,EAAE,CAAC;QACP,gEAAgE;QAChE,uCAAuC;QACvC,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ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MAAM,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QACtD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,GAAG,IAAI,CAAC,CAAC;QACrE,OAAO,CAAC,CAAC;IACb,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzC,OAAO,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { CommandContext } from "../../types.js";
|
|
3
|
+
import { type SetExitCode } from "../shared.js";
|
|
4
|
+
export declare function createOpenCommand(context: CommandContext, setExitCode: SetExitCode): Command;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/open/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAG1E,wBAAgB,iBAAiB,CAC7B,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,WAAW,GACzB,OAAO,CAkBT"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { loadCliState, parsedArgs } from "../shared.js";
|
|
3
|
+
import { runOpenCommand } from "./action.js";
|
|
4
|
+
export function createOpenCommand(context, setExitCode) {
|
|
5
|
+
return new Command("open")
|
|
6
|
+
.description("Open the web client of the selected instance in a browser")
|
|
7
|
+
.option("--instance <name>", "select a configured instance")
|
|
8
|
+
.option("--docs", "open the management API documentation instead")
|
|
9
|
+
.option("--print", "print the URL instead of opening a browser")
|
|
10
|
+
.action(async (options) => {
|
|
11
|
+
const { config } = await loadCliState(context);
|
|
12
|
+
setExitCode(await runOpenCommand(config, parsedArgs("open", undefined, [], options), context));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/open/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAoB,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,UAAU,iBAAiB,CAC7B,OAAuB,EACvB,WAAwB;IAExB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;SACrB,WAAW,CACR,2DAA2D,CAC9D;SACA,MAAM,CAAC,mBAAmB,EAAE,8BAA8B,CAAC;SAC3D,MAAM,CAAC,QAAQ,EAAE,+CAA+C,CAAC;SACjE,MAAM,CAAC,SAAS,EAAE,4CAA4C,CAAC;SAC/D,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACtB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;QAC/C,WAAW,CACP,MAAM,cAAc,CAChB,MAAM,EACN,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,EAC1C,OAAO,CACV,CACJ,CAAC;IACN,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/commands/upgrade/action.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACR,SAAS,EACT,cAAc,EAEd,UAAU,EACb,MAAM,gBAAgB,CAAC;AAGxB,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,cAAc,GACxB,OAAO,CAAC,MAAM,CAAC,CA+EjB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { readStringFlag } from "../../options.js";
|
|
4
|
+
import { buildComposePullArgs, buildComposeUpArgs, } from "../../services/compose-args.js";
|
|
5
|
+
import { migrationNotes, planImageUpgrade, } from "../../services/compose-upgrade.js";
|
|
6
|
+
import { assertWritable, runCompose, unsupportedCommand, } from "../../services/deployment-drivers.js";
|
|
7
|
+
import { resolveInstance } from "../../services/instance-selection.js";
|
|
8
|
+
import { createPrompter } from "../shared.js";
|
|
9
|
+
export async function runUpgradeCommand(config, parsed, context) {
|
|
10
|
+
const [instanceName, instance] = resolveInstance(config, parsed);
|
|
11
|
+
if (instance.target !== "compose") {
|
|
12
|
+
throw new Error(unsupportedCommand("upgrade", instance.target));
|
|
13
|
+
}
|
|
14
|
+
const options = {
|
|
15
|
+
instanceName,
|
|
16
|
+
instance,
|
|
17
|
+
args: [],
|
|
18
|
+
flags: parsed.flags,
|
|
19
|
+
context,
|
|
20
|
+
};
|
|
21
|
+
assertWritable(options);
|
|
22
|
+
const tag = readStringFlag(parsed.flags, "image-tag");
|
|
23
|
+
if (!tag) {
|
|
24
|
+
throw new Error("upgrade requires --image-tag <tag>.");
|
|
25
|
+
}
|
|
26
|
+
if (!instance.envFile) {
|
|
27
|
+
throw new Error(`Instance ${instanceName} has no env file, so its images are not managed by the CLI.`);
|
|
28
|
+
}
|
|
29
|
+
const envPath = resolve(instance.projectDirectory ?? context.cwd, instance.envFile);
|
|
30
|
+
const original = await readEnvFile(envPath);
|
|
31
|
+
const plan = planImageUpgrade(original, tag);
|
|
32
|
+
if (plan.changes.length === 0) {
|
|
33
|
+
context.stdout.write(`${instanceName} already uses image tag ${tag}.\n`);
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
context.stdout.write(`Upgrade ${instanceName}:\n`);
|
|
37
|
+
for (const change of plan.changes) {
|
|
38
|
+
context.stdout.write(` ${change.repository}: ${change.from} -> ${change.to}\n`);
|
|
39
|
+
}
|
|
40
|
+
const notes = new Set(plan.changes.flatMap((change) => migrationNotes(change.from, change.to)));
|
|
41
|
+
for (const note of notes) {
|
|
42
|
+
context.stdout.write(`Note: ${note}\n`);
|
|
43
|
+
}
|
|
44
|
+
if (!(await confirmUpgrade(parsed, context))) {
|
|
45
|
+
context.stdout.write("Upgrade cancelled. Nothing was changed.\n");
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
// Writing to the existing path keeps its owner-only permissions.
|
|
49
|
+
await writeFile(envPath, plan.content, "utf8");
|
|
50
|
+
const pulled = await runCompose(buildComposePullArgs(undefined), options);
|
|
51
|
+
if (pulled !== 0) {
|
|
52
|
+
await writeFile(envPath, original, "utf8");
|
|
53
|
+
context.stderr.write(`Pulling the new images failed. Restored the previous image tags in ${envPath}.\n`);
|
|
54
|
+
return pulled;
|
|
55
|
+
}
|
|
56
|
+
const recreated = await runCompose(buildComposeUpArgs(), options);
|
|
57
|
+
if (recreated !== 0) {
|
|
58
|
+
context.stderr.write(`The new images were pulled and ${envPath} now uses ${tag}, but recreating the services failed. Fix the error above and run eudiplo up.\n`);
|
|
59
|
+
return recreated;
|
|
60
|
+
}
|
|
61
|
+
context.stdout.write(`Upgraded ${instanceName} to ${tag}.\n`);
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
async function readEnvFile(path) {
|
|
65
|
+
try {
|
|
66
|
+
return await readFile(path, "utf8");
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (error instanceof Error &&
|
|
70
|
+
"code" in error &&
|
|
71
|
+
error.code === "ENOENT") {
|
|
72
|
+
throw new Error(`Env file not found: ${path}`);
|
|
73
|
+
}
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function confirmUpgrade(parsed, context) {
|
|
78
|
+
if (parsed.flags.yes === true) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
if (context.interactive !== true) {
|
|
82
|
+
throw new Error("upgrade requires --yes in non-interactive mode.");
|
|
83
|
+
}
|
|
84
|
+
const prompter = createPrompter(context);
|
|
85
|
+
try {
|
|
86
|
+
const answer = (await prompter.ask("Continue? [y/N]: "))
|
|
87
|
+
.trim()
|
|
88
|
+
.toLowerCase();
|
|
89
|
+
return answer === "y" || answer === "yes";
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
prompter.close();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/commands/upgrade/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACH,oBAAoB,EACpB,kBAAkB,GACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,cAAc,EACd,gBAAgB,GACnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,cAAc,EACd,UAAU,EACV,kBAAkB,GACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAOvE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,MAAiB,EACjB,MAAkB,EAClB,OAAuB;IAEvB,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjE,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,kBAAkB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AK,CAAC,CAAC;IAC9D,OAAO,CAAC,CAAC;AACb,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,IAAY;IACnC,IAAI,CAAC;QACD,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IACI,KAAK,YAAY,KAAK;YACtB,MAAM,IAAI,KAAK;YACf,KAAK,CAAC,IAAI,KAAK,QAAQ,EACzB,CAAC;YACC,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,KAAK,CAAC;IAChB,CAAC;AACL,CAAC;AAED,KAAK,UAAU,cAAc,CACzB,MAAkB,EAClB,OAAuB;IAEvB,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,OAAO,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;aACnD,IAAI,EAAE;aACN,WAAW,EAAE,CAAC;QACnB,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK,CAAC;IAC9C,CAAC;YAAS,CAAC;QACP,QAAQ,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { CommandContext } from "../../types.js";
|
|
3
|
+
import { type SetExitCode } from "../shared.js";
|
|
4
|
+
export declare function createUpgradeCommand(context: CommandContext, setExitCode: SetExitCode): Command;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/upgrade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAG1E,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,WAAW,GACzB,OAAO,CAkBT"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { loadCliState, parsedArgs } from "../shared.js";
|
|
3
|
+
import { runUpgradeCommand } from "./action.js";
|
|
4
|
+
export function createUpgradeCommand(context, setExitCode) {
|
|
5
|
+
return new Command("upgrade")
|
|
6
|
+
.description("Upgrade the EUDIPLO application images of a Compose deployment")
|
|
7
|
+
.requiredOption("--image-tag <tag>", "image tag to upgrade to")
|
|
8
|
+
.option("--instance <name>", "select a configured instance")
|
|
9
|
+
.option("--yes", "upgrade without asking for confirmation")
|
|
10
|
+
.action(async (options) => {
|
|
11
|
+
const { config } = await loadCliState(context);
|
|
12
|
+
setExitCode(await runUpgradeCommand(config, parsedArgs("upgrade", undefined, [], options), context));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/upgrade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAoB,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,UAAU,oBAAoB,CAChC,OAAuB,EACvB,WAAwB;IAExB,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;SACxB,WAAW,CACR,gEAAgE,CACnE;SACA,cAAc,CAAC,mBAAmB,EAAE,yBAAyB,CAAC;SAC9D,MAAM,CAAC,mBAAmB,EAAE,8BAA8B,CAAC;SAC3D,MAAM,CAAC,OAAO,EAAE,yCAAyC,CAAC;SAC1D,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACtB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;QAC/C,WAAW,CACP,MAAM,iBAAiB,CACnB,MAAM,EACN,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,EAC7C,OAAO,CACV,CACJ,CAAC;IACN,CAAC,CAAC,CAAC;AACX,CAAC"}
|