@forge/tunnel 6.3.2-next.0 → 6.3.2-next.10
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 +78 -0
- package/out/command/interactors/tunnel-interactor.js +1 -1
- package/out/command/start-tunnel-command.d.ts +0 -2
- package/out/command/start-tunnel-command.d.ts.map +1 -1
- package/out/command/start-tunnel-command.js +1 -35
- package/out/graphql/tunnel-graphql-client.d.ts.map +1 -1
- package/out/graphql/tunnel-graphql-client.js +15 -5
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
# @forge/tunnel
|
|
2
2
|
|
|
3
|
+
## 6.3.2-next.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 49bbec0: Display local port by default when tunneling
|
|
8
|
+
- Updated dependencies [49bbec0]
|
|
9
|
+
- @forge/cli-shared@8.9.0-next.7
|
|
10
|
+
- @forge/bundler@6.1.11-next.10
|
|
11
|
+
|
|
12
|
+
## 6.3.2-next.9
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [5efbe5a]
|
|
17
|
+
- @forge/cli-shared@8.9.0-next.6
|
|
18
|
+
- @forge/bundler@6.1.11-next.9
|
|
19
|
+
|
|
20
|
+
## 6.3.2-next.8
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- ef033a5: support container identity when tunneling
|
|
25
|
+
- Updated dependencies [ef033a5]
|
|
26
|
+
- @forge/cli-shared@8.8.2-next.5
|
|
27
|
+
- @forge/bundler@6.1.11-next.8
|
|
28
|
+
|
|
29
|
+
## 6.3.2-next.7
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- @forge/bundler@6.1.11-next.7
|
|
34
|
+
- @forge/cli-shared@8.8.2-next.4
|
|
35
|
+
|
|
36
|
+
## 6.3.2-next.6
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [ee02b2c]
|
|
41
|
+
- @forge/csp@5.3.0-next.1
|
|
42
|
+
- @forge/bundler@6.1.11-next.6
|
|
43
|
+
|
|
44
|
+
## 6.3.2-next.5
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- @forge/bundler@6.1.11-next.5
|
|
49
|
+
- @forge/cli-shared@8.8.2-next.3
|
|
50
|
+
|
|
51
|
+
## 6.3.2-next.4
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- @forge/bundler@6.1.11-next.4
|
|
56
|
+
|
|
57
|
+
## 6.3.2-next.3
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- @forge/bundler@6.1.11-next.3
|
|
62
|
+
- @forge/cli-shared@8.8.2-next.2
|
|
63
|
+
|
|
64
|
+
## 6.3.2-next.2
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [debdb02]
|
|
69
|
+
- @forge/csp@5.3.0-next.0
|
|
70
|
+
- @forge/bundler@6.1.11-next.2
|
|
71
|
+
|
|
72
|
+
## 6.3.2-next.1
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- aaf8a03: forge tunnel with containers: delete auto generated docker compose files upon failing to startup
|
|
77
|
+
- Updated dependencies [aaf8a03]
|
|
78
|
+
- @forge/cli-shared@8.8.2-next.1
|
|
79
|
+
- @forge/bundler@6.1.11-next.1
|
|
80
|
+
|
|
3
81
|
## 6.3.2-next.0
|
|
4
82
|
|
|
5
83
|
### Patch Changes
|
|
@@ -17,7 +17,7 @@ class TunnelInteractor {
|
|
|
17
17
|
}
|
|
18
18
|
logTunnelStatus(localPort, tunnelOptions) {
|
|
19
19
|
this.logger.info('');
|
|
20
|
-
this.logger.info(cli_shared_1.Text.tunnel.startedServer(localPort
|
|
20
|
+
this.logger.info(cli_shared_1.Text.tunnel.startedServer(localPort) + '\n');
|
|
21
21
|
if (tunnelOptions.url) {
|
|
22
22
|
this.logger.warn(cli_shared_1.Text.tunnel.selfManagedTunnel(tunnelOptions.url, localPort));
|
|
23
23
|
}
|
|
@@ -33,8 +33,6 @@ export declare class StartTunnelCommand {
|
|
|
33
33
|
private validateTunnelUrl;
|
|
34
34
|
private validateTunnelPort;
|
|
35
35
|
private stopServices;
|
|
36
|
-
stopDockerComposeStack: (composeFiles?: Record<string, string>) => Promise<void>;
|
|
37
|
-
private deleteDockerComposeFile;
|
|
38
36
|
private startFaaSTunnelServer;
|
|
39
37
|
private startResourceBasedTunnelsServers;
|
|
40
38
|
execute(options: StartTunnelOptions, containersDockerComposeFiles?: Record<string, string>): Promise<StartTunnelResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-tunnel-command.d.ts","sourceRoot":"","sources":["../../src/command/start-tunnel-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,MAAM,EAEN,aAAa,
|
|
1
|
+
{"version":3,"file":"start-tunnel-command.d.ts","sourceRoot":"","sources":["../../src/command/start-tunnel-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,MAAM,EAEN,aAAa,EAKd,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,iBAAiB,EAKlB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEzE,MAAM,W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O,CAClB,OAAO,EAAE,kBAAkB,EAC3B,4BAA4B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpD,OAAO,CAAC,iBAAiB,CAAC;CA0D9B"}
|
|
@@ -6,9 +6,6 @@ const cli_shared_1 = require("@forge/cli-shared");
|
|
|
6
6
|
const node_cache_1 = tslib_1.__importDefault(require("node-cache"));
|
|
7
7
|
const portfinder_1 = require("portfinder");
|
|
8
8
|
const servers_1 = require("../servers");
|
|
9
|
-
const docker_compose_1 = require("docker-compose");
|
|
10
|
-
const path = tslib_1.__importStar(require("path"));
|
|
11
|
-
const fs = tslib_1.__importStar(require("fs"));
|
|
12
9
|
class InvalidTunnelConfigError extends cli_shared_1.UserError {
|
|
13
10
|
constructor(message) {
|
|
14
11
|
super(message);
|
|
@@ -64,40 +61,9 @@ class StartTunnelCommand {
|
|
|
64
61
|
this.devServer.stop(),
|
|
65
62
|
...Object.values(this.tunnelServers).map((server) => server.stop()),
|
|
66
63
|
this.cspReporterServer?.stop(),
|
|
67
|
-
|
|
64
|
+
(0, cli_shared_1.stopDockerComposeStack)(this.configFile, containersDockerComposeFiles)
|
|
68
65
|
]);
|
|
69
66
|
};
|
|
70
|
-
stopDockerComposeStack = async (composeFiles) => {
|
|
71
|
-
if (!composeFiles || Object.keys(composeFiles).length === 0)
|
|
72
|
-
return;
|
|
73
|
-
const { services } = await this.configFile.readConfig();
|
|
74
|
-
const serviceWithTunnelConfigExists = services?.some((service) => service.containers?.some((container) => {
|
|
75
|
-
return !!container.tunnel;
|
|
76
|
-
}));
|
|
77
|
-
if (!services || services.length === 0 || !serviceWithTunnelConfigExists)
|
|
78
|
-
return;
|
|
79
|
-
await Promise.all(Object.entries(composeFiles).map(async ([serviceKey, file]) => {
|
|
80
|
-
try {
|
|
81
|
-
await (0, docker_compose_1.downAll)({ cwd: '.', log: true, config: file, composeOptions: [`-p${serviceKey}`] });
|
|
82
|
-
await this.deleteDockerComposeFile(file);
|
|
83
|
-
}
|
|
84
|
-
catch (err) {
|
|
85
|
-
throw new Error(cli_shared_1.Text.tunnel.unableToStopDockerComposeStack(serviceKey, err.message ?? 'Unknown Error Occurred.'));
|
|
86
|
-
}
|
|
87
|
-
}));
|
|
88
|
-
};
|
|
89
|
-
deleteDockerComposeFile = async (composeFile) => {
|
|
90
|
-
if (fs.existsSync(composeFile)) {
|
|
91
|
-
fs.unlinkSync(composeFile);
|
|
92
|
-
}
|
|
93
|
-
const hiddenDir = path.join(process.cwd(), '.services');
|
|
94
|
-
if (fs.existsSync(hiddenDir)) {
|
|
95
|
-
const files = fs.readdirSync(hiddenDir);
|
|
96
|
-
if (files.length == 0) {
|
|
97
|
-
fs.rmdirSync(hiddenDir);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
67
|
startFaaSTunnelServer = async ({ port, appId, environmentKey, tunnelUrl }) => {
|
|
102
68
|
const { permissions = {}, remotes = [] } = await this.configFile.readConfig();
|
|
103
69
|
const serverInfo = await this.devServer.start(port, permissions, remotes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-graphql-client.d.ts","sourceRoot":"","sources":["../../src/graphql/tunnel-graphql-client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,EACL,aAAa,EAGb,oBAAoB,EAGpB,kBAAkB,EAClB,cAAc,
|
|
1
|
+
{"version":3,"file":"tunnel-graphql-client.d.ts","sourceRoot":"","sources":["../../src/graphql/tunnel-graphql-client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,EACL,aAAa,EAGb,oBAAoB,EAGpB,kBAAkB,EAClB,cAAc,EAIf,MAAM,mBAAmB,CAAC;AAa3B,qBAAa,sBAAuB,SAAQ,oBAAqB,YAAW,kBAAkB;IAC5F,OAAO,CAAC,MAAM,CAAC,cAAc,CAAqD;IAClF,OAAO,CAAC,S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MAAM,EACb,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,iBAAiB,GACnC,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IA0C/B,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAsC1E"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TunnelGraphqlClient = exports.RegisterAppTunnelError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
-
const
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
8
|
class CreateAppTunnelError extends cli_shared_1.GraphQlMutationError {
|
|
7
9
|
constructor(message, { requestId, code, statusCode }) {
|
|
8
|
-
super(
|
|
10
|
+
super(cli_shared_1.Text.tunnel.error.create(message), { requestId, code, statusCode });
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
class RegisterAppTunnelError extends cli_shared_1.GraphQlMutationError {
|
|
12
14
|
static userErrorCodes = ['ENVIRONMENT_MISMATCH', 'ENVIRONMENT_NOT_FOUND'];
|
|
13
15
|
errorCode;
|
|
14
16
|
constructor(message, { requestId, code, statusCode }) {
|
|
15
|
-
super(
|
|
17
|
+
super(cli_shared_1.Text.tunnel.error.create(message), { requestId, code, statusCode });
|
|
16
18
|
this.errorCode = code;
|
|
17
19
|
}
|
|
18
20
|
getAttributes() {
|
|
@@ -27,7 +29,7 @@ class RegisterAppTunnelError extends cli_shared_1.GraphQlMutationError {
|
|
|
27
29
|
exports.RegisterAppTunnelError = RegisterAppTunnelError;
|
|
28
30
|
class DeleteAppTunnelError extends cli_shared_1.GraphQlMutationError {
|
|
29
31
|
constructor(message, { requestId, code, statusCode }) {
|
|
30
|
-
super(
|
|
32
|
+
super(cli_shared_1.Text.tunnel.error.delete(message), { requestId, code, statusCode });
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
class TunnelGraphqlClient {
|
|
@@ -50,10 +52,11 @@ class TunnelGraphqlClient {
|
|
|
50
52
|
tunnelId
|
|
51
53
|
tunnelToken
|
|
52
54
|
tunnelUrl
|
|
55
|
+
tunnelK8AuthToken
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
`;
|
|
56
|
-
const { response: { registerTunnel: { success, errors, tunnelId, tunnelToken, tunnelUrl } }, requestId } = await this.graphqlClient.mutate(mutation, {
|
|
59
|
+
const { response: { registerTunnel: { success, errors, tunnelId, tunnelToken, tunnelUrl, tunnelK8AuthToken } }, requestId } = await this.graphqlClient.mutate(mutation, {
|
|
57
60
|
input: {
|
|
58
61
|
appId,
|
|
59
62
|
environmentKey
|
|
@@ -67,6 +70,13 @@ class TunnelGraphqlClient {
|
|
|
67
70
|
statusCode: error.statusCode
|
|
68
71
|
});
|
|
69
72
|
}
|
|
73
|
+
if (tunnelK8AuthToken) {
|
|
74
|
+
const k8sAuthTokenPath = path_1.default.join(process.cwd(), cli_shared_1.CONTAINER_SERVICE_ASSETS, cli_shared_1.K8S_AUTH_TOKEN_FILENAME);
|
|
75
|
+
if (!fs_1.default.existsSync(path_1.default.dirname(k8sAuthTokenPath))) {
|
|
76
|
+
fs_1.default.mkdirSync(path_1.default.dirname(k8sAuthTokenPath), { recursive: true });
|
|
77
|
+
}
|
|
78
|
+
fs_1.default.writeFileSync(k8sAuthTokenPath, tunnelK8AuthToken);
|
|
79
|
+
}
|
|
70
80
|
return {
|
|
71
81
|
id: tunnelId,
|
|
72
82
|
token: tunnelToken,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/tunnel",
|
|
3
|
-
"version": "6.3.2-next.
|
|
3
|
+
"version": "6.3.2-next.10",
|
|
4
4
|
"description": "Tunnel functionality for Forge CLI",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"compile": "tsc -b -v"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@forge/bundler": "6.1.11-next.
|
|
15
|
-
"@forge/cli-shared": "8.
|
|
16
|
-
"@forge/csp": "5.
|
|
14
|
+
"@forge/bundler": "6.1.11-next.10",
|
|
15
|
+
"@forge/cli-shared": "8.9.0-next.7",
|
|
16
|
+
"@forge/csp": "5.3.0-next.1",
|
|
17
17
|
"@forge/runtime": "6.1.1",
|
|
18
18
|
"@forge/util": "^2.0.1",
|
|
19
19
|
"cheerio": "^1.1.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@atlassian/xen-test-util": "^4.2.0",
|
|
36
|
-
"@forge/manifest": "11.0.0-next.
|
|
36
|
+
"@forge/manifest": "11.0.0-next.3",
|
|
37
37
|
"@types/express": "^4.17.21",
|
|
38
38
|
"@types/jest": "^29.5.14",
|
|
39
39
|
"@types/node": "20.19.1",
|