Repository navigation
Conversation
After refresh enrichment, HostSSHHostname is overridden with the instance's public IP/DNS, but HostSSHPort kept its legacy value. For VM-mode instances that value is the gateway port, which is not open on the instance, so `ssh <instance>-host` timed out. Set HostSSHPort together with the hostname override, from the instance's reported SSH port and falling back to 22 when unset. SSHHostname and SSHPort (the gateway pair) are unchanged. Fixes brevdev#531 Signed-off-by: Rudra184 <bhattrudra235@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With v0.6.337,
brev refreshwrites<instance>-hostwith the instance IP asHostnamebut the gateway port asPort. The gateway port is not open on the instance, sossh <instance>-hosttimes out.Cause
resolveWorkspaceSSHoverridesHostSSHHostnamewith the instance's public IP/DNS but leavesHostSSHPortat its legacy value, which is the gateway port for VM-mode instances:brev-cli/pkg/cmd/refresh/sshaccess.go
Lines 155 to 159 in 43f3834
makeSSHConfigEntryV2then writes the mismatched pair into the-hostentry:brev-cli/pkg/ssh/sshconfigurer.go
Lines 534 to 557 in 43f3834
Fix
When the host hostname is overridden,
HostSSHPortis now set at the same place from the instance's reported SSH port, falling back to 22 if unset (providerSSHPort). The hostname and port now always come from the same source. The gateway entry (SSHHostname/SSHPort) is untouched.Verification
go test ./pkg/cmd/refresh/ -run TestEnrichWorkspacesWithSSHAccess_HostPortIsNeverTheGatewayPort: passgo test ./pkg/cmd/refresh/ ./pkg/entity/: passgo test ./pkg/ssh/ -skip JetBrains|GateWay: passgo vet ./pkg/...,make fmtcheck,make lint,make test,go mod tidy -diff: passThe new regression test starts with a legacy
HostSSHPortequal to the gateway port (23126) and checks that the result is the instance port (2222) or 22 when unset, and thatSSHPortstays 23126. It fails on the base commit and passes with the patch.Not verified against a real instance; only unit tests were run.
Fixes #531