@@ -44,6 +44,7 @@ interface SSHConnectionParams {
44
44
workspaceId : string ;
45
45
instanceId : string ;
46
46
gitpodHost : string ;
47
+ debugWorkspace ?: boolean ;
47
48
}
48
49
49
50
interface LocalAppConfig {
@@ -532,7 +533,7 @@ export default class RemoteConnector extends Disposable {
532
533
return preferredIdentityKeys ;
533
534
}
534
535
535
- private async getWorkspaceSSHDestination ( session : vscode . AuthenticationSession , { workspaceId, gitpodHost } : SSHConnectionParams ) : Promise < { destination : string ; password ?: string } > {
536
+ private async getWorkspaceSSHDestination ( session : vscode . AuthenticationSession , { workspaceId, gitpodHost, debugWorkspace } : SSHConnectionParams ) : Promise < { destination : string ; password ?: string } > {
536
537
const serviceUrl = new URL ( gitpodHost ) ;
537
538
const sshKeysSupported = session . scopes . includes ( ScopeFeature . SSHPublicKeys ) ;
538
539
@@ -560,13 +561,15 @@ export default class RemoteConnector extends Disposable {
560
561
throw new NoSSHGatewayError ( gitpodHost ) ;
561
562
}
562
563
563
- const sshHostKeys = ( await sshHostKeyResponse . json ( ) ) as { type : string ; host_key : string } [ ] ;
564
-
565
- const sshDestInfo = {
566
- user : workspaceId ,
567
- // See https://github.com/gitpod-io/gitpod/pull/9786 for reasoning about `.ssh` suffix
568
- hostName : workspaceUrl . host . replace ( workspaceId , `${ workspaceId } .ssh` )
569
- } ;
564
+ const sshHostKeys = ( await sshHostKeyResponse . json ( ) ) as { type : string ; host_key : string } [ ] ;
565
+ let user = workspaceId ;
566
+ // See https://github.com/gitpod-io/gitpod/pull/9786 for reasoning about `.ssh` suffix
567
+ let hostName = workspaceUrl . host . replace ( workspaceId , `${ workspaceId } .ssh` )
568
+ if ( debugWorkspace ) {
569
+ user = 'debug-' + workspaceId ;
570
+ hostName = hostName . replace ( workspaceId , user ) ;
571
+ }
572
+ const sshDestInfo = { user, hostName } ;
570
573
571
574
let verifiedHostKey : Buffer | undefined ;
572
575
// Test ssh connection first
@@ -584,7 +587,7 @@ export default class RemoteConnector extends Disposable {
584
587
authHandler ( _methodsLeft , _partialSuccess , _callback ) {
585
588
return {
586
589
type : 'password' ,
587
- username : workspaceId ,
590
+ username : user ,
588
591
password : ownerToken ,
589
592
} ;
590
593
} ,
@@ -636,7 +639,7 @@ export default class RemoteConnector extends Disposable {
636
639
identityKeys = identityKeys . filter ( k => ! ! registeredKeys . find ( regKey => regKey . fingerprint === k . fingerprint ) ) ;
637
640
} else {
638
641
if ( identityKeys . length ) {
639
- sshDestInfo . user = `${ workspaceId } #${ ownerToken } ` ;
642
+ sshDestInfo . user = `${ user } #${ ownerToken } ` ;
640
643
}
641
644
const gitpodVersion = await getGitpodVersion ( gitpodHost , this . logger ) ;
642
645
this . logger . warn ( `Registered SSH public keys not supported in ${ gitpodHost } , using version ${ gitpodVersion . raw } ` ) ;
@@ -885,7 +888,8 @@ export default class RemoteConnector extends Disposable {
885
888
886
889
const usingSSHGateway = ! ! sshDestination ;
887
890
let localAppSSHConfigPath : string | undefined ;
888
- if ( ! usingSSHGateway ) {
891
+ if ( ! usingSSHGateway && ! params . debugWorkspace ) {
892
+ // debug workspace does not support local app mode
889
893
const localAppFlow = { kind : 'local-app' , userOverride, ...sshFlow } ;
890
894
try {
891
895
this . telemetry . sendUserFlowStatus ( 'connecting' , localAppFlow ) ;
@@ -966,18 +970,18 @@ export default class RemoteConnector extends Disposable {
966
970
return ;
967
971
}
968
972
969
- this . heartbeatManager = new HeartbeatManager ( connectionInfo . gitpodHost , connectionInfo . workspaceId , connectionInfo . instanceId , session . accessToken , this . publicApi , this . logger , this . telemetry ) ;
973
+ this . heartbeatManager = new HeartbeatManager ( connectionInfo . gitpodHost , connectionInfo . workspaceId , connectionInfo . instanceId , ! ! connectionInfo . debugWorkspace , session . accessToken , this . publicApi , this . logger , this . telemetry ) ;
970
974
971
975
// gitpod remote extension installation is async so sometimes gitpod-desktop will activate before gitpod-remote
972
976
// let's try a few times for it to finish install
973
977
try {
974
978
await retry ( async ( ) => {
975
979
await vscode . commands . executeCommand ( '__gitpod.cancelGitpodRemoteHeartbeat' ) ;
976
980
} , 3000 , 15 ) ;
977
- this . telemetry . sendTelemetryEvent ( 'vscode_desktop_heartbeat_state' , { enabled : String ( true ) , gitpodHost : connectionInfo . gitpodHost , workspaceId : connectionInfo . workspaceId , instanceId : connectionInfo . instanceId , gitpodVersion : gitpodVersion . raw } ) ;
981
+ this . telemetry . sendTelemetryEvent ( 'vscode_desktop_heartbeat_state' , { enabled : String ( true ) , gitpodHost : connectionInfo . gitpodHost , workspaceId : connectionInfo . workspaceId , instanceId : connectionInfo . instanceId , debugWorkspace : String ( ! ! connectionInfo . debugWorkspace ) , gitpodVersion : gitpodVersion . raw } ) ;
978
982
} catch {
979
983
this . logger . error ( `Could not execute '__gitpod.cancelGitpodRemoteHeartbeat' command` ) ;
980
- this . telemetry . sendTelemetryEvent ( 'vscode_desktop_heartbeat_state' , { enabled : String ( false ) , gitpodHost : connectionInfo . gitpodHost , workspaceId : connectionInfo . workspaceId , instanceId : connectionInfo . instanceId , gitpodVersion : gitpodVersion . raw } ) ;
984
+ this . telemetry . sendTelemetryEvent ( 'vscode_desktop_heartbeat_state' , { enabled : String ( false ) , gitpodHost : connectionInfo . gitpodHost , workspaceId : connectionInfo . workspaceId , instanceId : connectionInfo . instanceId , debugWorkspace : String ( ! ! connectionInfo . debugWorkspace ) , gitpodVersion : gitpodVersion . raw } ) ;
981
985
}
982
986
}
983
987
0 commit comments