Commit graph

61 commits

Author SHA1 Message Date
Mislav Marohnić
f749590e87 Replace old "github/ghcs" import statements 2021-09-28 16:57:56 +02:00
Mislav Marohnić
c82d4c5472 Avoid passing params struct as pointer 2021-09-24 17:36:18 +02:00
Mislav Marohnić
dc8f6ef183 No longer accept a logger in CreateCodespace
The API layer shouldn't concern itself with logging progress to stderr.
Instead, we will subsequently add progress indicators in the caller
around CreateCodespace and other potentially slow commands as needed.
2021-09-24 17:30:31 +02:00
Mislav Marohnić
ca0f89d3bc Introduce an App struct that executes core business logic
The Cobra commands are now a light wrapper around the App struct.

Co-authored-by: Jose Garcia <josebalius@github.com>
2021-09-24 17:20:34 +02:00
Mislav Marohnić
8807b3a73a Merge pull request #184 from github/args-constraint
Consistently institute constraints for position arguments and improve error message
2021-09-24 16:02:36 +02:00
Jose Garcia
fb12f4108f Merge pull request #181 from github/jg/poll-on-async-creation
ghcs create: poll for codespaces that are being retried by the server
2021-09-23 10:10:57 -04:00
Jose Garcia
4e0ac15fe0 Add buffer to channels to avoid goroutine leak 2021-09-22 15:10:47 -04:00
Jose Garcia
9a558bc58c Early return if polling is not required
- Add context to errors in poller
2021-09-22 15:03:12 -04:00
Mislav Marohnić
7a91ba5942 Print usage help when args given to "NoArgs" commands 2021-09-22 19:51:12 +02:00
Jose Garcia
208f1721b5 Rename ProvisionCodespaceParams 2021-09-22 13:21:02 -04:00
Jose Garcia
70a2ea2e6a PR Feedback
- Rename ProvisionCodespace -> CreateCodespace
- Rename createCodespace -> startCreate
- Additional docs/comments
- Simplify ProvisionCodespaceParams
2021-09-22 13:19:26 -04:00
Jose Garcia
d2d21996bc Move ProvisionCodespace to API client
- Make CreateCodespace private along with its errors
2021-09-22 11:49:41 -04:00
Jose Garcia
86717f14a1 Implement codespaces.Provision
- Move polling logic into the Provision function
- Document the behavior expected of callers when an ErrCreateAsyncRetry
  is returned
2021-09-22 09:09:09 -04:00
Jose Garcia
48e3473a95 PR Feedback
- Bring context.Timeout into the poller
- Accept duration and interval
- Other tidy up
2021-09-21 18:18:30 -04:00
Jose Garcia
d5b03df406 Merge branch 'main' of github.com:github/ghcs into jg/poll-on-async-creation 2021-09-21 14:01:37 -04:00
Jose Garcia
323462ca5c Poll codespace on ErrCreateAsyncRetry error
- Introduce tests for the poller
- Attempt to fetch codespace for 2 mins
2021-09-21 12:37:11 -04:00
Jose Garcia
0b68aaab7e Return error on 202 responses
- Start implementing the retry/poll flow
2021-09-21 09:59:16 -04:00
Mislav Marohnić
8c0c7a8e19 Make GITHUB_TOKEN configurable through Go member
Co-authored-by: Jose Garcia <josebalius@github.com>
2021-09-17 16:29:35 +02:00
Mislav Marohnić
c2f3537a32 Separate "main" package from "ghcs" package
To make "ghcs" importable, this separates out the `main()` function into
its own package that lives under "cmd/ghcs/main". Typically the main
package would be called "cmd/ghcs", but we wanted to leave the current
ghcs implementation where it is to avoid causing conflicts with current
work in progress.

Co-authored-by: Jose Garcia <josebalius@github.com>
2021-09-17 16:26:20 +02:00
Max Beizer
a4f1fa076b Fix up all the static-check warnings (#162) 2021-09-17 13:10:37 +02:00
Mislav Marohnić
dbb4e0c177 Merge remote-tracking branch 'origin' into ruleguard 2021-09-16 11:46:50 +02:00
Jose Garcia
10ad85486f Merge pull request #154 from github/jg/fix-ctx-error
ghcs create/ssh: fix ctx cancellation errors & fix todo for X11 forwarding
2021-09-15 15:45:35 -04:00
Jose Garcia
0f72e3d886 defer stopPolling and docs 2021-09-15 14:29:16 -04:00
Alan Donovan
06719866c9 move api to internal/ 2021-09-15 13:13:10 -04:00
Jose Garcia
547c629220 fix ctx cancellation errors & fix todo for X11 forwarding 2021-09-15 10:38:19 -04:00
Mislav Marohnić
fb5a35568c Ensure original errors are wrapped with "%w" instead of "%v" 2021-09-15 13:58:41 +02:00
Alan Donovan
cbb8253544 consolidate survey functions 2021-09-09 11:57:37 -04:00
Alan Donovan
c31fc05746 more typo fixes 2021-09-02 09:09:05 -04:00
Alan Donovan
49ccdd3d21 use correct correct spelling of codespace 2021-09-01 17:26:26 -04:00
Jose Garcia
2163aba3d5 pass branch for sku selection, pre-select if only one is returned 2021-09-01 13:54:45 -04:00
Alan Donovan
bbcf2dd321 spell product names (Codespaces, Live Share) correctly 2021-08-31 11:15:26 -04:00
Jose Garcia
634796e8a8 merge main 2021-08-27 18:18:30 -04:00
Jose Garcia
adc1ee5e2d merge main 2021-08-27 17:43:43 -04:00
Jose Garcia
368e8c6110 simplify contract for state polling 2021-08-27 17:34:06 -04:00
Alan Donovan
9f082ca887 Merge branch 'main' into main-style 2021-08-27 17:30:34 -04:00
Jose Garcia
e5f45d4bfa docs and improvement to the showStatus implementation 2021-08-27 16:41:22 -04:00
Jose Garcia
1e8a8370fe initial round of PR feedback 2021-08-27 16:29:02 -04:00
Alan Donovan
e423cb0ef9 display colon and cursor in survey prompts 2021-08-27 16:09:02 -04:00
Alan Donovan
d8f1baa519 more SKU renames. 2021-08-27 15:36:45 -04:00
Jose Garcia
da8655209b make things private 2021-08-27 12:52:30 -04:00
Jose Garcia
cb6552f4ca more efficient impl for processing states 2021-08-27 12:50:32 -04:00
Alan Donovan
38ff786a7d cmd/ghcs: style tweaks 2021-08-27 12:03:20 -04:00
Jose Garcia
e4e77a4294 merge upstream 2021-08-26 08:55:38 -04:00
Jose Garcia
151eb2b656 fix linter 2021-08-26 08:35:30 -04:00
Jose Garcia
2ef6e95982 show status under a flag 2021-08-24 20:15:21 -04:00
Jose Garcia
46ee45bcdd simplify the state iteration 2021-08-24 17:46:24 -04:00
Gabriel Ramirez
30be4c98f9 Send codespace name to Stdout to enable scripting 2021-08-24 13:12:18 -05:00
Jose Garcia
55f0dad3db merge upstream 2021-08-19 18:30:10 +00:00
Mislav Marohnić
517aae2805 Merge remote-tracking branch 'origin' into docs 2021-08-17 14:42:09 +02:00
Mislav Marohnić
5e472bc0e5 Improve command descriptions and argument assertions 2021-08-16 23:24:11 +02:00