Skip to content

Commit e527e8d

Browse files
committed
fix IDE-186: support gp validate with local ssh
1 parent 2bb4fdb commit e527e8d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/local-ssh/ipc/extensionServiceServer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,16 @@ class ExtensionServiceImpl implements ExtensionServiceImplementation {
8888
}
8989
userId = this.sessionService.getUserId();
9090
const workspaceId = request.workspaceId;
91+
let actualWorkspaceId = workspaceId;
92+
if (workspaceId.startsWith('debug-')) {
93+
actualWorkspaceId = workspaceId.substring('debug-'.length);
94+
}
9195
// TODO(lssh): Get auth info according to `request.gitpodHost`
9296
const gitpodHost = this.hostService.gitpodHost;
9397
const usePublicApi = await this.experiments.getUsePublicAPI(gitpodHost);
9498
const [workspace, ownerToken] = await withServerApi(accessToken, gitpodHost, svc => Promise.all([
95-
usePublicApi ? this.sessionService.getAPI().getWorkspace(workspaceId) : svc.server.getWorkspace(workspaceId),
96-
usePublicApi ? this.sessionService.getAPI().getOwnerToken(workspaceId) : svc.server.getOwnerToken(workspaceId),
99+
usePublicApi ? this.sessionService.getAPI().getWorkspace(actualWorkspaceId) : svc.server.getWorkspace(actualWorkspaceId),
100+
usePublicApi ? this.sessionService.getAPI().getOwnerToken(actualWorkspaceId) : svc.server.getOwnerToken(actualWorkspaceId),
97101
]), this.logService);
98102

99103
const phase = usePublicApi ? phaseMap[(workspace as Workspace).status?.instance?.status?.phase ?? WorkspaceInstanceStatus_Phase.UNSPECIFIED] : (workspace as WorkspaceInfo).latestInstance?.status.phase;

src/remoteConnector.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,13 @@ export class RemoteConnector extends Disposable {
533533
}
534534

535535
const domain = getLocalSSHDomain(gitpodHost);
536-
const hostname = `${workspaceId}.${domain}`;
536+
let hostname = `${workspaceId}.${domain}`;
537+
let user = workspaceId;
538+
if (debugWorkspace) {
539+
hostname = 'debug-' + hostname;
540+
user = 'debug-' + workspaceId;
541+
}
537542

538-
const user = debugWorkspace ? ('debug-' + workspaceId) : workspaceId;
539543
this.logService.info('connecting with local ssh destination', { domain });
540544
return {
541545
destination: new SSHDestination(hostname, user),

0 commit comments

Comments
 (0)