Skip to content

Commit f36023f

Browse files
authored
fix(auth): Apply static workspace ID for Eclipse Che instances (#7614)
## Problem Eclipse Che-based workspaces on remote compute will change their hostname if the backing compute changes, thus requiring a reauth. ## Solution Swap to keying off the Che workspace ID, which should be static for specific workspaces --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 6ac1207 commit f36023f

File tree

1 file changed

+9
-0
lines changed
  • packages/core/src/shared/vscode

1 file changed

+9
-0
lines changed

packages/core/src/shared/vscode/env.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ export async function getMachineId(): Promise<string> {
307307
// TODO: use `vscode.env.machineId` instead?
308308
return 'browser'
309309
}
310+
// Eclipse Che-based envs (backing compute rotates, not classified as a web instance)
311+
// TODO: use `vscode.env.machineId` instead?
312+
if (process.env.CHE_WORKSPACE_ID) {
313+
return process.env.CHE_WORKSPACE_ID
314+
}
315+
// RedHat Dev Workspaces (run some VSC web variant)
316+
if (process.env.DEVWORKSPACE_ID) {
317+
return process.env.DEVWORKSPACE_ID
318+
}
310319
const proc = new ChildProcess('hostname', [], { collect: true, logging: 'no' })
311320
// TODO: check exit code.
312321
return (await proc.run()).stdout.trim() ?? 'unknown-host'

0 commit comments

Comments
 (0)