Skip to content

Commit 0f3402b

Browse files
committed
fix ci (hopefully)
Signed-off-by: flakey5 <[email protected]>
1 parent ad08153 commit 0f3402b

File tree

4 files changed

+53
-76
lines changed

4 files changed

+53
-76
lines changed

packages/containers-shared/src/ssh.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ export function createSshTcpProxy(sshResponse: WranglerSSHResponse): Server {
4343

4444
hasConnection = true;
4545

46+
inbound.on("error", (err) => {
47+
console.error("Proxy error: ", err);
48+
});
49+
4650
const ws = new WebSocket(sshResponse.url, {
4751
headers: {
4852
authorization: `Bearer ${sshResponse.token}`,
@@ -61,10 +65,6 @@ export function createSshTcpProxy(sshResponse: WranglerSSHResponse): Server {
6165
ws.send(data);
6266
});
6367

64-
inbound.on("error", (err) => {
65-
console.error("Proxy error: ", err);
66-
});
67-
6868
inbound.on("close", () => {
6969
ws.close();
7070
proxy.close();

packages/wrangler/src/__tests__/containers/ssh.test.ts

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@ describe("containers ssh", () => {
3939
-v, --version Show version number [boolean]
4040
4141
OPTIONS
42-
--cipher SSH option for cipher_spec (-c) [string]
43-
--log-file SSH option for log_file (-c) [string]
44-
--escape-char SSH option for escape_char (-e) [string]
45-
--config-file SSH option for config-file (-F) [string]
46-
--pkcs11 SSH option for pkcs11 (-I) [string]
47-
--identity-file SSH option for identity_file (-i) [string]
48-
--mac-spec SSH option for mac_spec (-m) [string]
49-
--ctl-cmd SSH option for ctl_cmd (-O) [string]
50-
--option SSH option for option (-o) [string]
51-
--tag SSH option for tag (-P) [string]
52-
--ctl-path SSH option for ctl_path (-S) [string]"
42+
--cipher SSH option: Selects the cipher specification for encrypting the session [string]
43+
--log-file SSH option: Append debug logs to log_file instead of standard error [string]
44+
--escape-char SSH option: Sets the escape character for sessions with a pty (default: ‘~’) [string]
45+
--config-file SSH option: Specifies an alternative per-user configuration file [string]
46+
--pkcs11 SSH option: Specify the PKCS#11 shared library ssh should use to communicate with a PKCS#11 token providing keys for user authentication [string]
47+
--identity-file SSH option: Selects a file from which the identity (private key) for public key authentication is read [string]
48+
--mac-spec SSH option: A comma-separated list of MAC (message authentication code) algorithms, specified in order of preference [string]
49+
--option SSH option: Can be used to give options in the format used in the configuration file [string]
50+
--tag SSH option: Specify a tag name that may be used to select configuration in ssh_config(5) [string]"
5351
`);
5452
});
5553

@@ -89,38 +87,30 @@ describe("containers ssh", () => {
8987
// actual ssh attempt will fail since we don't have an ssh instance to test
9088
// against, but everything up until that point is covered.
9189
it("should try ssh'ing into a container", async () => {
92-
try {
93-
const instanceId = "a".repeat(64);
94-
const wsUrl = "ws://localhost:1234";
95-
const sshJwt = "asd";
96-
97-
setWranglerConfig({});
98-
msw.use(
99-
http.get(`*/instances/:instanceId/ssh`, async () => {
100-
return new HttpResponse(
101-
`{"success": true, "result": {"url": "${wsUrl}", "token": "${sshJwt}"}}`,
102-
{
103-
type: "applicaton/json",
104-
status: 200,
105-
}
106-
);
107-
})
108-
);
109-
110-
const mockWebSocket = new MockWebSocketServer(wsUrl);
111-
112-
await expect(runWrangler(`containers ssh ${instanceId}`)).rejects
113-
.toMatchInlineSnapshot(`
90+
const instanceId = "a".repeat(64);
91+
const wsUrl = "ws://localhost:1234";
92+
const sshJwt = "asd";
93+
94+
setWranglerConfig({});
95+
msw.use(
96+
http.get(`*/instances/:instanceId/ssh`, async () => {
97+
return new HttpResponse(
98+
`{"success": true, "result": {"url": "${wsUrl}", "token": "${sshJwt}"}}`,
99+
{
100+
type: "applicaton/json",
101+
status: 200,
102+
}
103+
);
104+
})
105+
);
106+
107+
const mockWebSocket = new MockWebSocketServer(wsUrl);
108+
await expect(runWrangler(`containers ssh ${instanceId}`)).rejects
109+
.toMatchInlineSnapshot(`
114110
[Error: ssh exited unsuccessfully. Is the container running?]
115111
`);
116112

117-
// We got a connection
118-
expect(mockWebSocket.connected).toBeTruthy();
119-
} catch (err) {
120-
if (err instanceof Error) {
121-
console.error(err.stack);
122-
}
123-
throw err;
124-
}
113+
// We got a connection
114+
expect(mockWebSocket.connected).toBeTruthy();
125115
});
126116
});

packages/wrangler/src/config/validation.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,13 +2749,6 @@ function validateContainerApp(
27492749
}
27502750

27512751
if ("wrangler_ssh" in containerAppOptional) {
2752-
validateAdditionalProperties(
2753-
diagnostics,
2754-
`${field}.wrangler_ssh`,
2755-
Object.keys(containerAppOptional.wrangler_ssh),
2756-
["enabled", "port"]
2757-
);
2758-
27592752
if (
27602753
!isRequiredProperty(
27612754
containerAppOptional.wrangler_ssh,
@@ -2800,13 +2793,6 @@ function validateContainerApp(
28002793
const fieldPath = `${field}.authorized_keys[${index}]`;
28012794
const key = containerAppOptional.authorized_keys[index];
28022795

2803-
validateAdditionalProperties(
2804-
diagnostics,
2805-
fieldPath,
2806-
Object.keys(key),
2807-
["name", "public_key"]
2808-
);
2809-
28102796
if (!isRequiredProperty(key, "name", "string")) {
28112797
diagnostics.errors.push(`${fieldPath}.name must be a string`);
28122798
}

packages/wrangler/src/containers/containers.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,47 +167,48 @@ export function sshYargs(args: CommonYargsArgv) {
167167
})
168168
// Following are SSH flags that should be directly passed in
169169
.option("cipher", {
170-
describe: "SSH option for cipher_spec (-c)",
170+
describe:
171+
"SSH option: Selects the cipher specification for encrypting the session",
171172
type: "string",
172173
})
173174
.option("log-file", {
174-
describe: "SSH option for log_file (-c)",
175+
describe:
176+
"SSH option: Append debug logs to log_file instead of standard error",
175177
type: "string",
176178
})
177179
.option("escape-char", {
178-
describe: "SSH option for escape_char (-e)",
180+
describe:
181+
"SSH option: Sets the escape character for sessions with a pty (default: ‘~’)",
179182
type: "string",
180183
})
181184
.option("config-file", {
182-
describe: "SSH option for config-file (-F)",
185+
describe:
186+
"SSH option: Specifies an alternative per-user configuration file",
183187
type: "string",
184188
})
185189
.option("pkcs11", {
186-
describe: "SSH option for pkcs11 (-I)",
190+
describe:
191+
"SSH option: Specify the PKCS#11 shared library ssh should use to communicate with a PKCS#11 token providing keys for user authentication",
187192
type: "string",
188193
})
189194
.option("identity-file", {
190-
describe: "SSH option for identity_file (-i)",
195+
describe:
196+
"SSH option: Selects a file from which the identity (private key) for public key authentication is read",
191197
type: "string",
192198
})
193199
.option("mac-spec", {
194-
describe: "SSH option for mac_spec (-m)",
195-
type: "string",
196-
})
197-
.option("ctl-cmd", {
198-
describe: "SSH option for ctl_cmd (-O)",
200+
describe:
201+
"SSH option: A comma-separated list of MAC (message authentication code) algorithms, specified in order of preference",
199202
type: "string",
200203
})
201204
.option("option", {
202-
describe: "SSH option for option (-o)",
205+
describe:
206+
"SSH option: Can be used to give options in the format used in the configuration file",
203207
type: "string",
204208
})
205209
.option("tag", {
206-
describe: "SSH option for tag (-P)",
207-
type: "string",
208-
})
209-
.option("ctl-path", {
210-
describe: "SSH option for ctl_path (-S)",
210+
describe:
211+
"SSH option: Specify a tag name that may be used to select configuration in ssh_config(5)",
211212
type: "string",
212213
})
213214
);

0 commit comments

Comments
 (0)