@@ -107,6 +107,10 @@ export default class RemoteConnector extends Disposable {
107
107
super ( ) ;
108
108
109
109
this . releaseStaleLocks ( ) ;
110
+
111
+ if ( vscode . env . remoteName && context . extension . extensionKind === vscode . ExtensionKind . UI ) {
112
+ this . _register ( vscode . commands . registerCommand ( 'gitpod.api.autoTunnel' , this . autoTunnelCommand . bind ( this ) ) ) ;
113
+ }
110
114
}
111
115
112
116
private releaseStaleLocks ( ) : void {
@@ -662,6 +666,8 @@ export default class RemoteConnector extends Disposable {
662
666
if ( password ) {
663
667
await this . showSSHPasswordModal ( password ) ;
664
668
}
669
+
670
+ this . telemetry . sendTelemetryEvent ( 'vscode_desktop_ssh' , { kind : 'gateway' , status : 'connected' , ...params } ) ;
665
671
} catch ( e ) {
666
672
this . telemetry . sendTelemetryEvent ( 'vscode_desktop_ssh' , { kind : 'gateway' , status : 'failed' , reason : e . toString ( ) , ...params } ) ;
667
673
if ( e instanceof NoSSHGatewayError ) {
@@ -700,6 +706,8 @@ export default class RemoteConnector extends Disposable {
700
706
const localAppDestData = await this . getWorkspaceLocalAppSSHDestination ( params ) ;
701
707
sshDestination = localAppDestData . localAppSSHDest ;
702
708
localAppSSHConfigPath = localAppDestData . localAppSSHConfigPath ;
709
+
710
+ this . telemetry . sendTelemetryEvent ( 'vscode_desktop_ssh' , { kind : 'local-app' , status : 'connected' , ...params } ) ;
703
711
} catch ( e ) {
704
712
this . logger . error ( `Failed to connect ${ params . workspaceId } Gitpod workspace:` , e ) ;
705
713
if ( e instanceof LocalAppError ) {
@@ -726,8 +734,6 @@ export default class RemoteConnector extends Disposable {
726
734
727
735
await this . updateRemoteSSHConfig ( usingSSHGateway , localAppSSHConfigPath ) ;
728
736
729
- await this . context . globalState . update ( sshDestination ! , { ...params , usingSSHGateway } ) ;
730
-
731
737
vscode . commands . executeCommand (
732
738
'vscode.openFolder' ,
733
739
vscode . Uri . parse ( `vscode-remote://ssh-remote+${ sshDestination } ${ uri . path || '/' } ` ) ,
@@ -742,7 +748,7 @@ export default class RemoteConnector extends Disposable {
742
748
const configKey = `config/${ authority } ` ;
743
749
const localAppconfig = this . context . globalState . get < LocalAppConfig > ( configKey ) ;
744
750
if ( ! localAppconfig || checkRunning ( localAppconfig . pid ) !== true ) {
745
- // Do nothing if we are using SSH gateway and local app is not running
751
+ // Do nothing if we are using SSH gateway
746
752
return ;
747
753
}
748
754
}
@@ -760,53 +766,4 @@ export default class RemoteConnector extends Disposable {
760
766
this . logger . error ( 'Failed to disable auto tunneling:' , e ) ;
761
767
}
762
768
}
763
-
764
- public async checkRemoteConnectionSuccessful ( ) {
765
- const isRemoteExtensionHostRunning = async ( ) => {
766
- try {
767
- // Invoke command from gitpot-remote extension to test if connection is successful
768
- await vscode . commands . executeCommand ( '__gitpod.getGitpodRemoteLogsUri' ) ;
769
- return true ;
770
- } catch {
771
- return false ;
772
- }
773
- } ;
774
-
775
- const remoteUri = vscode . workspace . workspaceFile || vscode . workspace . workspaceFolders ?. [ 0 ] . uri ;
776
- if ( vscode . env . remoteName === 'ssh-remote' && this . context . extension . extensionKind === vscode . ExtensionKind . UI && remoteUri ) {
777
- const [ , sshDestStr ] = remoteUri . authority . split ( '+' ) ;
778
- const sshDest : { user : string ; hostName : string } = JSON . parse ( Buffer . from ( sshDestStr , 'hex' ) . toString ( 'utf8' ) ) ;
779
- const gitpodHost = vscode . workspace . getConfiguration ( 'gitpod' ) . get < string > ( 'host' ) ! ;
780
- const host = new URL ( gitpodHost ) . host ;
781
- const connectionSuccessful = sshDest . hostName . endsWith ( host ) && await isRemoteExtensionHostRunning ( ) ;
782
-
783
- const connectionInfo = this . context . globalState . get < SSHConnectionParams & { usingSSHGateway : boolean } > ( sshDestStr ) ;
784
- if ( connectionInfo ) {
785
- const kind = connectionInfo . usingSSHGateway ? 'gateway' : 'local-app' ;
786
- if ( connectionSuccessful ) {
787
- this . telemetry . sendTelemetryEvent ( 'vscode_desktop_ssh' , {
788
- kind,
789
- status : 'connected' ,
790
- instanceId : connectionInfo . instanceId ,
791
- workspaceId : connectionInfo . workspaceId ,
792
- gitpodHost : connectionInfo . gitpodHost
793
- } ) ;
794
- } else {
795
- this . telemetry . sendTelemetryEvent ( 'vscode_desktop_ssh' , {
796
- kind,
797
- status : 'failed' ,
798
- reason : 'remote-ssh extension: connection failed' ,
799
- instanceId : connectionInfo . instanceId ,
800
- workspaceId : connectionInfo . workspaceId ,
801
- gitpodHost : connectionInfo . gitpodHost
802
- } ) ;
803
- }
804
- await this . context . globalState . update ( remoteUri . authority , undefined ) ;
805
- }
806
-
807
- return connectionSuccessful ;
808
- }
809
-
810
- return false ;
811
- }
812
769
}
0 commit comments