Commit graph

32 commits

Author SHA1 Message Date
David Gardiner
581b6652e2 Resolve race condition in codespaces connection 2023-10-31 12:19:14 -07:00
David Gardiner
64f4660ec7
Migrate all Codespaces operations from Live Share to Dev Tunnels (#8149)
* Migrate all Codespaces operations from Live Share to Dev Tunnels

* Remove Live Share references

* Fix linting errors

* Update comments, remove deps, add uint16 bound checks

* Fix tests and move keep-alive logic to forwarder

* Address comments

* Updated mock port forwarder

* Fix CodeQL error

* Update comment

* Update func name

* Add missing connection close

* Fix linting error

* https -> http

* Update defer

* Fix tests
2023-10-12 22:16:36 +00:00
Caleb Brose
09e86d0ebf
Fix gh cs ports requiring sudo for privileged port numbers (#7326) 2023-04-19 07:00:44 -05:00
Mislav Marohnić
1933fc2f69
codespace ssh: fix "connection reset by peer" 2023-03-09 15:14:39 +01:00
JP Ungaretti
39a1dc90af Match return style 2023-03-07 19:05:49 +00:00
JP Ungaretti
5a7f779cf7 Merge branch 'trunk' into jungaretti/fix-jupyter-spinner 2023-03-07 18:43:34 +00:00
Caleb Brose
57c73e8239
Add --repo filter to more gh codespaces commands (#6669)
* Add --repo flag to commands

* Example of using common args

* Add -r to stop

* Add validation to the add helper

* Skip prompt for single option

* Migrate (mostly) everything to addGetOrChooseCodespaceCommandArgs

* Fix typo in logsCmd

* Use R instead of r

* Update a couple -r usages

* Refactor to codespace_selector

* Clean up selector, apply it in a couple examples

* Use apiClient instead in constructor

* Restore addDeprecatedRepoShorthand

* Finish implementing the commands

* Update existing tests to use the selector

* Add tests for selector

* linter

* Catch case where there's no conflict

* Make the flag persistent for ports

* Add support to stop
2023-02-22 17:16:36 -06:00
JP Ungaretti
a388358348 Merge branch 'trunk' into jungaretti/fix-jupyter-spinner 2023-02-09 23:18:22 +00:00
Caleb Brose
2b95cbc5a6 Close port forward writer on reader 2023-01-19 20:22:24 -06:00
JP Ungaretti
5879923b4f Use progress runner a few times 2023-01-12 22:56:33 +00:00
David Gardiner
814fcf8c74 Remove unused token field 2023-01-06 09:56:16 -08:00
David Gardiner
000a84d49b Address comments 2023-01-04 15:33:33 -08:00
David Gardiner
731ba682f2 Create Invoker object 2023-01-04 14:41:25 -08:00
David Gardiner
1e75a74d18 Create centralized Codespaces RPC invoker 2023-01-04 14:41:25 -08:00
JP Ungaretti
ceba2c896b Use safeClose instead of Close 2022-04-28 18:38:46 +00:00
JP Ungaretti
3216d1bb3a Remove function return 2022-04-21 14:29:30 -07:00
JP Ungaretti
4452f37819 Clarify session helper 2022-04-14 17:10:11 -05:00
JP Ungaretti
eaf8f84baf Merge branch 'trunk' into add-cs-jupyter 2022-04-14 15:27:40 -05:00
Charlie Andrews
64eecef176 Remove unhelpful error wrapper 2022-03-16 09:36:14 -04:00
Charlie Andrews
8bf0cb8f13 Refactor the getOrChooseCodespace to always check for pending ops 2022-03-16 08:56:17 -04:00
Charlie Andrews
599c7c900f Disallow getting logs from codespaces with pending ops
Since the API already disallows this, this pretty much just cleans up
the error reporting to the user.

Example of old error:

```
$ gh cs logs -c cwndrws-redacted
Starting codespace ⣽connecting to codespace: error starting codespace: HTTP 422: your codespace has an operation pending: updating to a sku with a different amount of storage; please wait until this operation is complete (https://api.github.com/user/codespaces/cwndrws-redacted/start)
exit status 1

```

Example of new error:

```
$ gh cs logs -c cwndrws-redacted
codespace is disabled while it has a pending operation: Changing machine types...
exit status 1
```
2022-03-15 17:21:28 -04:00
JP Ungaretti
fba5fb4eec Refactor liveshare setup to a new function 2022-03-04 00:54:15 +00:00
Jason Lunz
37f8039f76
merge ensureAuthorizedKeys into checkAuthorizedKeys 2021-12-20 13:57:52 -07:00
Jose Garcia
8296904c26
Rename errors from Live Share to generic codespace 2021-11-08 13:35:48 +00:00
Jose Garcia
bbea5ac95e
codespace: progress indication, logging (#4555)
* Rework logging, showing progress, and printing from `codespace` commands
* Change rendering of the general progress indicator so that it's visible on both dark and light backgrounds
* The progress indicator now "spins" faster

Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-10-21 18:04:04 +02:00
Jose Garcia
0748e658cc Switches port binding to 127.0.0.1 where possible 2021-10-14 11:07:25 -04:00
Jose Garcia
5170a2931f Switch to standard lib log.Logger & support dfile
- --debug-file flag can now be used in conjuction with --debug to
  specify the debug file path
- Push out logger concerns to callers of liveshare
2021-10-12 15:45:05 -04:00
Jose Garcia
55f4fcf05c Live Share session activity detection
- Session now accepts two new options: ClientName and Logger
- Port forwarder now supports a keepAlive parameter which when true,
  instructs the PF to call the session's keepAlive method.
- Port forwarder uses a new traffic monitor to detect I/O traffic and
  notify the session when applicable.
- The SSH command introduces a new debug flag which enables the command
  to log to a new temporary file. The file path is printed to the user.
2021-10-07 10:42:06 -04:00
Jose Garcia
8135fdbd99 Switch GetCodespace to new API endpoint
- Drop GetCodespaceToken as it is no longer necessary
- Introduces new behavior with the API to optionally include connection
  details in the GET request. Ommitting to do so results in a faster
  response
2021-10-06 08:50:42 -04:00
Jose Garcia
d02876e6ea Rename the cmd pkg to codespace 2021-10-04 14:16:04 -04:00
Jose Garcia
0859de0124 Merge branch 'trunk' of github.com:cli/cli into jg/move-ghcs-cmd 2021-09-30 12:38:41 -04:00
Jose Garcia
9e6c11e767 Move cmd/ghcs to pkg/cmd/codespace
- Delete pkg/cmd/codespace/main as it is no longer needed in this
  codebase
2021-09-30 11:20:13 -04:00
Renamed from cmd/ghcs/logs.go (Browse further)