Skip to content

Commit aef863a

Browse files
committed
Add setup command
To do this, we now handle the download of the IDE so we can figure out exactly where it is without having to scan through the list of installed IDEs afterward and match on the IDE product and build number. This has some other advantages as well since the default deploy mechanism does not appear to be very robust. Closes #386
1 parent 9cda2e1 commit aef863a

File tree

6 files changed

+217
-82
lines changed

6 files changed

+217
-82
lines changed

src/main/kotlin/com/coder/gateway/CoderRemoteConnectionHandle.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package com.coder.gateway
55
import com.coder.gateway.models.TokenSource
66
import com.coder.gateway.models.WorkspaceProjectIDE
77
import com.coder.gateway.services.CoderRecentWorkspaceConnectionsService
8+
import com.coder.gateway.services.CoderSettingsService
89
import com.coder.gateway.settings.CoderSettings
910
import com.coder.gateway.util.humanizeDuration
1011
import com.coder.gateway.util.isCancellation
@@ -45,6 +46,7 @@ import javax.net.ssl.SSLHandshakeException
4546
// connections.
4647
class CoderRemoteConnectionHandle {
4748
private val recentConnectionsService = service<CoderRecentWorkspaceConnectionsService>()
49+
private val settings = service<CoderSettingsService>()
4850

4951
fun connect(getParameters: (indicator: ProgressIndicator) -> WorkspaceProjectIDE) {
5052
val clientLifetime = LifetimeDefinition()
@@ -55,12 +57,13 @@ class CoderRemoteConnectionHandle {
5557
indicator.text = CoderGatewayBundle.message("gateway.connector.coder.connecting")
5658
val context = suspendingRetryWithExponentialBackOff(
5759
action = { attempt ->
58-
logger.info("Connecting... (attempt $attempt")
60+
logger.info("Connecting... (attempt $attempt)")
5961
if (attempt > 1) {
6062
// indicator.text is the text above the progress bar.
6163
indicator.text = CoderGatewayBundle.message("gateway.connector.coder.connecting.retry", attempt)
6264
}
63-
SshMultistagePanelContext(parameters.toHostDeployInputs())
65+
val deployInputs = parameters.deploy(indicator, Duration.ofMinutes(10), settings.setupCommand)
66+
SshMultistagePanelContext(deployInputs)
6467
},
6568
retryIf = {
6669
it is ConnectionException || it is TimeoutException

src/main/kotlin/com/coder/gateway/CoderSettingsConfigurable.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ class CoderSettingsConfigurable : BoundConfigurable("Coder") {
117117
CoderGatewayBundle.message("gateway.connector.settings.ssh-config-options.comment", CODER_SSH_CONFIG_OPTIONS)
118118
)
119119
}.layout(RowLayout.PARENT_GRID)
120+
row(CoderGatewayBundle.message("gateway.connector.settings.setup-command.title")) {
121+
textField().resizableColumn().align(AlignX.FILL)
122+
.bindText(state::setupCommand)
123+
.comment(
124+
CoderGatewayBundle.message("gateway.connector.settings.setup-command.comment")
125+
)
126+
}.layout(RowLayout.PARENT_GRID)
120127
}
121128
}
122129

0 commit comments

Comments
 (0)