Commit Graph

302 Commits

Author SHA1 Message Date
Spike Curtis 25f2abf9ab
chore: remove tailnet from agent API and rename client API to tailnet (#11303)
Refactors our DRPC service definitions slightly.

In the previous version, I inserted the RPCs from the tailnet proto directly into the Agent service.  This makes things hard to deal with because DRPC then generates a new set of methods with new interfaces with the `DRPCAgent_` prefixed.  Since you can't have a single method that takes different argument types, we couldn't reuse the implementation of those RFCs without a lot of extra classes and pass-thru methods.

Instead, the "right" way to do it is to integrate at the DRPC layer.  So, we have two DRPC services available over the Agent websocket, and register them both on the DRPC `mux`.

Since the tailnet proto RPC service is now for both clients and agents, I renamed some things to clarify and shorten.

This PR also removes the `TailnetAPI` implementation from the `agentapi` package, and the next PR in the stack replaces it with the implementation from the `tailnet` package.
2024-01-02 10:02:45 +04:00
Spike Curtis db9104c02e
fix: avoid panic on nil connection (#11305)
Related to https://github.com/coder/coder/actions/runs/7286675441/job/19855871305

Fixes a panic if the listener returns an error, which can obfuscate the underlying problem and cause unrelated tests to be marked failed.
2023-12-21 14:26:11 +04:00
Kayla Washburn 3ab4800a18
chore: clean up lint (#11270) 2023-12-18 14:59:39 -07:00
Steven Masley a6901ae2c5
chore: fix race in cron close behavior (TestAgent_WriteVSCodeConfigs) (#11243)
* chore: add unit test to excercise flake
* Implement a *fix for cron stop() before run()

This fix still has a race condition. I do not see a clean solution
without modifying the cron libary. The cron library uses a boolean
to indicate running, and that boolean needs to be set to "true"
before we call "Close()". Or "Close()" should prevent "Run()"
from doing anything.

In either case, this solves the issue for a niche unit test bug
in which the test finishes, calling Close(), before there was
an oppertunity to start the go routine. It probably isn't worth
a lot of time investment, and this fix will suffice
2023-12-18 09:26:40 -06:00
Dean Sheather 307186325f
fix: avoid db import in slim builds (#11258) 2023-12-19 00:09:22 +10:00
Dean Sheather e46431078c
feat: add AgentAPI using DRPC (#10811)
Co-authored-by: Spike Curtis <spike@coder.com>
2023-12-18 22:53:28 +10:00
Spike Curtis ad3fed72bc
chore: rename Coordinator to CoordinatorV1 (#11222)
Renames the tailnet.Coordinator to represent both v1 and v2 APIs, so that we can use this interface for the main atomic pointer.

Part of #10532
2023-12-15 11:38:12 +04:00
Steven Masley b7bdb17460
feat: add metrics to workspace agent scripts (#11132)
* push startup script metrics to agent
2023-12-13 11:45:43 -06:00
Spike Curtis edeb9bb42a
fix: appease linter on darwin (#11154)
Fixing up some linting errors that show up on Darwin, but not in CI.
2023-12-12 17:02:28 +04:00
Steven Masley 8221544514
chore: check if process is nil (#11090)
* chore: check if process is nil

We check if process is nil in the ports_supported file.
Just matching that defensive check, not sure if it can be nil.
2023-12-07 22:23:42 +00:00
Asher dbbf8acc26
fix: track JetBrains connections (#10968)
* feat: implement jetbrains agentssh tracking

Based on tcp forwarding instead of ssh connections

* Add JetBrains tracking to bottom bar
2023-12-07 12:15:54 -09:00
Mathias Fredriksson 70cede8f7a
test(agent): improve TestAgent_Dial tests (#11013)
Refs #11008
2023-12-04 13:11:30 +02:00
Spike Curtis 6c67add2d9
fix: detect and retry reverse port forward on used port (#10844)
Fixes #10799

The flake happens when we try to remote forward, but the port we've chosen is not free.  In the flaked example, it's actually the SSH listener that occupies the port we try to remote forward, leading to confusing reads (c.f. the linked issue).

This fix simplies the tests considerably by using the Go ssh client, rather than shelling out to OpenSSH.  This avoids using a pseudoterminal, avoids the need for starting any local OS listeners to communicate the forwarding (go SSH just returns in-process listeners), and avoids an OS listener to wire OpenSSH up to the agentConn.

With the simplied logic, we can immediately tell if a remote forward on a random port fails, so we can do this in a loop until success or timeout.

I've also simplified and fixed up the other forwarding tests. Since we set up forwarding in-process with Go ssh, we can remove a lot of the `require.Eventually` logic.
2023-11-27 09:42:45 +04:00
Mathias Fredriksson 61be4dfe5a
fix: improve exit codes for agent/agentssh and cli/ssh (#10850) 2023-11-24 14:35:56 +02:00
Mathias Fredriksson dbdcad0d09
test(agent/agentssh): fix flake in signal test (#10855) 2023-11-24 13:47:40 +02:00
Mathias Fredriksson 2c6e0f7d0a
feat(agent/agentssh): handle session signals (#10842) 2023-11-23 19:55:36 +02:00
Dean Sheather a9c0c01629
chore: fix flake in listening ports test (#10833) 2023-11-22 09:30:51 +00:00
Steven Masley e448c10122
chore: add uuid's to ssh sessions for logging (#10721)
* chore: add uuid to ssh connection logs
2023-11-17 16:04:23 +00:00
Spike Curtis f400d8a0c5
fix: handle SIGHUP from OpenSSH (#10638)
Fixes an issue where remote forwards are not correctly torn down when using OpenSSH with `coder ssh --stdio`.  OpenSSH sends a disconnect signal, but then also sends SIGHUP to `coder`.  Previously, we just exited when we got SIGHUP, and this raced against properly disconnecting.

Fixes https://github.com/coder/customers/issues/327
2023-11-13 15:14:42 +04:00
Steven Masley 63a4f5f4a7
fix: case insensitive magic label (#10592) 2023-11-08 11:17:14 -06:00
Spike Curtis 2a6fd90140
feat: add tailnet and agent API definitions (#10324)
Adds API definitions and packages for Tailnet and Agent APIs (API version 2.0)
2023-10-30 12:14:45 +04:00
Mathias Fredriksson 7fecd39e23
fix(agent/agentscripts): display informative error for ErrWaitDelay (#10407)
Fixes #10400
2023-10-27 19:07:26 +03:00
Asher 4af8446f48
fix: initialize terminal with correct size (#10369)
* Fit once during creation

This does not fix any bugs (that I know of) but we only need to fit once
when the terminal is created, not every time we reconnect.  Granted,
currently we do not support reconnecting without refreshing anyway so it
does not really matter, but this just seems more correct.

Plus now we will not have to pass the fit addon around.

* Pass size when connecting web socket URL

I think this will solve an issue where screen does does not correctly
handle an immediate resize.  It seems to ignore the resize, but even if
you send it again nothing changes, seemingly thinking it is already at
that size?

* Use new struct for decoding reconnecting pty requests

Decoding a JSON message does not touch omitted (or null) fields so once
a message with a resize comes in, every single message from that point
will cause a resize.

I am not sure if this is an actual problem in practice but at the very
least it seems unintentional.
2023-10-23 23:42:39 -04:00
Mathias Fredriksson 1286904de8
test(agent): improve TestAgent_Session_TTY_MOTD_Update (#10385) 2023-10-23 17:32:28 +00:00
Mathias Fredriksson 09f7b8e88c
fix(agent/agentscripts): track cron run and wait for cron stop (#10388)
Fixes #10289
2023-10-23 17:08:52 +00:00
Mathias Fredriksson 1a2aea3a6b
fix(agent): prevent metadata from being discarded if report is slow (#10386) 2023-10-23 17:02:54 +00:00
Mathias Fredriksson 8f1b4fb061
test(agent): fix service banner trim test flake (#10384) 2023-10-23 18:06:59 +03:00
Mathias Fredriksson 76c65b1e1b
fix(agent): send metadata in batches (#10225)
Fixes #9782

---

I recommend reviewing with ignore whitespace.
2023-10-13 17:48:25 +03:00
Mathias Fredriksson 4857d4bd55
feat(codersdk/agentsdk): use new agent metadata batch endpoint (#10224)
Part of #9782
2023-10-13 17:32:28 +03:00
Mathias Fredriksson 7eeba15d16
feat(coderd): add support for sending batched agent metadata (#10223)
Part of #9782
2023-10-13 16:37:55 +03:00
Asher a9077812e2
fix: use UTF-8 encoding with screen (#10190)
This will make characters like ❯ and ⇣ work, for example.
2023-10-11 13:25:04 -08:00
Jon Ayers 4452a1484d
fix: fix log spam related to skipping custom nice scores (#10206) 2023-10-11 02:32:50 -05:00
Spike Curtis b039dc6989
fix: correct escaping in test regex (#10138)
Fixes regex escaping.  Spotted during a code read.
2023-10-10 08:42:39 +04:00
Kyle Carberry 54648b90ca
fix: properly trim spaces so multi-line shebang executes (#10146) 2023-10-09 19:19:57 +00:00
Spike Curtis 54fd350913
feat: improve logging for speedtest connections
part of #7963

improve connection logging for speedtest connections
2023-10-09 20:48:28 +04:00
Spike Curtis 17e889af16
feat: improve logging for reconnectingPTY connections
part of #7963

improves connection logging on reconnectingPTY
2023-10-09 20:35:50 +04:00
Kyle Carberry b402f2a816
feat: add shebang support to scripts (#10134)
This enables much greater portability!
2023-10-09 10:57:57 -05:00
Spike Curtis c67db6efb0
fix: wait for bash prompt before commands (#9882)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-27 12:26:24 +04:00
Cian Johnston 93ef696b57
refactor(agent): add agenttest.New helper function (#9812)
* Adds agenttest.New() helper function
* Makes sure agent gets closed on test cleanup
* Makes sure you don't forget to set session token
* Sets the agent and client logger automatically
2023-09-26 12:05:19 +01:00
Kyle Carberry 20bfe6e9e5
fix: allow expansion from `log_path` for `coder_script` (#9868) 2023-09-25 23:45:55 +00:00
Kyle Carberry 1262eef2c0
feat: add support for `coder_script` (#9584)
* Add basic migrations

* Improve schema

* Refactor agent scripts into it's own package

* Support legacy start and stop script format

* Pipe the scripts!

* Finish the piping

* Fix context usage

* It works!

* Fix sql query

* Fix SQL query

* Rename `LogSourceID` -> `SourceID`

* Fix the FE

* fmt

* Rename migrations

* Fix log tests

* Fix lint err

* Fix gen

* Fix story type

* Rename source to script

* Fix schema jank

* Uncomment test

* Rename proto to TimeoutSeconds

* Fix comments

* Fix comments

* Fix legacy endpoint without specified log_source

* Fix non-blocking by default in agent

* Fix resources tests

* Fix dbfake

* Fix resources

* Fix linting I think

* Add fixtures

* fmt

* Fix startup script behavior

* Fix comments

* Fix context

* Fix cancel

* Fix SQL tests

* Fix e2e tests

* Interrupt on Windows

* Fix agent leaking script process

* Fix migrations

* Fix stories

* Fix duplicate logs appearing

* Gen

* Fix log location

* Fix tests

* Fix tests

* Fix log output

* Show display name in output

* Fix print

* Return timeout on start context

* Gen

* Fix fixture

* Fix the agent status

* Fix startup timeout msg

* Fix command using shared context

* Fix timeout draining

* Change signal type

* Add deterministic colors to startup script logs

---------

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-09-25 16:47:17 -05:00
Spike Curtis 70e481e7a5
fix: use terminal emulator that keeps state in ReconnectingPTY tests (#9765)
* Add more pty diagnostics for terminal parsing

Signed-off-by: Spike Curtis <spike@coder.com>

* print escaped strings

Signed-off-by: Spike Curtis <spike@coder.com>

* Only log on failure - heisenbug?

Signed-off-by: Spike Curtis <spike@coder.com>

* use the terminal across matches to keep cursor & contents state

Signed-off-by: Spike Curtis <spike@coder.com>

* Only log bytes if we're not expecting EOF

Signed-off-by: Spike Curtis <spike@coder.com>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-19 17:57:30 +00:00
Jon Ayers 7311ffbd9d
feat: implement agent process management (#9461)
- An opt-in feature has been added to the agent to allow
   deprioritizing non coder-related processes for CPU by setting their
   niceness level to 10.
- Opting in to the feature requires setting CODER_PROC_PRIO_MGMT to a non-empty value.
2023-09-14 19:45:05 -05:00
Steven Masley e0e6d7c9a6
fix: case insensitve agent ssh session env var (#9675) 2023-09-13 14:18:00 -05:00
Mathias Fredriksson 19d7da3d24
refactor(coderd/database): split `Time` and `Now` into `dbtime` package (#9482)
Ref: #9380
2023-09-01 16:50:12 +00:00
Mathias Fredriksson 702b064cac
refactor: split coderd/gitauth into two, add cli/gitauth (#9479)
* refactor: split coderd/gitauth into two, add cli/gitauth

Ref: #9380
2023-09-01 15:41:22 +00:00
Dean Sheather 64df076328
feat: add server flag to force DERP to use always websockets (#9238) 2023-08-24 17:22:31 +00:00
Kyle Carberry 22e781eced
chore: add /v2 to import module path (#9072)
* chore: add /v2 to import module path

go mod requires semantic versioning with versions greater than 1.x

This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```

Migrate generated files to import /v2

* Fix gen
2023-08-18 18:55:43 +00:00
Mathias Fredriksson bbaa057e15
fix(agent): log correct script timeout for startup script (#9190) 2023-08-18 17:35:49 +00:00
Oleg Kovalov c639674b39
chore: replace chi with chi/v5 (#9143) 2023-08-17 07:46:56 -05:00
Asher 02ee724d9f
fix: do terminal emulation in reconnecting pty tests (#9114)
It looks like it is possible for screen to use control sequences instead
of literal newlines which fails the tests.

This reuses the existing readUntil function used in other pty tests.
2023-08-16 13:02:03 -08:00
Colin Adler 344d32b2f1
feat(coderd): expire agents from server tailnet (#9092) 2023-08-14 20:38:37 -05:00
Asher a08f7b8fb9
fix: catch missing output with reconnecting PTY (#9094)
I forgot that waiting on the cond releases the lock so it was possible
to get pty output after writing the buffer but before adding the pty to
the map.  To fix, add the pty to the map while under the same lock where
we read from the buffer.

The rest does not need to be behind the lock so I moved it out of
doAttach, and that also means we no longer need
waitForStateOrContextLocked.

Also, this can hit a logger error saying the attach failed which fails
the tests however it is not that the attach failed, just that the
process already ran and exited, so when the process exits do not
set an error, instead for now assume this is an expected close.
2023-08-14 15:54:23 -08:00
Asher b993cab49a
fix: use screen for reconnecting terminal sessions on Linux if available (#8640)
* Add screen backend for reconnecting ptys

The screen portion is a port from wsep.  There is an interface that lets
you choose between screen and the previous method.  By default it will
choose screen if it is installed but this can be overidden (mostly for
tests).

The tests use a scanner instead of a reader now because the reader will
loop infinitely at the end of a stream.

Replace /bin/bash with bash since bash is not always in /bin.

* Remove connection_id from reconnecting PTY logger

This serves multiple connections so it makes no sense to scope it to a
single connection.

Also lets us use "connection_id" when logging write errors instead of
"other_conn_id".

* Use PATH to test buffered reconnecting pty
2023-08-14 11:19:13 -08:00
Dean Sheather 07fd73c4a0
chore: allow multiple agent subsystems, add exectrace (#8933) 2023-08-08 22:10:28 -07:00
Dean Sheather 3c52b01850
chore: add tailscale magicsock debug logging controls (#8982) 2023-08-08 17:56:08 +00:00
Dean Sheather b955c5fefc
fix: avoid agent runLoop exiting due to ws ping (#8852) 2023-08-02 07:25:07 +00:00
Dean Sheather c575292ba6
fix: fix tailnet netcheck issues (#8802) 2023-08-02 01:50:43 +10:00
Kyle Carberry bd944e0d21
chore: rename startup logs to agent logs (#8649)
* chore: rename startup logs to agent logs

This also adds a `source` property to every agent log. It
should allow us to group logs and display them nicer in
the UI as they stream in.

* Fix migration order

* Fix naming

* Rename the frontend

* Fix tests

* Fix down migration

* Match enums for workspace agent logs

* Fix inserting log source

* Fix migration order

* Fix logs tests

* Fix psql insert
2023-07-28 15:57:23 +00:00
Ammar Bandukwala 25e30c6f41
feat(cli): support fine-grained server log filtering (#8748) 2023-07-26 16:46:22 -05:00
Dean Sheather 2f0a9996e7
chore: add derpserver to wsproxy, add proxies to derpmap (#7311) 2023-07-27 02:21:04 +10:00
Colin Adler 71d4e4e6e8
fix(agent): check agent metadata every second instead of minute (#8614) 2023-07-20 14:02:58 -05:00
Colin Adler c8d65de4b7
test(agent): fix `TestAgent_Metadata/Once` flake (#8613) 2023-07-20 18:49:44 +00:00
Mathias Fredriksson 5fd77ad7cf
test(agent): fix service banner and metadata intervals (#8516) 2023-07-14 16:10:26 +03:00
Colin Adler c47b78c44b
chore: replace wsconncache with a single tailnet (#8176) 2023-07-12 17:37:31 -05:00
Mathias Fredriksson e508d9aa6e
fix(agent/usershell): check shell on darwin via dscl (#8366) 2023-07-11 20:27:50 +03:00
Mathias Fredriksson 34c3f919dc
fix(agent/agentssh): check for hushlogin via afero fs (#8358) 2023-07-07 13:30:23 +03:00
Mathias Fredriksson 3f058f28e7
test(agent): use afero for motd tests to allow parallel execution (#8329) 2023-07-06 10:57:51 +03:00
Asher 6015319e9d
feat: show service banner in SSH/TTY sessions (#8186)
* Allow workspace agents to get appearance
* Poll for service banner every two minutes
* Show service banner before MOTD if not quiet
2023-06-30 10:41:29 -08:00
Mathias Fredriksson 6d176aee5d
test(agent): fix lifecycle test flakeyness (#8230) 2023-06-27 12:44:16 +00:00
Mathias Fredriksson 3b9b06fe5a
feat(codersdk/agentsdk): add `StartupLogsSender` and `StartupLogsWriter` (#8129)
This commit adds two new `agentsdk` functions, `StartupLogsSender` and
`StartupLogsWriter` that can be used by any client looking to send
startup logs to coderd.

We also refactor the `agent` to use these new functions.

As a bonus, agent startup logs are separated into "info" and "error"
levels to separate stdout and stderr.

---------

Co-authored-by: Marcin Tojek <mtojek@users.noreply.github.com>
2023-06-22 23:28:59 +03:00
Spike Curtis e738123a9c
chore: log ssh connection disconnects with errors (#8143)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-22 11:37:50 +04:00
Dean Sheather a28d422c35
feat: add flag to disable all direct connections (#7936) 2023-06-21 22:02:05 +00:00
Marcin Tojek 4fb4c9b270
chore: add more rules to ensure logs consistency (#8104) 2023-06-21 12:00:38 +02:00
Spike Curtis 1c8f564fdb
feat: add logging of ssh connections to agent (#8096)
* feat: adds logging of ssh connections to agent

Signed-off-by: Spike Curtis <spike@coder.com>

* code review improvements

Signed-off-by: Spike Curtis <spike@coder.com>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-21 13:49:58 +04:00
Mathias Fredriksson ea4b7d60d7
fix(agent): refactor `trackScriptLogs` to avoid deadlock (#8084)
During agent close it was possible for the startup script logs consumer
to enter a deadlock state where by agent close was waiting via
`a.trackConnGoroutine` and the log reader for a flush event.

This refactor removes the mutex in favor of channel communication and
relies on two goroutines without shared state.
2023-06-20 18:05:11 +03:00
Mathias Fredriksson 8dac0356ed
refactor: replace startup script logs EOF with starting/ready time (#8082)
This commit reverts some of the changes in #8029 and implements an
alternative method of keeping track of when the startup script has ended
and there will be no more logs.

This is achieved by adding new agent fields for tracking when the agent
enters the "starting" and "ready"/"start_error" lifecycle states. The
timestamps simplify logic since we don't need understand if the current
state is before or after the state we're interested in. They can also be
used to show data like how long the startup script took to execute. This
also allowed us to remove the EOF field from the logs as the
implementation was problematic when we returned the EOF log entry in the
response since requesting _after_ that ID would give no logs and the API
would thus lose track of EOF.
2023-06-20 14:41:55 +03:00
Marcin Tojek b1d1b63113
chore: ensure logs consistency across Coder (#8083) 2023-06-20 12:30:45 +02:00
Mathias Fredriksson 0c5077464b
fix: avoid missed logs when streaming startup logs (#8029)
* feat(coderd,agent): send startup log eof at the end

* fix(coderd): fix edge case in startup log pubsub

* fix(coderd): ensure startup logs are closed on lifecycle state change (fallback)

* fix(codersdk): fix startup log channel shared memory bug

* fix(site): remove the EOF log line
2023-06-16 17:14:22 +03:00
Marcin Tojek 247f8a973f
feat: replace ssh maxTimeout with keep-alive mechanism (#8062)
* Bump up coder/ssh

* feat: Set default agent timeout to ~72h

* Address PR comments

* Fix
2023-06-16 15:22:18 +02:00
Mathias Fredriksson 74fdcb1ace
fix(agent/agentssh): wait for sessions to exit (#8008) 2023-06-13 17:52:31 +00:00
Mathias Fredriksson c916a9e67f
fix(agent): guard against multiple rpty race for same id (#7998)
* fix(agent): guard against multiple rpty race for same id
* fix(agent): ensure pty is closed on error
2023-06-13 15:14:07 +00:00
Ammar Bandukwala fcca639d38
test(agent/agentssh): close SSH servers in all tests (#7911)
Potentially solves the flake seen here:

https://github.com/coder/coder/actions/runs/5167029213/jobs/9307647816.
2023-06-07 23:43:38 +00:00
Marcin Tojek 14efdadd3c
feat: Collect agent SSH metrics (#7584) 2023-05-25 12:52:36 +02:00
Jon Ayers 00a2413c03
feat: add telemetry support for workspace agent subsystem (#7579) 2023-05-17 22:49:25 -05:00
Kyle Carberry 70d2203b9e
chore: reduce the log output of skipped tests (#7520)
With the introduction of the workspace proxy tests there was a lot
of output if a test was eventually skipped.
2023-05-14 19:37:00 -05:00
Spike Curtis 9c030a8888
fix: pty.Start respects context on Windows too (#7373)
* fix: pty.Start respects context on Windows too

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix windows imports; rename ToExec -> AsExec

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix import in windows test

Signed-off-by: Spike Curtis <spike@coder.com>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-05-03 11:43:05 +04:00
Ammar Bandukwala 465fe8658d
chore: skip timing-sensistive AgentMetadata test in the standard suite (#7237)
* chore: skip timing-sensistive AgentMetadata test in the standard suite

* Add test-timing target

* fix windows?

* Works on my Windows desktop?

* Use tag system

* fixup! Use tag system
2023-05-02 10:41:41 +00:00
Marcin Tojek bb0a38b161
feat: Implement aggregator for agent metrics (#7259) 2023-04-27 12:34:00 +02:00
Spike Curtis b6666cf1cf
chore: tailnet debug logging (#7260)
* Enable discovery (disco) debug

Signed-off-by: Spike Curtis <spike@coder.com>

* Better debug on reconnectingPTY

Signed-off-by: Spike Curtis <spike@coder.com>

* Agent logging in appstest

Signed-off-by: Spike Curtis <spike@coder.com>

* More reconnectingPTY logging

Signed-off-by: Spike Curtis <spike@coder.com>

* Add logging to coordinator

Signed-off-by: Spike Curtis <spike@coder.com>

* Update agent/agent.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Update agent/agent.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Update agent/agent.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Update agent/agent.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Clarify logs; remove unrelated changes

Signed-off-by: Spike Curtis <spike@coder.com>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-04-27 13:59:01 +04:00
Colin Adler 3eb7f06bf1
feat(agent): add http debug routes for magicsock (#7287) 2023-04-26 13:01:49 -05:00
Spike Curtis 29cbc5404a Reconnecting PTY waits for command output or EOF (#7279)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-04-26 09:02:06 +04:00
Spike Curtis daee91c6dc
refactor: PTY & SSH (#7100)
* Add ssh tests for longoutput, orphan

Signed-off-by: Spike Curtis <spike@coder.com>

* PTY/SSH tests & improvements

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix some tests

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix linting

Signed-off-by: Spike Curtis <spike@coder.com>

* fmt

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix windows test

Signed-off-by: Spike Curtis <spike@coder.com>

* Windows copy test

Signed-off-by: Spike Curtis <spike@coder.com>

* WIP Windows pty handling

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix truncation tests

Signed-off-by: Spike Curtis <spike@coder.com>

* Appease linter/fmt

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix typo

Signed-off-by: Spike Curtis <spike@coder.com>

* Rework truncation test to not assume OS buffers

Signed-off-by: Spike Curtis <spike@coder.com>

* Disable orphan test on Windows --- uses sh

Signed-off-by: Spike Curtis <spike@coder.com>

* agent_test running SSH in pty use ptytest.Start

Signed-off-by: Spike Curtis <spike@coder.com>

* More detail about closing pseudoconsole on windows

Signed-off-by: Spike Curtis <spike@coder.com>

* Code review fixes

Signed-off-by: Spike Curtis <spike@coder.com>

* Rearrange ptytest method order

Signed-off-by: Spike Curtis <spike@coder.com>

* Protect pty.Resize on windows from races

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix windows bugs

Signed-off-by: Spike Curtis <spike@coder.com>

* PTY doesn't extend PTYCmd

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix windows types

Signed-off-by: Spike Curtis <spike@coder.com>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-04-24 14:53:57 +04:00
Mathias Fredriksson 712098fa2b
test(agent): Increase the time to wait for agent reachable (#7245) 2023-04-21 19:40:17 +00:00
Kyle Carberry fd84df769d
fix: add `DISPLAY` env var for X11 connections (#7248)
* fix: add `DISPLAY` env var for X11 connections

* Update agent/agentssh/agentssh.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-04-21 16:43:49 +00:00
Kyle Carberry f39e6a79de
feat: add support for X11 forwarding (#7205)
* feat: add support for X11 forwarding

* Only run X forwarding on Linux

* Fix piping

* Fix comments
2023-04-21 15:52:40 +00:00
Mathias Fredriksson 300ae4a6bf
test(agent): Fix TestAgent_UnixRemoteForwarding timeout (#7235) 2023-04-21 01:35:51 +03:00
Mathias Fredriksson b3b26a62f2
test(agent/reaper): Fix restructure issue (#7168)
In #7164 we accidentally removed the "in CI" check, this fixes it.
2023-04-17 17:39:10 +00:00
Mathias Fredriksson bf0fed4f3f
chore: Update pion/udp and improve parallel/non-parallel tests (#7164)
* test(all): Improve and fix subtests with parallell/nonparallel parents

* chore: Update pion/udp to fix buffer close
2023-04-17 20:23:10 +03:00
Muhammad Atif Ali bb43713d38
fix: VSCode desktop connection (#7120)
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-04-14 17:32:18 +03:00