@@ -687,40 +687,51 @@ export class RemoteConnector extends Disposable {
687
687
this . usePublicApi = await this . experiments . getUsePublicAPI ( params . gitpodHost ) ;
688
688
this . logService . info ( `Going to use ${ this . usePublicApi ? 'public' : 'server' } API` ) ;
689
689
690
- let useLocalSSH = await this . experiments . getUseLocalSSHProxy ( ) ;
691
- if ( useLocalSSH ) {
692
- // If needed, revert local-app changes first
693
- await this . updateRemoteSSHConfig ( true , undefined ) ;
694
-
695
- this . localSSHService . flow = sshFlow ;
696
- const [ isSupportLocalSSH , isExtensionServerReady ] = await Promise . all ( [
697
- this . localSSHService . initialize ( ) ,
698
- this . localSSHService . extensionServerReady ( )
699
- ] ) ;
700
- if ( ! isExtensionServerReady ) {
701
- this . logService . error ( 'Extension IPC server is not ready' ) ;
702
- useLocalSSH = false ;
703
- }
704
- if ( ! isSupportLocalSSH ) {
705
- this . logService . error ( 'Local SSH is not supported on this platform' ) ;
706
- useLocalSSH = false ;
707
- }
708
- }
709
- if ( useLocalSSH ) {
710
- this . logService . info ( 'Going to use lssh' ) ;
711
- }
712
-
713
690
const forceUseLocalApp = Configuration . getUseLocalApp ( ) ;
714
691
const userOverride = String ( isUserOverrideSetting ( 'gitpod.remote.useLocalApp' ) ) ;
715
692
let sshDestination : SSHDestination | undefined ;
716
- if ( ! forceUseLocalApp ) {
693
+ const useLocalSSH = await this . experiments . getUseLocalSSHProxy ( ) ;
694
+ sshFlow . useLocalSSH = String ( useLocalSSH ) ;
695
+ if ( ! forceUseLocalApp && useLocalSSH ) {
696
+ const openSSHVersion = await getOpenSSHVersion ( ) ;
697
+ const localSSHFlow : UserFlowTelemetryProperties = { kind : 'local-ssh' , openSSHVersion, userOverride, ...sshFlow } ;
698
+ try {
699
+ this . telemetryService . sendUserFlowStatus ( 'connecting' , localSSHFlow ) ;
700
+ // If needed, revert local-app changes first
701
+ await this . updateRemoteSSHConfig ( true , undefined ) ;
702
+
703
+ this . localSSHService . flow = sshFlow ;
704
+ const [ isSupportLocalSSH , isExtensionServerReady ] = await Promise . all ( [
705
+ this . localSSHService . initialize ( ) ,
706
+ this . localSSHService . extensionServerReady ( )
707
+ ] ) ;
708
+ if ( ! isExtensionServerReady ) {
709
+ throw new Error ( 'NoExtensionIPCServer' )
710
+ }
711
+ if ( ! isSupportLocalSSH ) {
712
+ throw new Error ( 'NoLocalSSHSupport' )
713
+ }
714
+ this . logService . info ( 'Going to use lssh' ) ;
715
+
716
+ const { destination } = await this . getLocalSSHWorkspaceSSHDestination ( params ) ;
717
+ params . connType = 'local-ssh' ;
718
+ sshDestination = destination ;
719
+
720
+ this . telemetryService . sendUserFlowStatus ( 'connected' , localSSHFlow ) ;
721
+ } catch ( e ) {
722
+ this . telemetryService . sendUserFlowStatus ( 'failed' , { ...localSSHFlow , reason : e . toString ( ) } ) ;
723
+ this . logService . error ( `Local SSH: failed to connect to ${ params . workspaceId } Gitpod workspace:` , e ) ;
724
+ }
725
+ }
726
+
727
+ if ( ! forceUseLocalApp && sshDestination === undefined ) {
717
728
const openSSHVersion = await getOpenSSHVersion ( ) ;
718
- const gatewayFlow : UserFlowTelemetryProperties = { kind : useLocalSSH ? 'local-ssh' : 'gateway' , openSSHVersion, userOverride, ...sshFlow } ;
729
+ const gatewayFlow : UserFlowTelemetryProperties = { kind : 'gateway' , openSSHVersion, userOverride, ...sshFlow } ;
719
730
try {
720
731
this . telemetryService . sendUserFlowStatus ( 'connecting' , gatewayFlow ) ;
721
732
722
- const { destination, password } = useLocalSSH ? await this . getLocalSSHWorkspaceSSHDestination ( params ) : await this . getWorkspaceSSHDestination ( params ) ;
723
- params . connType = useLocalSSH ? 'local-ssh' : 'ssh-gateway' ;
733
+ const { destination, password } = await this . getWorkspaceSSHDestination ( params ) ;
734
+ params . connType = 'ssh-gateway' ;
724
735
725
736
sshDestination = destination ;
726
737
@@ -771,7 +782,7 @@ export class RemoteConnector extends Disposable {
771
782
772
783
const usingSSHGateway = ! ! sshDestination ;
773
784
let localAppSSHConfigPath : string | undefined ;
774
- if ( ! usingSSHGateway && ! params . debugWorkspace ) {
785
+ if ( sshDestination === undefined && ! params . debugWorkspace ) {
775
786
// debug workspace does not support local app mode
776
787
const localAppFlow = { kind : 'local-app' , userOverride, ...sshFlow } ;
777
788
try {
0 commit comments