Commit Graph

74 Commits

Author SHA1 Message Date
Marcin Tojek 7a453608c9
feat: support `order` property of `coder_agent` (#12121) 2024-02-15 13:33:13 +01:00
Bruno Quaresma dcab6fa5a4
feat(site): display user avatar (#11893)
* add owner API to workspace and workspace build responses
* display user avatar in workspace top bar

Co-authored-by: Cian Johnston <cian@coder.com>
2024-01-30 17:07:06 +00:00
Cian Johnston 19abde12fb
chore(coderd): fix test flake with auditor (#11316) 2023-12-22 09:50:49 +00:00
Mathias Fredriksson 6683ad989a
test(coderd): fix TestWorkspaceBuild flake (#10387)
Fixes #10335
2023-10-23 19:45:54 +03:00
Colin Adler 1ad998ee3a
fix: add requester IP to workspace build audit logs (#10242) 2023-10-18 15:08:02 -05:00
Cian Johnston c83af5e627
chore(cli): add linter to detect potential spurious usage of owner user in cli tests (#10133)
* Detects the following pattern where the CLI is initialized with a client authenticated as the "first user":

    client := coderdtest.New(t, ...)
    [...]
    user := coderdtest.CreateFirstUser(t, client)
    [...]
    clitest.SetupConfig(t, client, root)

* Updates documentation regarding role permissions on workspaces.
2023-10-10 11:14:20 +01:00
Kayla Washburn c194119689
chore: rename `AwaitTemplateVersionJobCompleted` and `AwaitWorkspaceBuildJobCompleted` (#10003) 2023-10-03 11:02:56 -06: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
Spike Curtis e7a231e44f
fix: fix test flake introduced by #9264 (#9330)
* Fix test flake introduced by #9264

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

* change check to match suffix

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-25 10:48:42 +00:00
Spike Curtis 60d5002eb6
refactor: change template archive extraction to be on provisioner (#9264)
* refactor provisionersdk protocol

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

* refactor provisioners to use new protocol

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

* refactor provisionerd to use new protocol

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

* refactor tests & proto renames

* Fixes from self-review

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

* appease fmt & link

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

* code review fixes & e2e fixes

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

* More fmt

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

* Code review fixes

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

* new gen; use uuid for session workdir

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

* Revert nix-based gen CI task until dogfood is on nix

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

* revert deleting dogfood Docker stuff

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

* Revert "revert deleting dogfood Docker stuff"

This reverts commit 9762158167.

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-25 06:10:15 +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
Dean Sheather 2f0a9996e7
chore: add derpserver to wsproxy, add proxies to derpmap (#7311) 2023-07-27 02:21:04 +10:00
Marcin Tojek 83fee4b192
feat: enable Terraform debug mode via deployment configuration (#8260) 2023-06-29 15:22:21 +02:00
Marcin Tojek a7366a8b76
feat!: drop support for legacy parameters (#7663) 2023-06-02 11:16:46 +02:00
Spike Curtis cd416c86dd
refactor: workspace builds (#7541)
* refactor workspace builds

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

* make gen

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

* Remove ParameterResolver from typescript

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

* rename conversion -> database/db2sdk

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

* tests for db2sdk

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

* Tests for ParameterResolver

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

* wsbuilder tests

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

* Move parameter validation tests to richparameters_test.go

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

* Fix CI generation; rename mock->dbmock

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

* Fix test imports

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-05-23 12:06:33 +04:00
Marcin Tojek c000f2ec28
fix: coder_parameter fallbacks to default (#7240) 2023-04-24 09:51:34 +02:00
Mathias Fredriksson 6f06f8dadb
test: Fix test timeouts due to contexts created too early (#7242) 2023-04-21 17:32:25 +03:00
Marcin Tojek 083fc89f93
feat: accept immutable parameters when used first time (#7000)
* Backend fixes

* CLI: adjust update flow
2023-04-04 14:22:46 +02:00
Kyle Carberry a63c97b8de
chore: wrap audit logs in a mutex to fix data race (#6898)
This was seen in `main`!
2023-03-30 12:13:03 -05:00
Marcin Tojek 0ba200c2a1
feat: Enable workspace debug logging (#6838)
* feat: Enable workspace debug logging

* Fix

* Fix

* Fix

* fix

* fix

* Enable RBAC

* unit tests

* Fix

* fix

* fix

* fix

* more tests

* fix: workspacebuild_test use roles

* fix: swagger comment

* fix: ctx.Done

* fix: address PR comments

* break loop
2023-03-30 16:00:33 +02:00
Marcin Tojek a7c734c60b
feat: support list(string) as coder_parameter (#6618)
* feat: support list(string) as coder_parameter

* Fix
2023-03-16 11:07:10 +01:00
Marcin Tojek 7587850a1c
feat: import value from legacy variable to build parameter (#6556) 2023-03-14 12:02:44 +00:00
Ammar Bandukwala f05609b4da
chore: format Go more aggressively 2023-02-18 18:32:09 -06:00
Marcin Tojek b86bce8494
feat!: Validate monotonic numbers for rich parameters (#6046)
* Database changes

* protobuf

* Fix: docs

* workspaces_test

* Validation in coderd

* Fix: resources

* omitempty

* UI changes

* UI tests

* fix
2023-02-07 09:36:13 +01:00
Kyle Carberry 71a893764e
chore: remove `CreateAnotherUserWithUser` (#6068)
This was not idiomatic Go!
2023-02-06 23:48:21 +00:00
Kira Pilot 46fe59f5e7
feat: audit login (#5925)
* added migration for api key resource

* sort of working

* auditing login

* passing  the correct user id

* added and fixed tests

* gen documentation

* formatting and lint

* lint

* audit Github oauth and write tests

* audit oauth and write  tests

* added defer fn for login error auditing

* fixed test

* feat: audit logout (#5998)

* Update coderd/userauth.go

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>

* fix test

* bypassing diff generation if login/logout

* lint

---------

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
2023-02-06 15:12:50 -05:00
Kyle Carberry b20cb993bd
fix: loop variable captured by func literal in parameters test (#5878)
I noticed this when adding a new parameter type. There's a test
case for an empty string that returned false for validation,
but appears like it could be true.

If there is no value for a string, then the default is used.
In this case there is no default, but that's technically fine
I believe.
2023-01-27 09:37:55 -06:00
Marcin Tojek 26c69525d1
feat: Validate workspace build parameters (#5807) 2023-01-24 14:22:00 +01:00
Marcin Tojek bbb208e29c
feat: Add CLI support for workspace build parameters (#5768)
* WIP

* WIP

* CLI: handle workspace build parameters

* fix: golintci

* Fix: dry run

* fix

* CLI: is mutable

* coderd: mutable

* fix: golanci

* fix: richParameterFile

* CLI: create unit tests

* CLI: update test

* Fix

* fix: order

* fix
2023-01-23 15:01:22 +01:00
Marcin Tojek 1b0560ceb4
feat: Expose workspace build parameters via API (#5743) 2023-01-17 16:24:45 +01:00
Marcin Tojek 6ebadabe4e
feat: Add basic support for rich parameters to coderd and provisionerd (#5710) 2023-01-17 11:22:11 +01:00
Presley Pizzo 627fbe5874
fix: make build table show empty instead of loading when none are recent (#5666)
* Fix builds to show empty instead of loading

* Switch to backend fix

* Increase e2e test timeout

* Format
2023-01-11 12:18:06 -05:00
Kira Pilot 6786ca2854
Audit build outcomes/kira pilot (#5143)
* auditing failed builds

* logging workspace build successes

* remove duplicate workspace build entry

* fixed workspacebuilds_test

* PR feedback

* lint and migrations

* fix nil auditors

* workspace_build test

* fixed workspaces_teest

Co-authored-by: Colin Adler <colin1adler@gmail.com>
2022-11-22 13:22:56 -05:00
Marcin Tojek e86539db11
feat: Allow user to cancel workspace jobs (#5115)
* Add database column allow_user_cancel_workspace_jobs

* Adjust API

* site: typesGenerated.ts

* Expose template.allow_ in Workspaces API

* Fix: site tests

* Fix: make fmt/prettier

* Fix: enterprise

* Database tests

* Add CLI tests

* Add checkbox

* i18n

* Logic: block cancelling

* Unit tests for conditional cancel

* Fix: message

* Address PR comment

* Address PR comments

* Fix: make
2022-11-21 11:43:53 +01:00
Ammar Bandukwala 95fb59696e
Refactor Provisioner to distinguish Plan and Apply (#5036) 2022-11-11 16:45:58 -06:00
Kyle Carberry 30281852d6
feat: Add buffering to provisioner job logs (#4918)
* feat: Add bufferring to provisioner job logs

This should improve overall build performance, and especially under load.

It removes the old `id` column on the `provisioner_job_logs` table
and replaces it with an auto-incrementing big integer to preserve order.

Funny enough, we never had to care about order before because inserts
would at minimum be 1ms different. Now they aren't, so the order needs
to be preserved.

* Fix log bufferring

* Fix frontend log streaming

* Fix JS test
2022-11-06 20:50:34 -06:00
Kira Pilot 8282e46813
chore: add audit log tests (#4764)
* added test for stopping a workspace build

* formatted sfriendly string; added tests

* logging unmarshal error in auditLogDescription

* prettier

* got rid of extra workspace word

* PR feedback

* fixed mistake; wrote tests in penance

* fix be
2022-10-27 15:57:41 -04:00
Kira Pilot 3c5e292c5a
feat: add workspace build start/stop to audit log (#4744)
* adding workspace_build resource

* added migration

* fix keyword

* got rid oof diffs for workspace builds

* adding workspace name to string

* renamed migrations

* fixed lint

* pass throough AdditionalFields and fix tests

* no need to pass through each handler

* cleaned up migrations

* generated types; fixed missing cases

* logging error
2022-10-25 15:34:48 -04:00
Kyle Carberry 7d04bf2abe
Revert "adding workspace_build resource (#4636)" (#4742)
This reverts commit 145faf4400.
2022-10-25 08:41:00 -05:00
Kira Pilot 145faf4400
adding workspace_build resource (#4636)
* adding workspace_build resource

* added migration

* added migration for audit_actions

* fix keyword

* got rid oof diffs for workspace builds

* adding workspace name to string

* renamed migrations

* fixed lint

* pass throough AdditionalFields and fix tests

* no need to pass through each handler

* cleaned up migrations
2022-10-25 09:27:50 -04:00
Kira Pilot bf0aca35fa
fix: ensure deleting workspace creates audit log (#4537)
* fix: ensure deleting workspace creates audit log

* getting rid of comments

* remove whitespace

* pushing failing test

* fixed test
2022-10-14 09:47:38 -04:00
Kyle Carberry daa34cf7b8
fix: Return deleted users when fetching workspace builds (#4441)
Fixes #4359.
2022-10-10 18:03:54 +00:00
Ammar Bandukwala eefc26c108
Hide build logs older than 30 days (#4436) 2022-10-09 20:01:18 +00:00
Garrett Delfosse 738a38d71f
chore: remove resources calls (#4344) 2022-10-03 21:01:13 +00:00
Kyle Carberry df2649ed2a
fix: Test flake in `TestWorkspaceStatus` (#4333)
This also changes the status to be on the workspace build, since
that's where the true value is calculated. This exposed a bug where
jobs could never enter the canceled state unless fetched by a
provisioner daemon, which was nice to fix!

See: https://github.com/coder/coder/actions/runs/3175304200/jobs/5173479506
2022-10-03 11:43:11 -05:00
Kyle Carberry a7ee8b31e0
fix: Don't use StatusAbnormalClosure (#4155) 2022-09-22 18:26:05 +00:00
Mathias Fredriksson 9e12850f38
fix: Remove TestWorkspaceBuildResources/ListRunning (#4088) 2022-09-16 16:39:57 +03:00
Kyle Carberry 519d724ca4
fix: Sort resources by name (#3941)
Fixes #3489.
2022-09-08 03:16:26 +00:00
Ammar Bandukwala 4f0105ef7e
feat: add orphan support (#3849)
* feat: add resource orphanage

* feat: deny custom state in build for regular users

* Minor protoc improvements
2022-09-06 17:07:00 +00:00
Kyle Carberry 67c4605370
chore: Reduce test times (#3856)
* chore: Reduce test times

* Rename IncludeProvisionerD to IncludeProvisionerDaemon

* Make  TestTemplateDAUs use Tailnet
2022-09-04 11:28:09 -05:00