@forge/cli-shared 9.4.1-next.3-experimental-e9e08bb → 9.4.1-next.4
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/CHANGELOG.md +2 -12
- package/out/file-system/archiver.d.ts +1 -1
- package/out/file-system/archiver.d.ts.map +1 -1
- package/out/file-system/archiver.js +8 -6
- package/out/tunnel/docker-compose-lifecycle.d.ts +0 -3
- package/out/tunnel/docker-compose-lifecycle.d.ts.map +1 -1
- package/out/tunnel/docker-compose-lifecycle.js +8 -10
- package/out/tunnel/index.d.ts +0 -1
- package/out/tunnel/index.d.ts.map +1 -1
- package/out/tunnel/index.js +0 -1
- package/out/tunnel/tunnel-options.d.ts +0 -2
- package/out/tunnel/tunnel-options.d.ts.map +1 -1
- package/package.json +2 -2
- package/out/tunnel/compose-project-lifecycle.d.ts +0 -39
- package/out/tunnel/compose-project-lifecycle.d.ts.map +0 -1
- package/out/tunnel/compose-project-lifecycle.js +0 -105
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
# @forge/cli-shared
|
|
2
2
|
|
|
3
|
-
## 9.4.1-next.
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 067c20a: Add manifest-driven Docker local storage, seeding, reset, status, persistent lifecycle, and local
|
|
8
|
-
SDK routing for Forge tunnels. Simplify `forge storage entities indexes list` to
|
|
9
|
-
`forge storage indexes list`.
|
|
3
|
+
## 9.4.1-next.4
|
|
10
4
|
|
|
11
5
|
### Patch Changes
|
|
12
6
|
|
|
13
|
-
-
|
|
14
|
-
- Updated dependencies [db66d54]
|
|
15
|
-
- Updated dependencies [40260f5]
|
|
16
|
-
- Updated dependencies [0795370]
|
|
17
|
-
- @forge/manifest@13.4.0-next.3-experimental-e9e08bb
|
|
7
|
+
- b7996ba: Fix tunnel debugging
|
|
18
8
|
|
|
19
9
|
## 9.4.1-next.3
|
|
20
10
|
|
|
@@ -25,7 +25,7 @@ export declare class ZipArchiver extends Archiver {
|
|
|
25
25
|
}
|
|
26
26
|
export declare class DirectoryArchiver extends Archiver {
|
|
27
27
|
private readonly target;
|
|
28
|
-
constructor(target: string);
|
|
28
|
+
constructor(target: string, clear?: boolean);
|
|
29
29
|
addContent(fileName: string, contents: Buffer): void;
|
|
30
30
|
addFrom(fileName: string, filePath: string): void;
|
|
31
31
|
finalise(): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/file-system/archiver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,8BAAsB,QAAQ;aACZ,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;aAKpD,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;aACjD,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAMpC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI;CAS5D;AAED,qBAAa,aAAc,SAAQ,SAAS;CAAG;AA4B/C,qBAAa,WAAY,SAAQ,QAAQ;IAMrC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB,OAAO,CAAC,QAAQ,CAAqC;IACrD,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,OAAO,CAAmC;IAElD,OAAO;WAaa,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAKzD,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMpD,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,Q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AI,OAAO,CAAC,MAAM,CAAC;IAS3B,SAAS,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI;IAIzC,OAAO,CAAC,cAAc,CAKpB;IAEF,OAAO,CAAC,OAAO,CAIb;CACH;AAED,qBAAa,iBAAkB,SAAQ,QAAQ;IAE3C,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM,EAC/B,KAAK,UAAO;IAYP,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAWpD,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAU3C,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;CAGzC;AAED,qBAAa,aAAc,SAAQ,QAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,QAAQ,EAAE;IAI3C,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMpD,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAM3C,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;CAIzC"}
|
|
@@ -94,14 +94,16 @@ class ZipArchiver extends Archiver {
|
|
|
94
94
|
exports.ZipArchiver = ZipArchiver;
|
|
95
95
|
class DirectoryArchiver extends Archiver {
|
|
96
96
|
target;
|
|
97
|
-
constructor(target) {
|
|
97
|
+
constructor(target, clear = true) {
|
|
98
98
|
super();
|
|
99
99
|
this.target = target;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
if (clear) {
|
|
101
|
+
try {
|
|
102
|
+
(0, fs_1.rmSync)(this.target, { recursive: true, force: true });
|
|
103
|
+
}
|
|
104
|
+
catch (e) {
|
|
105
|
+
throw new ArchiverError(e.message);
|
|
106
|
+
}
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
addContent(fileName, contents) {
|
|
@@ -6,7 +6,6 @@ import { ChildProcess } from 'child_process';
|
|
|
6
6
|
export declare const PROXY_SIDECAR_VOLUME_DIR = "/forge/container";
|
|
7
7
|
export declare const CONTAINER_SERVICE_ASSETS = ".container-service-assets";
|
|
8
8
|
export declare const K8S_AUTH_TOKEN_FILENAME = "local-account";
|
|
9
|
-
export declare const DOCKER_LIFECYCLE_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
|
|
10
9
|
export declare const STARTUP_TIMER_MS: number;
|
|
11
10
|
export declare const STARTUP_TIMER_BUFFER_MS: number;
|
|
12
11
|
export declare class InvalidContainerServicePort extends UserError {
|
|
@@ -33,9 +32,7 @@ export declare class DockerAuthenticationError extends UserError {
|
|
|
33
32
|
export declare const generateContainersDockerComposeFile: (services: Services, appId: string, envId: string) => Promise<Record<string, string>>;
|
|
34
33
|
export declare const deleteDockerComposeFile: (composeFile: string) => Promise<void>;
|
|
35
34
|
export declare const startDockerComposeStack: (dockerComposeFilePath: string, serviceKey: string, logger: Logger) => Promise<void>;
|
|
36
|
-
export declare const getDockerComposeErrorMessage: (error: unknown) => string;
|
|
37
35
|
export declare const determineComposeFlags: (dockerComposeFilePath: string, serviceKey: string, logger: Logger) => Promise<string[]>;
|
|
38
36
|
export declare const stopDockerComposeStack: (configFile: ConfigFile, logger: Logger, composeFiles?: Record<string, string>) => Promise<void>;
|
|
39
|
-
export declare const createDockerLifecycleLogFilter: (logger: Logger) => (chunk: Buffer) => void;
|
|
40
37
|
export declare const processDockerAuthentication: (childProcess: ChildProcess) => Promise<void>;
|
|
41
38
|
//# sourceMappingURL=docker-compose-lifecycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker-compose-lifecycle.d.ts","sourceRoot":"","sources":["../../src/tunnel/docker-compose-lifecycle.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,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Q,SAAS;gBAChD,YAAY,EAAE,MAAM;CAGjC;AAED,qBAAa,sCAAuC,SAAQ,SAAS;gBACvD,YAAY,EAAE,MAAM;CAGjC;AAED,qBAAa,yBAA0B,SAAQ,SAAS;gBAC1C,OAAO,EAAE,MAAM;CAG5B;AAMD,eAAO,MAAM,mCAAmC,GAAU,UAAU,QAAQ,EAAE,OAAO,MAAM,EAAE,OAAO,MAAM,oCAgFzG,CAAC;AAsFF,eAAO,MAAM,uBAAuB,GAAU,aAAa,MAAM,kBAYhE,CAAC;AAOF,eAAO,MAAM,uBAAuB,GAAU,uBAAuB,MAAM,EAAE,YAAY,MAAM,EAAE,QAAQ,MAAM,kBA8B9G,CAAC;AA6BF,eAAO,MAAM,qBAAqB,GAChC,uBAAuB,MAAM,EAC7B,YAAY,MAAM,EAClB,QAAQ,MAAM,KACb,OAAO,CAAC,MAAM,EAAE,CAgBlB,CAAC;AA2LF,eAAO,MAAM,sBAAsB,GACjC,YAAY,UAAU,EACtB,QAAQ,MAAM,EACd,eAAe,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,kBAmCtC,CAAC;AAgCF,eAAO,MAAM,2BAA2B,GAAU,cAAc,YAAY,kBAW3E,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processDockerAuthentication = exports.
|
|
3
|
+
exports.processDockerAuthentication = exports.stopDockerComposeStack = exports.determineComposeFlags = exports.startDockerComposeStack = exports.deleteDockerComposeFile = exports.generateContainersDockerComposeFile = exports.DockerAuthenticationError = exports.CannotUseBothImageAndBuildContextError = exports.MissingImageOrBuildContextError = exports.UnableToParseDockerComposeFileError = exports.DockerUnableToStartError = exports.DockerUnableToPullProxySidecarImage = exports.InvalidContainerServicePort = exports.STARTUP_TIMER_BUFFER_MS = exports.STARTUP_TIMER_MS = exports.K8S_AUTH_TOKEN_FILENAME = exports.CONTAINER_SERVICE_ASSETS = exports.PROXY_SIDECAR_VOLUME_DIR = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
6
|
const path = tslib_1.__importStar(require("path"));
|
|
@@ -28,7 +28,7 @@ const PROXY_SIDECAR_REGISTRIES = {
|
|
|
28
28
|
};
|
|
29
29
|
const isStagingEnvironment = () => process.env.FORGE_GRAPHQL_GATEWAY?.startsWith('https://api-private.stg.atlassian.com/graphql') ?? false;
|
|
30
30
|
const getProxySidecarRegistry = (registryType) => PROXY_SIDECAR_REGISTRIES[registryType][isStagingEnvironment() ? 'staging' : 'production'];
|
|
31
|
-
|
|
31
|
+
const LIFECYCLE_PATTERNS = [
|
|
32
32
|
/Container .* (Starting|Started|Stopping|Stopped|Creating|Created|Recreated)/,
|
|
33
33
|
/Network .* (Creating|Created|Removing|Removed)/,
|
|
34
34
|
/Volume .* (Creating|Created|Removing|Removed)/,
|
|
@@ -217,7 +217,7 @@ const startDockerComposeStack = async (dockerComposeFilePath, serviceKey, logger
|
|
|
217
217
|
await (0, docker_compose_1.pullOne)(PROXY_SIDECAR_SERVICE_NAME, pullOptions);
|
|
218
218
|
}
|
|
219
219
|
catch (ecrRegistryError) {
|
|
220
|
-
throw new DockerUnableToPullProxySidecarImage(new Error(`Initial pull error: ${
|
|
220
|
+
throw new DockerUnableToPullProxySidecarImage(new Error(`Initial pull error: ${getDockerComposeErrorMessage(portableRegistryError)}. Retry error: ${getDockerComposeErrorMessage(ecrRegistryError)}`));
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
await waitForContainersToStart(dockerComposeFilePath, serviceKey, logger);
|
|
@@ -230,7 +230,6 @@ const getDockerComposeErrorMessage = (error) => {
|
|
|
230
230
|
}
|
|
231
231
|
return error != null ? String(error) : 'Unknown Error Occurred.';
|
|
232
232
|
};
|
|
233
|
-
exports.getDockerComposeErrorMessage = getDockerComposeErrorMessage;
|
|
234
233
|
const useEcrProxySidecarImage = (dockerComposeFilePath) => {
|
|
235
234
|
const composeConfig = yaml.parse(fs.readFileSync(dockerComposeFilePath, 'utf8'));
|
|
236
235
|
const proxySidecar = composeConfig?.services?.[PROXY_SIDECAR_SERVICE_NAME];
|
|
@@ -343,7 +342,7 @@ const waitForContainersToStart = async (dockerComposeFilePath, serviceKey, logge
|
|
|
343
342
|
lines.forEach((line) => {
|
|
344
343
|
if (!line.trim())
|
|
345
344
|
return;
|
|
346
|
-
if (
|
|
345
|
+
if (LIFECYCLE_PATTERNS.some((pattern) => pattern.test(line))) {
|
|
347
346
|
logger.info(line);
|
|
348
347
|
}
|
|
349
348
|
});
|
|
@@ -356,7 +355,7 @@ const waitForContainersToStart = async (dockerComposeFilePath, serviceKey, logge
|
|
|
356
355
|
callback: logFilter
|
|
357
356
|
}).catch((error) => {
|
|
358
357
|
clearTimeout(startupTimer);
|
|
359
|
-
reject(new DockerUnableToStartError(new Error(
|
|
358
|
+
reject(new DockerUnableToStartError(new Error(getDockerComposeErrorMessage(error))));
|
|
360
359
|
});
|
|
361
360
|
setTimeout(async () => {
|
|
362
361
|
if (containersStarted)
|
|
@@ -400,7 +399,7 @@ const stopDockerComposeStack = async (configFile, logger, composeFiles) => {
|
|
|
400
399
|
log: false,
|
|
401
400
|
config: file,
|
|
402
401
|
composeOptions: [`-p${serviceKey}`],
|
|
403
|
-
callback: (
|
|
402
|
+
callback: createCustomLogFilter(logger)
|
|
404
403
|
});
|
|
405
404
|
await (0, exports.deleteDockerComposeFile)(file);
|
|
406
405
|
}
|
|
@@ -411,7 +410,7 @@ const stopDockerComposeStack = async (configFile, logger, composeFiles) => {
|
|
|
411
410
|
deleteContainerServiceAssetsDir();
|
|
412
411
|
};
|
|
413
412
|
exports.stopDockerComposeStack = stopDockerComposeStack;
|
|
414
|
-
const
|
|
413
|
+
const createCustomLogFilter = (logger) => {
|
|
415
414
|
let buffer = '';
|
|
416
415
|
return (chunk) => {
|
|
417
416
|
buffer += chunk.toString();
|
|
@@ -420,13 +419,12 @@ const createDockerLifecycleLogFilter = (logger) => {
|
|
|
420
419
|
lines.forEach((line) => {
|
|
421
420
|
if (!line.trim())
|
|
422
421
|
return;
|
|
423
|
-
if (
|
|
422
|
+
if (LIFECYCLE_PATTERNS.some((pattern) => pattern.test(line))) {
|
|
424
423
|
logger.info(line);
|
|
425
424
|
}
|
|
426
425
|
});
|
|
427
426
|
};
|
|
428
427
|
};
|
|
429
|
-
exports.createDockerLifecycleLogFilter = createDockerLifecycleLogFilter;
|
|
430
428
|
const processDockerAuthentication = async (childProcess) => {
|
|
431
429
|
await new Promise((resolve, reject) => {
|
|
432
430
|
childProcess.on('close', (code) => {
|
package/out/tunnel/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tunnel/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tunnel/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
|
package/out/tunnel/index.js
CHANGED
|
@@ -2,5 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./docker-compose-lifecycle"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./compose-project-lifecycle"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./tunnel-options"), exports);
|
|
@@ -8,13 +8,11 @@ export type TunnelCommandOptions = {
|
|
|
8
8
|
verify?: boolean;
|
|
9
9
|
url?: string;
|
|
10
10
|
localPort?: number;
|
|
11
|
-
localStorage?: boolean;
|
|
12
11
|
};
|
|
13
12
|
export type TunnelOptions = Omit<TunnelCommandOptions, 'debugStartingPort'> & {
|
|
14
13
|
debugStartingPort: number;
|
|
15
14
|
assistantName?: string | null;
|
|
16
15
|
containersDockerComposeFiles?: Record<string, string>;
|
|
17
|
-
localStorageCleanup?: () => Promise<void>;
|
|
18
16
|
};
|
|
19
17
|
export declare const defaultDebugStartingPort = 9229;
|
|
20
18
|
export declare const defaultDebugHost = "127.0.0.1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-options.d.ts","sourceRoot":"","sources":["../../src/tunnel/tunnel-options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"tunnel-options.d.ts","sourceRoot":"","sources":["../../src/tunnel/tunnel-options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,GAAG;IAC5E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,4BAA4B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAC7C,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAC5C,eAAO,MAAM,uBAAuB,QAA8C,CAAC;AACnF,eAAO,MAAM,2BAA2B,EAAE,aAIzC,CAAC;AAEF,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAC/C,eAAO,MAAM,8BAA8B,OAAO,CAAC;AACnD,eAAO,MAAM,2CAA2C,OAAO,CAAC;AAQhE,wBAAsB,cAAc,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAQ1G"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/cli-shared",
|
|
3
|
-
"version": "9.4.1-next.
|
|
3
|
+
"version": "9.4.1-next.4",
|
|
4
4
|
"description": "Common functionality for Forge CLI",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"generate-graphql-types": "graphql-codegen --config src/graphql/codegen.yml"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@forge/manifest": "13.4.0-next.3
|
|
15
|
+
"@forge/manifest": "13.4.0-next.3",
|
|
16
16
|
"@forge/util": "3.0.0",
|
|
17
17
|
"@forge/i18n": "1.0.0",
|
|
18
18
|
"@sentry/node": "7.106.0",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../ui/logger';
|
|
2
|
-
export interface ComposeCommandResult {
|
|
3
|
-
out?: string;
|
|
4
|
-
err?: string;
|
|
5
|
-
exitCode?: number;
|
|
6
|
-
}
|
|
7
|
-
export interface ComposeOptions {
|
|
8
|
-
cwd: string;
|
|
9
|
-
log: boolean;
|
|
10
|
-
config: string;
|
|
11
|
-
composeOptions: string[];
|
|
12
|
-
callback?: (chunk: Buffer) => void;
|
|
13
|
-
}
|
|
14
|
-
export interface ComposeAdapter {
|
|
15
|
-
pullOne(service: string, options: ComposeOptions): Promise<unknown>;
|
|
16
|
-
exec(command: string, args: string[], options: ComposeOptions): Promise<ComposeCommandResult>;
|
|
17
|
-
down(options: ComposeOptions): Promise<unknown>;
|
|
18
|
-
}
|
|
19
|
-
export interface ComposeServiceState {
|
|
20
|
-
name: string;
|
|
21
|
-
service: string;
|
|
22
|
-
state: string;
|
|
23
|
-
health?: string;
|
|
24
|
-
}
|
|
25
|
-
export declare class ComposeProjectLifecycle {
|
|
26
|
-
private readonly configPath;
|
|
27
|
-
private readonly projectName;
|
|
28
|
-
private readonly logger;
|
|
29
|
-
private readonly adapter;
|
|
30
|
-
constructor(configPath: string, projectName: string, logger: Logger, adapter?: ComposeAdapter);
|
|
31
|
-
private options;
|
|
32
|
-
pull(services: string[]): Promise<void>;
|
|
33
|
-
up(services: string[]): Promise<void>;
|
|
34
|
-
down(): Promise<void>;
|
|
35
|
-
states(): Promise<ComposeServiceState[]>;
|
|
36
|
-
logs(service: string, lines?: number): Promise<string>;
|
|
37
|
-
}
|
|
38
|
-
export declare const parseComposePs: (output: string) => ComposeServiceState[];
|
|
39
|
-
//# sourceMappingURL=compose-project-lifecycle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compose-project-lifecycle.d.ts","sourceRoot":"","sources":["../../src/tunnel/compose-project-lifecycle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ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MAAM,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IASxC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,MAAM,CAAC;CAYhE;AAED,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,mBAAmB,EAyBlE,CAAC"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseComposePs = exports.ComposeProjectLifecycle = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path = tslib_1.__importStar(require("path"));
|
|
6
|
-
const docker_compose_1 = require("docker-compose");
|
|
7
|
-
const docker_compose_lifecycle_1 = require("./docker-compose-lifecycle");
|
|
8
|
-
const defaultAdapter = {
|
|
9
|
-
pullOne: (service, options) => (0, docker_compose_1.pullOne)(service, options),
|
|
10
|
-
exec: (command, args, options) => (0, docker_compose_1.execCompose)(command, args, options),
|
|
11
|
-
down: (options) => (0, docker_compose_1.downAll)(options)
|
|
12
|
-
};
|
|
13
|
-
class ComposeProjectLifecycle {
|
|
14
|
-
configPath;
|
|
15
|
-
projectName;
|
|
16
|
-
logger;
|
|
17
|
-
adapter;
|
|
18
|
-
constructor(configPath, projectName, logger, adapter = defaultAdapter) {
|
|
19
|
-
this.configPath = configPath;
|
|
20
|
-
this.projectName = projectName;
|
|
21
|
-
this.logger = logger;
|
|
22
|
-
this.adapter = adapter;
|
|
23
|
-
}
|
|
24
|
-
options(log = false) {
|
|
25
|
-
return {
|
|
26
|
-
cwd: path.dirname(this.configPath),
|
|
27
|
-
log,
|
|
28
|
-
config: this.configPath,
|
|
29
|
-
composeOptions: [`-p${this.projectName}`],
|
|
30
|
-
callback: (0, docker_compose_lifecycle_1.createDockerLifecycleLogFilter)(this.logger)
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
async pull(services) {
|
|
34
|
-
for (const service of services) {
|
|
35
|
-
try {
|
|
36
|
-
await this.adapter.pullOne(service, this.options());
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
throw new Error(`Unable to pull the ${service} image: ${(0, docker_compose_lifecycle_1.getDockerComposeErrorMessage)(error)}`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async up(services) {
|
|
44
|
-
try {
|
|
45
|
-
await this.adapter.exec('up', ['--detach', '--no-build', '--remove-orphans', ...services], this.options());
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
throw new Error(`Unable to start the Docker Compose project: ${(0, docker_compose_lifecycle_1.getDockerComposeErrorMessage)(error)}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async down() {
|
|
52
|
-
try {
|
|
53
|
-
await this.adapter.down(this.options());
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
throw new Error(`Unable to stop the Docker Compose project: ${(0, docker_compose_lifecycle_1.getDockerComposeErrorMessage)(error)}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async states() {
|
|
60
|
-
try {
|
|
61
|
-
const result = await this.adapter.exec('ps', ['--all', '--format', 'json'], this.options());
|
|
62
|
-
return (0, exports.parseComposePs)(result.out ?? '');
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
throw new Error(`Unable to inspect the Docker Compose project: ${(0, docker_compose_lifecycle_1.getDockerComposeErrorMessage)(error)}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async logs(service, lines = 80) {
|
|
69
|
-
try {
|
|
70
|
-
const result = await this.adapter.exec('logs', ['--no-color', '--tail', lines.toString(), service], this.options());
|
|
71
|
-
return [result.out, result.err].filter(Boolean).join('\n').trim();
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
return (0, docker_compose_lifecycle_1.getDockerComposeErrorMessage)(error);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.ComposeProjectLifecycle = ComposeProjectLifecycle;
|
|
79
|
-
const parseComposePs = (output) => {
|
|
80
|
-
const trimmed = output.trim();
|
|
81
|
-
if (!trimmed)
|
|
82
|
-
return [];
|
|
83
|
-
const records = (() => {
|
|
84
|
-
try {
|
|
85
|
-
const parsed = JSON.parse(trimmed);
|
|
86
|
-
return Array.isArray(parsed) ? parsed : [parsed];
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
return trimmed
|
|
90
|
-
.split('\n')
|
|
91
|
-
.filter(Boolean)
|
|
92
|
-
.map((line) => JSON.parse(line));
|
|
93
|
-
}
|
|
94
|
-
})();
|
|
95
|
-
return records.map((item) => {
|
|
96
|
-
const value = item;
|
|
97
|
-
return {
|
|
98
|
-
name: String(value.Name ?? value.name ?? ''),
|
|
99
|
-
service: String(value.Service ?? value.service ?? ''),
|
|
100
|
-
state: String(value.State ?? value.state ?? ''),
|
|
101
|
-
health: value.Health == null && value.health == null ? undefined : String(value.Health ?? value.health)
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
exports.parseComposePs = parseComposePs;
|