Skip to content

chore: pass usage app name to coder ssh #442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pluginUntilBuild=241.*
# verifier should be used after bumping versions to ensure compatibility in the
# range.
platformType=GW
platformVersion=233.14808-EAP-CANDIDATE-SNAPSHOT
platformVersion=233.15325-EAP-CANDIDATE-SNAPSHOT
instrumentationCompiler=241.10840-EAP-CANDIDATE-SNAPSHOT
platformDownloadSources=true
verifyVersions=2023.3,2024.1
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/com/coder/gateway/cli/CoderCLIManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ fun ensureCLI(
*/
data class Features(
val disableAutostart: Boolean = false,
val reportWorkspaceUsage: Boolean = false,
)

/**
Expand Down Expand Up @@ -264,6 +265,7 @@ class CoderCLIManager(
"ssh",
"--stdio",
if (settings.disableAutostart && feats.disableAutostart) "--disable-autostart" else null,
if (feats.reportWorkspaceUsage) "--usage-app=jetbrains" else null,
)
val extraConfig =
if (settings.sshConfigOptions.isNotBlank()) {
Expand Down Expand Up @@ -446,6 +448,7 @@ class CoderCLIManager(
Features(
// Autostart with SSH was added in 2.5.0.
disableAutostart = version >= SemVer(2, 5, 0),
reportWorkspaceUsage = version >= SemVer(2, 13, 0),
)
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/test/fixtures/outputs/report-usage.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# --- START CODER JETBRAINS test.coder.invalid
Host coder-jetbrains--foo--test.coder.invalid
ProxyCommand /tmp/coder-gateway/test.coder.invalid/coder-linux-amd64 --global-config /tmp/coder-gateway/test.coder.invalid/config ssh --stdio --usage-app=jetbrains foo
ConnectTimeout 0
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
LogLevel ERROR
SetEnv CODER_SSH_SESSION_TYPE=JetBrains
# --- END CODER JETBRAINS test.coder.invalid
4 changes: 3 additions & 1 deletion src/test/kotlin/com/coder/gateway/cli/CoderCLIManagerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ internal class CoderCLIManagerTest {
},
SSHTest(listOf("foo"), null, "disable-autostart", "blank", "", true, Features(true)),
SSHTest(listOf("foo"), null, "no-disable-autostart", "blank", "", true, Features(false)),
SSHTest(listOf("foo"), null, "report-usage", "blank", "", true, Features(false, true)),
SSHTest(
listOf("extra"),
null,
Expand Down Expand Up @@ -721,7 +722,8 @@ internal class CoderCLIManagerTest {
val tests =
listOf(
Pair("2.5.0", Features(true)),
Pair("4.9.0", Features(true)),
Pair("2.13.0", Features(true, true)),
Pair("4.9.0", Features(true, true)),
Pair("2.4.9", Features(false)),
Pair("1.0.1", Features(false)),
)
Expand Down
Loading