Commit Graph

704 Commits

Author SHA1 Message Date
Steven Masley c04d045279
feat: RBAC provisionerdaemons and parameters (#1755)
* chore: Remove org_id from provisionerdaemons
2022-05-26 11:20:54 -05:00
Steven Masley eea8dc6c16
feat: Add rbac to templateversion+orgmember endpoints (#1713) 2022-05-25 11:00:59 -05:00
Steven Masley c7ca86d374
feat: Implement RBAC checks on /templates endpoints (#1678)
* feat: Generic Filter method for rbac objects
2022-05-24 08:43:34 -05:00
Cian Johnston c2f74f3cc2
chore: avoid concurrent usage of t.FailNow (#1683)
* chore: golangci: add linter rule to report usage of t.FailNow inside goroutines
* chore: avoid t.FailNow in goroutines to appease the race detector
2022-05-24 08:58:39 +01:00
Cian Johnston b2020761d9
feat: add default autostart and ttl for new workspaces (#1632)
* database: add autostart_schedule and ttl to InsertWorkspace; make gen
* coderd: workspaces: consume additional fields of CreateWorkspaceRequest
* cli: update: add support for TTL and autostart_schedule
* cli: create: add unit tests
* coder: import  `time/tzdata` for embedded timezone database
* autobuild: fix unit test that only runs with a real db
2022-05-23 23:31:41 +01:00
David Wahler 0c4a65b113
fix: manually fix coderd/database/dump.sql and make style/gen check run more reliably (#1607) 2022-05-19 22:37:22 +00:00
Cian Johnston d72c45e483
refactor: workspace autostop_schedule -> ttl (#1578)
Co-authored-by: G r e y <grey@coder.com>
2022-05-19 15:09:27 -04:00
Spike Curtis 9f402fa27f
Spike/222 workspace build order (#1534)
* chore: refactor before_id/after_id to build_number

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

* pagination of workspace_builds

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

* Disable parallel on postgres tests

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

* Fix lint

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

* Fix workspace build postgres query

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

* Fix JS tests

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

* Fix workspace builds postgres query

Signed-off-by: Spike Curtis <spike@coder.com>
2022-05-18 16:33:33 +00:00
Steven Masley a3556b12da
feat: Single query for all workspaces with optional filter (#1537)
* feat: Add single query for all workspaces using a filter
2022-05-18 10:09:07 -05:00
Colin Adler 98ccd0eb89
feat: add README parsing to template versions (#1500) 2022-05-17 15:00:48 -05:00
Kyle Carberry 55bd7aa747
fix: Run "make gen" to regenerate queries (#1504)
This is broken in our CI, and should be fixed!
I'll likely tackle in a future PR.
2022-05-16 23:47:31 -05:00
Kyle Carberry f75d29e38e
fix: Remove grouping for workspace owner counts (#1503)
This caused templates to show max ownership of one developer!
2022-05-17 04:10:52 +00:00
Colin Adler e925818526
feat: add template description (#1489) 2022-05-16 20:56:11 +00:00
Colin Adler f007aeee1f
chore: standardize migration names in create_migration.sh (#1480) 2022-05-16 17:35:00 +00:00
Colin Adler e990a9ac28
feat: add audit diffing for all user editable types (#1413) 2022-05-16 11:20:11 -05:00
Kyle Carberry dbd5b4a47b
feat: Add workspace owner name to response (#1448)
This will be rendered in the workspace page!
2022-05-13 20:41:21 -05:00
David Wahler 20916281d8
feat: Add reset-password command (#1380)
* allow non-destructively checking if database needs to be migrated

* feat: Add reset-password command

* fix linter errors

* clean up reset-password usage prompt

* Add confirmation to reset-password command

* Ping database before checking migration, to improve error message
2022-05-12 12:32:56 -05:00
Cian Johnston f4da5d4f3a
feat: add lifecycle.Executor to manage autostart and autostop (#1183)
This PR adds a package lifecycle and an Executor implementation that attempts to schedule a build of workspaces with autostart configured.

- lifecycle.Executor takes a chan time.Time in its constructor (e.g. time.Tick(time.Minute))
- Whenever a value is received from this channel, it executes one iteration of looping through the workspaces and triggering lifecycle operations.
- When the context passed to the executor is Done, it exits.
- Only workspaces that meet the following criteria will have a lifecycle operation applied to them:
  - Workspace has a valid and non-empty autostart or autostop schedule (either)
  - Workspace's last build was successful
- The following transitions will be applied depending on the current workspace state:
  - If the workspace is currently running, it will be stopped.
  - If the workspace is currently stopped, it will be started.
  - Otherwise, nothing will be done.
- Workspace builds will be created with the same parameters and template version as the last successful build (for example, template version)
2022-05-11 23:03:02 +01:00
Colin Adler 97a95f1377
chore: upgrade golangci-lint to v1.46.0 (#1373) 2022-05-10 16:04:23 -05:00
Mathias Fredriksson 2d3dc436a8
feat: Implement unified pagination and add template versions support (#1308)
* feat: Implement pagination for template versions

* feat: Use unified pagination between users and template versions

* Sync codepaths between users and template versions

* Create requestOption type in codersdk and add test

* Fix created_at edge case for pagination cursor in queries

* feat: Add support for json omitempty and embedded structs in apitypings (#1318)

* Add scripts/apitypings/main.go to Makefile
2022-05-10 07:44:09 +00:00
Kyle Carberry dc115b8ca0
fix: Use proper endpoint for user workspaces (#1356)
This was a silly mistake in a prior PR, so the code wasn't
actually being called!
2022-05-10 03:10:47 +00:00
Kyle Carberry b675aec4dd
feat: Add endpoint to get all workspaces a user can access (#1354)
This iterates through user organizations to get permitted
workspaces. This will allow admins to manage user workspaces!
2022-05-10 02:38:20 +00:00
Colin Adler 20caee1502
feat: add audit exporting and filtering (#1314) 2022-05-09 22:05:01 +00:00
Bruno Quaresma 57bb108465
feat: Add update user password endpoint (#1310) 2022-05-06 09:20:08 -05:00
Colin Adler 0ccf0102d7
fix: ensure correct version of sqlc is executed (#1287)
If `/usr/local/bin` is searched before `$GOPATH/bin` in your `$PATH` the
wrong version of `sqlc` can be executed.
2022-05-04 20:09:13 +00:00
Steven Masley d0293e4d33
feat: Implement list roles & enforce authorize examples (#1273) 2022-05-03 16:10:19 -05:00
Colin Adler 81bef1c83e
feat: add audit logging database schema (#1225) 2022-05-02 19:30:46 +00:00
Kyle Carberry 8701e0084c
feat: Update Terraform provider to support "dir" in "coder_agent" (#1219)
This allows users to specify a starting directory for shell sessions.
2022-05-02 10:27:34 -05:00
Steven Masley 35211e2190
feat: Add user roles, but do not yet enforce them (#1200)
* chore: Rework roles to be expandable by name alone
2022-04-29 09:04:19 -05:00
Bruno Quaresma ba4c3ce3b9
feat: add filter by status on GET /users (#1206) 2022-04-29 08:29:53 -05:00
Bruno Quaresma 816441eff7
feat: add organization_ids in the user(s) response (#1184) 2022-04-28 09:10:17 -05:00
Bruno Quaresma 441ffd6a0b
feat: add PUT /api/v2/users/:user-id/suspend endpoint (#1154) 2022-04-26 09:00:07 -05:00
Kyle Carberry 88669fd578
feat: Move workspaces under organizations (#1109)
This removes split ownership for workspaces. They are now
a resource of organizations and have a designated owner,
which is a user.

This enables simple administration for commands like:
- `coder stop ben/dev`
- `coder build logs colin/arch`

or if we decide to allow administrators to access workspaces,
they could even SSH using this syntax: `coder ssh colin/dev`.
2022-04-25 16:11:03 -05:00
Kyle Carberry d44876382d
fix: Remove unique index on auth tokens (#1120)
If a workspace is started multiple times, resources may
not be invalidated. This means an auth token can be
reused for a workspace.

coderd closes old agent connections, so this is expected
behavior, and the agent will reconnect properly.
2022-04-24 22:24:02 -05:00
Kyle Carberry 0c042dc249
fix: Remove duplicate index that blocked same name (#1118)
Multiple workspaces couldn't be created with the same names!
2022-04-25 02:40:14 +00:00
Kyle Carberry be974cf280
feat: Add users create and list commands (#1111)
This allows for *extremely basic* user management.
2022-04-24 20:08:26 -05:00
Kyle Carberry 7496c3da81
feat: Add GitHub OAuth (#1050)
* Initial oauth

* Add Github authentication

* Add AuthMethods endpoint

* Add frontend

* Rename basic authentication to password

* Add flags for configuring GitHub auth

* Remove name from API keys

* Fix authmethods in test

* Add stories and display auth methods error
2022-04-23 22:58:57 +00:00
Steven Masley 548de7d6f3
feat: User pagination using offsets (#1062)
Offset pagination and cursor pagination supported
2022-04-22 15:27:55 -05:00
Bruno Quaresma 1df750bf1a
feat: add GET /api/v2/users (#1028) 2022-04-18 17:19:47 +00:00
Kyle Carberry e3458277df
fix: Multiple builds using the incorrect agent token (#983)
This was an issue with our in-memory database that caused
newer builds to return an outdated agent, which would then
be rejected.

A test case has been added to ensure this can't happen again!
2022-04-12 20:11:57 +00:00
Kyle Carberry e8b310166f
fix: Remove resource addresses (#982)
These were added under the impression that there was significant
user-experience impact if multiple resources share the same name.

This hasn't proven to be true yet, so figured we'd take this out
until it becomes necessary.
2022-04-12 14:38:02 -05:00
Bruno Quaresma 63d1465019
feat: Add update profile endpoint (#916) 2022-04-12 14:05:21 +00:00
Kyle Carberry 19b4323512
feat: Allow workspace resources to attach multiple agents (#942)
This enables a "kubernetes_pod" to attach multiple agents that
could be for multiple services. Each agent is required to have
a unique name, so SSH syntax is:

`coder ssh <workspace>.<agent>`

A resource can have zero agents too, they aren't required.
2022-04-11 16:06:15 -05:00
Cian Johnston 23f989127d
coderd: autostart: codersdk, http api, database plumbing (#879)
* feat: add columns autostart_schedule, autostop_schedule to database schema
* feat: database: add UpdateWorkspaceAutostart and UpdateWorkspaceAutostop methods
* feat: add AutostartSchedule/AutostopSchedule to api workspace struct
* feat: codersdk: implement update workspace autostart and autostop methods
* chore: add unit tests for workspace autostarat and autostop methods
2022-04-07 10:03:35 +01:00
Kyle Carberry 02ad3f14f5
chore: Rename Projects to Templates (#880)
Customer feedback indicated projects was a confusing name.
After querying the team internally, it seemed unanimous
that it is indeed a confusing name.

Here's for a lil less confusion @ashmeer7 🥂
2022-04-06 12:42:40 -05:00
Garrett Delfosse 9da17be61e
feat: Add user scoped git ssh keys (#834) 2022-04-06 00:18:26 +00:00
Colin Adler b621c59a03
fix: update models.go in generate.go (#865) 2022-04-04 19:53:04 +00:00
Colin Adler e0eae49f52
fix: update querier.go in generate.sh (#864)
I accidentally forgot to copy this out.
2022-04-04 19:21:48 +00:00
Colin Adler fd523100bf
chore: split queries.sql into files by table (#762) 2022-04-01 15:45:23 -05:00
Colin Adler 2b1a0ee126
chore: update v1 schema (#643) 2022-04-01 14:42:36 -05:00
Colin Adler 3abb87ddb6
chore: remove usage of ioutil (#642)
It was deprecated as of 1.17.
2022-03-29 14:59:32 -05:00
Colin Adler be8389fd74
chore: update to go 1.18 (#628)
* add make lint to Makefile
2022-03-28 19:14:40 +00:00
Kyle Carberry b33dec9d38
feat: Add stage to build logs (#577)
* feat: Add stage to build logs

This adds a stage property to logs, and refactors the job logs
cliui.

It also adds tests to the cliui for build logs!

* Fix comments
2022-03-28 18:43:22 +00:00
Steven Masley 591523a078
chore: Move httpapi, httpmw, & database into `coderd` (#568)
* chore: Move httpmw to /coderd directory
httpmw is specific to coderd and should be scoped under coderd

* chore: Move httpapi to /coderd directory
httpapi is specific to coderd and should be scoped under coderd

* chore: Move database  to /coderd directory
database is specific to coderd and should be scoped under coderd

* chore: Update codecov & gitattributes for generated files
* chore: Update Makefile
2022-03-25 16:07:45 -05:00