Commit Graph

7129 Commits

Author SHA1 Message Date
Bryan bf90dede4f
fix: cancel button on create-workspace page wasn't going to the right place (#117) 2022-01-31 19:08:10 -08:00
Jonathan Yu 515e55db33
chore: cancel concurrent builds with native feature (#116)
Use the native 'concurrency' configuration feature to cancel
concurrent builds, rather than the cancel-workflow-action.
This also allows us to reduce permissions for the workflow.
2022-01-31 16:13:33 -08:00
Bryan 7cf686c996
feat: Add Create Workspace Form (#73)
Fixes #38 

This adds a create-workspace form (with only 1 field, probably the simplest form ever 😄 )

![image](https://user-images.githubusercontent.com/88213859/151108220-8a540c75-e55b-49af-8199-c69394508700.png)

It currently redirects to a path `/workspaces/<unique id>`, but that isn't implemented yet - but you can see the workspace show up on the projects page.
2022-01-31 10:22:34 -08:00
dependabot[bot] b586a35c6d
chore: bump http-proxy-middleware from 2.0.1 to 2.0.2 (#115)
Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/chimurai/http-proxy-middleware/releases)
- [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/master/CHANGELOG.md)
- [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: http-proxy-middleware
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-31 09:53:27 -08:00
dependabot[bot] 89fad40c42
chore: bump typescript from 4.5.4 to 4.5.5 (#114)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.4 to 4.5.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.5.4...v4.5.5)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-31 09:33:48 -08:00
dependabot[bot] 1f7003843d
chore: bump ts-jest from 27.1.2 to 27.1.3 (#111)
Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 27.1.2 to 27.1.3.
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/kulshekhar/ts-jest/compare/v27.1.2...v27.1.3)

---
updated-dependencies:
- dependency-name: ts-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-31 09:32:53 -08:00
dependabot[bot] 8560db9272
chore: bump @types/superagent from 4.1.14 to 4.1.15 (#110)
Bumps [@types/superagent](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/superagent) from 4.1.14 to 4.1.15.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/superagent)

---
updated-dependencies:
- dependency-name: "@types/superagent"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-31 09:08:34 -08:00
dependabot[bot] dae55a4ad6
chore: bump @types/node from 14.18.4 to 14.18.9 (#106)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.18.4 to 14.18.9.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-31 09:06:32 -08:00
dependabot[bot] c5e8259180
chore: bump eslint-plugin-jest from 25.7.0 to 26.0.0 (#104)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 25.7.0 to 26.0.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v25.7.0...v26.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-31 09:06:17 -08:00
Kyle Carberry e79817399e
Revert "chore: bump @material-ui/core from 4.9.4 to 4.12.3 (#102)" (#113)
This reverts commit d65ce2df71.
2022-01-31 09:24:13 -06:00
dependabot[bot] 0f30d856da
chore: bump swr from 1.1.2 to 1.2.0 (#103) 2022-01-31 04:28:18 +00:00
dependabot[bot] d65ce2df71
chore: bump @material-ui/core from 4.9.4 to 4.12.3 (#102) 2022-01-31 04:23:41 +00:00
dependabot[bot] 3900c337b2
chore: bump github.com/pion/webrtc/v3 from 3.1.17 to 3.1.18 (#101) 2022-01-31 04:08:59 +00:00
dependabot[bot] 91ddb7a39e
chore: bump storj.io/drpc from 0.0.28 to 0.0.29 (#100)
Bumps [storj.io/drpc](https://github.com/storj/drpc) from 0.0.28 to 0.0.29.
- [Release notes](https://github.com/storj/drpc/releases)
- [Commits](https://github.com/storj/drpc/compare/v0.0.28...v0.0.29)

---
updated-dependencies:
- dependency-name: storj.io/drpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kyle Carberry <kyle@coder.com>
2022-01-31 03:34:19 +00:00
Kyle Carberry b8cd579396
test: Skip leaked pion goroutines in peer (#108) 2022-01-30 21:29:38 -06:00
Jonathan Yu 58f3e439dd
chore: upgrade from chi 1.5.4 to 5.0.7 (#109) 2022-01-30 19:13:14 -08:00
Kyle Carberry 46d2550eda
ci: Remove code coverage step for Dependabot (#107) 2022-01-31 03:04:57 +00:00
Jonathan Yu 3fccfc5ef3
chore: add Stale to close old pull requests/issues (#98)
Add configuration for the Probot Stale bot, in order to close old
pull requests and issues.
2022-01-30 18:59:28 -08:00
Jonathan Yu 34fc62def5
chore: add Dependabot configuration (#97) 2022-01-30 18:53:37 -08:00
Jonathan Yu ed387a5f8b
chore(vscode): recommend code-spell-checker extension (#96) 2022-01-30 18:30:15 -08:00
Kyle Carberry 9db5fb0952
refactor: Improve handshake resiliency of peer (#95)
* fix: Synchronize peer logging with a channel

We were depending on the close mutex to properly
report connection state. This ensures the RTC
connection is properly closed before returning.

* Disable pion logging

* Remove buffer

* Try ICE servers

* Remove flushed

* Add diagram explaining handshake

* Fix candidate accept ordering

* Add debug logging to peerbroker

* Fix send ordering

* Lock adding ICE candidate

* Add test for negotiating out of order

* Reduce connection to a single negotiation channel

* Improve test times by pre-installing Terraform

* Lock remote session description being applied

* Organize conn

* Revert to multi-channel setup

* Properly close ICE gatherer

* Improve comments

* Try removing buffered candidates

* Buffer local and remote messages

* Log dTLS transport state

* Add pion logging
2022-01-30 20:11:18 -06:00
Kyle Carberry a7d6f4b673
ci: Lock PostgreSQL database creation (#94)
There have been race conditions when multiple instances
are created at once. This is an attempt to fix!
2022-01-29 21:16:34 -06:00
Kyle Carberry 5367d93b87
ci: Improve peer logging to help identify race (#93)
* ci: Improve peer logging to help identify race

* Remove mutex locks

* Add hash to write
2022-01-30 01:33:19 +00:00
Kyle Carberry 3e88f1502a
refactor: Remove "Opts" abbreviation (#92)
Having a mixture of abbreviations in the codebase reduces
clarity. Although opts is common for options, I'd rather
set a precedent of clarifying verbosity.
2022-01-29 19:27:44 -06:00
Kyle Carberry f9e594fbad
ci: Run PostgreSQL with a scratch directory to improve CI durability (#89)
When using parallel before, multiple PostgreSQL containers would
unintentionally interfere with the other's data. This ensures
both containers have separated data, and don't create a volume.

🌮 @bryphe-coder for the idea!
2022-01-29 18:39:59 -06:00
Kyle Carberry 2b922b1be1
feat: Add provisionerd protobuf definitions (#83)
* feat: Add parameter and jobs database schema

This modifies a prior migration which is typically forbidden,
but because we're pre-production deployment I felt grouping
would be helpful to future contributors.

This adds database functions that are required for the provisioner
daemon and job queue logic.

* feat: Compute project build parameters

Adds a projectparameter package to compute build-time project
values for a provided scope.

This package will be used to return which variables are being
used for a build, and can visually indicate the hierarchy to
a user.

* Fix terraform provisioner

* feat: Add provisionerd protobuf definitions

Provisionerd communicates with coderd over a multiplexed
WebSocket serving dRPC. This adds a roughly accurate protocol
definition.

It shares definitions with "provisioner.proto" for simple
interop with provisioners!
2022-01-29 17:52:14 -06:00
Kyle Carberry b3c5bb3576
feat: Compute project build parameters (#82)
* feat: Add parameter and jobs database schema

This modifies a prior migration which is typically forbidden,
but because we're pre-production deployment I felt grouping
would be helpful to future contributors.

This adds database functions that are required for the provisioner
daemon and job queue logic.

* feat: Compute project build parameters

Adds a projectparameter package to compute build-time project
values for a provided scope.

This package will be used to return which variables are being
used for a build, and can visually indicate the hierarchy to
a user.

* Fix terraform provisioner

* Improve naming, abstract inject to consume scope

* Run CI on all branches
2022-01-29 17:45:42 -06:00
Kyle Carberry b503c8b099
feat: Add parameter and jobs database schema (#81)
* feat: Add parameter and jobs database schema

This modifies a prior migration which is typically forbidden,
but because we're pre-production deployment I felt grouping
would be helpful to future contributors.

This adds database functions that are required for the provisioner
daemon and job queue logic.

* Add comment to acquire provisioner job query

* PostgreSQL hates running in parallel
2022-01-29 17:38:32 -06:00
Jonathan Yu 599ea2a331
chore: add tparallel linter (#88)
Add the tparallel linter, which checks that subtests of a parallel
test also run in parallel.
2022-01-29 12:21:16 -08:00
dependabot[bot] a193a089b8
chore: Bump next from 12.0.7 to 12.0.9 (#79)
Bumps [next](https://github.com/vercel/next.js) from 12.0.7 to 12.0.9.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v12.0.7...v12.0.9)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-28 17:39:04 -08:00
Kyle Carberry 27f7299383
chore: Update pion/ice fork to resolve goroutine leak (#78)
* chore: Update pion/ice fork to resolve goroutine leak

* Flush remote too

* Add logs for setting the description

* Try locking only on remote

* Remove local bufferring in favor of remote

* Remove unused flush func

* Set candidates flushed to true

* Defer flush until the end of negotiation

* Buffer ICE candidates

* Add comment clarifying channel buffer

* Flush after handshake

* Move away from fork

* Ignore pion/ice leaks
2022-01-27 20:43:55 -06:00
Kyle Carberry 30dae97c3e
chore: Buffer remote candidates like local (#77)
* chore: Buffer remote candidates like local

This was added for local candidates, and is required for remote
to prevent a race where they are added before a negotiation is
complete.

I removed the mutex earlier, because it would cause a different race.
I didn't realize the remote candidates wouldn't be buffered,
but with this change they are!

* Use local description instead

* Add logging for candidate flush

* Fix race with atomic bool

* Simplify locks

* Add mutex to flush

* Reset buffer

* Remove leak dependency to limit confusion

* Fix ordering

* Revert channel close

* Flush candidates after remote session description is set

* Bump up count to ensure race is fixed

* Use custom ICE dependency

* Fix data race

* Lower timeout to make for fast CI

* Add back mutex to prevent race

* Improve debug logging

* Lock on local description

* Flush local candidates uniquely

* Fix race

* Move mutex to prevent candidate send race

* Move lock to handshake so no race can occur

* Reduce timeout to improve test times

* Move unlock to defer

* Use flushed bool instead of checking remote
2022-01-27 09:14:52 -06:00
Kyle Carberry 9329a50ad6
chore: Fix race in collecting ICE Candidates (#76)
* chore: Fix race in collecting ICE Candidates

This logic was flawed previously. ICE Candidates could collect
before a negotiation was triggered, which led to a race where
candidates would be lost. Candidates can no longer be lost,
and we removed some code 😎.

* Add comment describing fix

* Use upstream dependency to fix goroutine leak

* Use upstream dependency to fix goroutine leak
2022-01-26 20:14:37 -06:00
Bryan f970e358fc
chore: Set patch coverage to informational (always pass status check) (#75) 2022-01-26 14:24:11 -08:00
Bryan 0c46cbf406
fix: Use /projects as the landing page (#72)
Previously, there was a pseudo-workspaces page that was leftover from prototyping, but doesn't make sense in the revised flow.

Now, we have a `/projects` page, and after logging in, the user should be taken to that page:
![2022-01-25 20 13 58](https://user-images.githubusercontent.com/88213859/151102949-e756c995-eb43-42db-948d-931c2f0a1fca.gif)

This implements a client-side redirect to land on our `/projects` route.
2022-01-26 09:16:55 -08:00
Bryan 3047f251a8
feat: Implement simple Project Summary page (#71)
This implements a very simple Project Summary page (which lists workspaces):

![image](https://user-images.githubusercontent.com/88213859/151085991-bf5b101a-eadd-445b-9b42-1e98591e8343.png)

...which also has an empty state:

![image](https://user-images.githubusercontent.com/88213859/151086084-90d526a9-7661-46f0-b205-976518f978c1.png)

Fixes #66
2022-01-25 19:50:31 -08:00
Bryan c7fb16ebde
feat: Initial Project Create Form ('/projects/create') (#60)
This implements a simple form for creating projects:

![2022-01-25 12 58 21](https://user-images.githubusercontent.com/88213859/151058767-be3672f6-e100-48c8-849e-cc6de94f3ebf.gif)

Fixes #65
2022-01-25 16:36:26 -08:00
Bryan bbd8b8ffa8
refactor: Refactor FormTextField to not require a HoC (#70)
Prompted from discussion here: https://github.com/coder/coder/pull/60/files#r792124373

Our current FormTextField implementation requires a [higher-order component](https://reactjs.org/docs/higher-order-components.html), which can be complicated to understand.

This experiments with moving it to not require being a HoC.

The only difference in usage is that sometimes, you need to provide the type like `<FormTextField<FormValues> form={form} formFieldName="some-field-in-form" />` - but it doesn't require special construction.
2022-01-25 14:00:19 -08:00
Kyle Carberry 9cf4f7c1ac
chore: Add VS Code recommended extensions (#68)
* chore: Add VS Code recommended extensions

This adds extensions I feel work well for the project.
With this, a "Run on Save" extension is added that runs
"make gen" on save of query.sql to regenerate models.

* Fix formatting
2022-01-25 21:32:12 +00:00
Bryan ec144d9f56
refactor: Fix path for creating initial user in dev script (#69)
Just a small fix in the `develop.sh` script to pick up the new create initial user route
2022-01-25 13:22:56 -08:00
Kyle Carberry 5b01f615eb
feat: Add APIs for querying workspaces (#61)
* Add SQL migration

* Add query functions for workspaces

* Add create routes

* Add tests for codersdk

* Add workspace parameter route

* Add workspace query

* Move workspace function

* Add querying for workspace history

* Fix query

* Fix syntax error

* Move workspace routes

* Fix version

* Add CLI tests

* Fix syntax error

* Remove error

* Fix history error

* Add new user test

* Fix test

* Lower target to 70%

* Improve comments

* Add comment
2022-01-25 19:52:58 +00:00
Bryan 139828d594
refactor: 'create_initial_user.sh' helper script (#59)
I've been running this `curl` command a bunch of times every day (whenever I restart my dev server) - so moving it to a more convenient place.
2022-01-25 11:08:25 -08:00
Kyle Carberry 5d7112f0d7
ci: Pin the golangci-lint version to prevent breakage (#62)
* ci: Pin the golangci-lint version to prevent breakage

The main branch broke because golangci-lint released a new version.
This pins it, so hopefully it never happens again!

* Fix version string
2022-01-25 10:04:25 -06:00
Bryan b964cb0380
feat: Initial Projects listing page (#58)
This implements a simple Project listing page at `/projects` - just a table for a list of projects:

![image](https://user-images.githubusercontent.com/88213859/150906058-bbc49cfc-cb42-4252-bade-b8d48a986280.png)

...and an empty state:

![image](https://user-images.githubusercontent.com/88213859/150906882-03b0ace5-77c6-4806-b530-008769948867.png)

There isn't too much data to show at the moment. It'll be nice in the future to show the following fields and improve the UI with it:
- An icon
- A list of users using the project
- A description

However, this brings in a lot of scaffolding to make it easier to build pages like this (`/organizations`, `/workspaces`, etc).

In particular, I brought over a few things from v1:
- The `Hero` / `Header` component at the top of pages + sub-components
- A `Table` component for help rendering table-like UI + sub-components
- Additional palette settings that the `Hero`
2022-01-25 07:41:59 -08:00
Bryan 69d88b4a6d
feat: Add Sign-out functionality (#46)
#37 implemented the Sign-_in_ flow, but there wasn't a Sign-_out_ flow as part of that PR (aside from letting the cookie expire... or manually deleting the cookie...), which is obviously not ideal.

This PR implements a basic sign-out flow, along with a very simple user dropdown:
![2022-01-21 18 09 14](https://user-images.githubusercontent.com/88213859/150620847-94e4d22f-1dcf-451e-8b4a-cec24702ea6c.gif)

Bringing in a few pruned down components for the `<UserDropdown />` to integrate into the `<NavBar />`.

In addition, this also implements a simple back-end API for `/logout` which just clears the session token.
2022-01-24 17:09:39 -08:00
Kyle Carberry a44056cff5
feat: Add project API endpoints (#51)
* feat: Add project models

* Add project query functions

* Add organization parameter query

* Add project URL parameter parse

* Add project create and list endpoints

* Add test for organization provided

* Remove unimplemented routes

* Decrease conn timeout

* Add test for UnbiasedModulo32

* Fix expected value

* Add single user endpoint

* Add query for project versions

* Fix linting errors

* Add comments

* Add test for invalid archive

* Check unauthenticated endpoints

* Add check if no change happened

* Ensure context close ends listener

* Fix parallel test run

* Test empty

* Fix organization param comment
2022-01-24 17:07:42 +00:00
Kyle Carberry 52e50fc9ca
fix: Use upstream github.com/pion/ice dependency (#55)
A forked version containing the following fix was used:
https://github.com/pion/ice/pull/411

This has been merged upstream! 🥳
2022-01-24 16:54:08 +00:00
Kyle Carberry a96cd3fc3d
ci: Run peer tests faster on local machine (#54)
This should result in faster local development, and faster CI!
See the code comment for rationale.
2022-01-24 07:57:21 -08:00
Kyle Carberry 8be245616a
feat: Add organizations endpoint for users (#50)
* feat: Add organizations endpoint for users

This moves the /user endpoint to /users/me instead. This
will reduce code duplication.

This adds /users/<name>/organizations to list organizations
a user has access to. It doesn't contain the permissions a
user has over the organizations, but that will come in a future
contribution.

* Fix requested changes

* Fix tests

* Fix timeout

* Add test for UserOrgs

* Add test for userparam getting

* Add test for NoUser
2022-01-22 23:58:10 -06:00
Kyle Carberry 50d8151995
ci: Run tests using PostgreSQL database and mock (#49)
* ci: Run tests using PostgreSQL database and mock

This allows us to use the mock database for quick iterative testing,
and have confidence from CI using a real PostgreSQL database.

PostgreSQL tests are only ran on Linux. They are *really* slow on MacOS
and Windows runners, and don't provide much additional confidence.

* Only run PostgreSQL tests once for speed

* Fix race condition of log after close

Not all resources were cleaned up immediately after a peer connection was
closed. DataChannels could have a goroutine exit after Close() prior to this.

* Fix comment
2022-01-22 21:58:26 +00:00