Commit Graph

1124 Commits

Author SHA1 Message Date
Kyle Carberry 839a16e299
feat: add dbfake for workspace builds and resources (#10426)
* feat: add dbfakedata for workspace builds and resources

This creates `coderdtest.NewWithDatabase` and adds a series of
helper functions to `dbfake` that insert structured fake data
for resources into the database.

It allows us to remove provisionerd from a significant amount of
tests which should speed them up and reduce flakes.

* Rename dbfakedata to dbfake

* Migrate workspaceagents_test.go to use the new dbfake

* Migrate agent_test.go to use the new fakes

* Fix comments
2023-11-02 17:15:07 +00:00
Spike Curtis 94eb9b8db1
fix: disable t.Parallel on TestPortForward (#10449)
I've said it before, I'll say it again: you can't create a timed context before calling `t.Parallel()` and then use it after.

Fixes flakes like https://github.com/coder/coder/actions/runs/6716682414/job/18253279157

I've chosen just to drop `t.Parallel()` entirely rather than create a second context after the parallel call, since the vast majority of the test time happens before where the parallel call was.  It does all the tailnet setup before `t.Parallel()`.
Leaving a call to `t.Parallel()` is a bug risk for future maintainers to come in and use the wrong context in the latter part of the test by accident.
2023-11-01 13:45:13 +04:00
Kyle Carberry 5abfe5afd0
chore: rename dbfake to dbmem (#10432) 2023-10-30 17:42:20 +00:00
Mathias Fredriksson 9d3785def8
test(cli/cliui): make agent tests more robust (#10415)
Fixes #10408
2023-10-30 13:20:10 +02:00
Mathias Fredriksson eac155aec2
test(cli): fix TestServer flake due to DNS lookup (#10390) 2023-10-24 22:12:03 +03:00
Josh Vawdrey 6b2aee4133
feat(cli): make the dotfiles repository directory configurable (#10377) 2023-10-24 12:00:04 +03:00
Jon Ayers 1372bf82f5
chore: revert "chore: remove workspace_actions experiment (#10030)" (#10363) 2023-10-20 13:21:53 -05:00
Jon Ayers d33526108f
feat: add frontend support for mandating active template version (#10338) 2023-10-19 18:21:52 -05:00
Jon Ayers f5f150d568
feat: add cli support for --require-active-version (#10337) 2023-10-19 17:16:15 -05:00
Ammar Bandukwala b799014832
docs: rework telemetry doc and add CLI warning (#10354) 2023-10-19 15:50:20 -05:00
Marcin Tojek c4f590581e
feat: expose template insights as Prometheus metrics (#10325) 2023-10-19 08:45:12 +00:00
Jon Ayers 997493d4ae
feat: add template setting to require active template version (#10277) 2023-10-18 17:07:21 -05:00
Colin Adler 1ad998ee3a
fix: add requester IP to workspace build audit logs (#10242) 2023-10-18 15:08:02 -05:00
Kayla Washburn 619df23ad1
chore: fix linting issues and generated files (#10317) 2023-10-17 14:41:35 -06:00
Cian Johnston dd86100f33
fix(scaletest): fix flake in Test_Runner/Cleanup (#10252)
* fix(scaletest/createworkspaces): address flake in Test_Runner/CleanupPendingBuild

* fix(scaletest): pass io.Writer to Cleanup()

* add some extra logs to workspacebuild cleanup

* fixup! fix(scaletest): pass io.Writer to Cleanup()

* remove race

* fmt

* address PR comments
2023-10-16 12:37:12 +01:00
Steven Masley 39c0539d42
feat: add controls to template for determining startup days (#10226)
* feat: template controls which days can autostart
* Add unit test to test blocking autostart with DaysOfWeek
2023-10-13 11:57:18 -05:00
Cian Johnston 1e75762cb4
fix(cli): scaletest: create-worksapces: remove invalid character for kubernetes provider in implicit plan (#10228) 2023-10-12 09:21:40 +01:00
Steven Masley 1e950fa9a8
feat: archive template versions to hide them from the ui (#10179)
* api + cli implementation
2023-10-11 09:26:22 -05:00
Marcin Tojek a1ee4d44aa
fix: test: TestSSH_RemoteForward wait for startup script (#10211) 2023-10-11 14:17:04 +02:00
Cian Johnston e829cbf2db
fix(scaletest/dashboard): fix early exit due to validate (#10212) 2023-10-11 11:51:06 +00:00
Cian Johnston b3471bd23a
fix(scaletest/dashboard): increase viewport size and handle deadlines (#10197)
- Set viewport size to avoid responsive mode
- Added way more debug logging
- Added facility to write a screenshot on error in verbose mode.
- Added a deadline for each iteraction of clicking on and waiting for a thing.
2023-10-11 11:10:08 +01:00
Jon Ayers 91555c3a85
feat: support configurable web terminal rendering (#10095)
* feat: support configurable web terminal rendering

- Added a deployment option for configuring web terminal rendering.
  Valid values are 'webgl', 'canvas', and 'dom'.
2023-10-10 13:18:02 -05:00
Jon Ayers 05a393cd06
feat: only display license warnings to privileged users (#10096) 2023-10-10 12:48:51 -05:00
Colin Adler 00589d6422
chore: fix lint failures 2023-10-10 11:26:53 -05:00
Colin Adler c11f241622
feat: add `--version` flag to `coder templates pull`, default to active version (#10153)
Fixes https://github.com/coder/coder/issues/9837
2023-10-10 10:20:31 -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
Kyle Carberry 9c098b218f
feat: allow external auth providers to expose extra metadata (#10157) 2023-10-09 23:02:16 -05:00
Kyle Carberry 863c2e7b64
feat: allow storing extra oauth token properties in the database (#10152) 2023-10-09 18:49:30 -05:00
Kyle Carberry 35538e1051
feat: add `external-auth` cli (#10052)
* feat: add `external-auth` cli

* Add subcommands

* Improve descriptions

* Add external-auth subcommand

* Fix docs

* Fix gen

* Fix comment

* Fix golden file
2023-10-09 23:04:35 +00:00
Colin Adler 9e622d00a6
feat(cli): add `coder users delete` command (#10115) 2023-10-09 11:47:57 -05:00
Spike Curtis 24c80bf532
fix: remove AwaitWorkspaceAgents in goroutines
AwaitWorkspaceAgent calls testify.require which isn't allowed from a goroutine and causes cascading failures in the test suite such as: https://github.com/coder/coder/actions/runs/6458768855/job/17533163316

I don't believe these functions serve a direct purpose since nothing else is "waiting" for the functions to return before doing other things.
2023-10-09 20:37:23 +04:00
Cian Johnston 5673aca408
feat(cli): add --parameter flag to exp scaletest command (#10132) 2023-10-09 14:08:24 +01:00
Spike Curtis 983e8c3ae8
feat: add API support for workspace automatic updates (#10099)
* Added automatic_updates to workspaces table

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

* Queries and API updates

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

* Golden files

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

* Enable automatic updates on autostart

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

* db migration number

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

* fix imports and ts mock

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

* code review updates

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-10-06 13:27:12 +04:00
Kyle Carberry ad47ef17e8
feat: allow reading the agent token from a file (#10080)
Adds `CODER_AGENT_TOKEN_FILE` which will read the agent token from
a file if `CODER_AGENT_TOKEN` is not provided. Using a Kubernetes
Secret with a volume-mounted file is a more secure way to provide
the agent token instead of an environment variable.
2023-10-05 15:41:05 -05:00
Jon Ayers eb4826a11f
chore: remove workspace_actions experiment (#10030) 2023-10-05 14:18:35 -05:00
Jon Ayers 91265678ad
chore: add auditing to workspace dormancy (#10070)
- Adds an audit log for workspaces automatically transitioned to the dormant
  state.
- Imposes a mininum of 1 minute on cleanup-related fields. This is to
  prevent accidental API misuse from resulting in catastrophe.
2023-10-05 13:41:07 -05:00
Mathias Fredriksson 48ee80a559
fix(cli): prevent sqlDB leaks in ConnectToPostgres (#10072) 2023-10-05 17:57:48 +03:00
Kyle Carberry bca7416069
fix: add `--version` flag to the root to support migrating customers (#10063) 2023-10-04 15:37:15 -05:00
Kyle Carberry fd06b7f7a0
fix: allow all environment variables to fallback prefix to `HOMEBREW_` (#10050)
See the customer use-case in the code docs.
2023-10-04 18:57:49 +00:00
Kayla Washburn c194119689
chore: rename `AwaitTemplateVersionJobCompleted` and `AwaitWorkspaceBuildJobCompleted` (#10003) 2023-10-03 11:02:56 -06:00
Cian Johnston 9aac15212b
fix(cli): remove exp scaletest from slim binary (#9934)
- Removes the `exp scaletest` command from the slim binary 
- Updates scaletest-runner template to fetch the full binary from the running Coder instance
2023-10-03 15:13:04 +01:00
Kyle Carberry 45b53c285f
feat: allow external services to be authable (#9996)
* feat: allow external services to be authable

* Refactor external auth config structure for defaults

* Add support for new config properties

* Change the name of external auth

* Move externalauth -> external-auth

* Run gen

* Fix tests

* Fix MW tests

* Fix git auth redirect

* Fix lint

* Fix name

* Allow any ID

* Fix invalid type test

* Fix e2e tests

* Fix comments

* Fix colors

* Allow accepting any type as string

* Run gen

* Fix href
2023-10-03 14:04:39 +00:00
Monika Pawluczuk 4966ef02cf
feat(cli): add reverse tunnelling SSH support for unix sockets (#9976) 2023-10-03 16:39:39 +10:00
Kayla Washburn 885b2502ed
chore: replace `<ChooseOne>` with alternatives when appropriate (#9907) 2023-10-02 10:51:35 -06:00
Cian Johnston 1c48610d56
feat(scaletest/dashboard): integrate chromedp (#9927)
* Adds a set of actions to automatically interact with a Coder instance using chromedp
* Integrates the chromedp actions into the scaletest dashboard command,
* Re-enables the previously disabled unit tests for scaletest/dashboard
* Removes previous dashboard actions based around codersdk
2023-10-02 10:40:17 +01:00
Kyle Carberry 5596fb20b5
chore: move `/gitauth` to `/externalauth` on the frontend (#9954)
* chore: move `/gitauth` to `/externalauth` on the frontend

This actually took a lot more jank than anticipated,
so I wanted to split this up before adding the ability
to embed new providers.

* Rename FE

* Fix em' up

* Fix linting error

* Fix e2e tests

* chore: update helm golden files
2023-09-30 14:30:01 -05:00
Steven Masley e9ccb8dc78
chore: change cli error message handling (#9952)
* chore: add command to easily visualize different errors

* chore: add verbose error printing in cli
2023-09-29 16:50:23 -05:00
Kyle Carberry 8abca9bea7
chore: rename `git_auth` to `external_auth` in our schema (#9935)
* chore: rename `git_auth` to `external_auth` in our schema

We're changing Git auth to be external auth. It will support
any OAuth2 or OIDC provider.

To split up the larger change I want to contribute the schema
changes first, and I'll add the feature itself in another PR.

* Fix names

* Fix outdated view

* Rename some additional places

* Fix sort order

* Fix template versions auth route

* Fix types

* Fix dbauthz
2023-09-29 19:13:20 +00:00
Steven Masley 92308bec3b
chore: color `value_source` for deployment values (#9922)
* chore: Return populated options vs a blank
* Strip secret values
2023-09-29 12:04:28 -05:00
Marcin Tojek c0705ec40e
fix: flaky TestCreateValidateRichParameters/ValidateString (#9928) 2023-09-29 12:54:51 +02:00
Mathias Fredriksson 0878381d0b
fix(cli/cliui): avoid nil pointer deref when agent disconnects (#9892)
Fixes #9884
2023-09-27 19:10:15 +03:00
Cian Johnston fad02081fc
fix: avoid logging env in unit tests (#9885) 2023-09-27 13:34:40 +01:00
Cian Johnston 93ef696b57
refactor(agent): add agenttest.New helper function (#9812)
* Adds agenttest.New() helper function
* Makes sure agent gets closed on test cleanup
* Makes sure you don't forget to set session token
* Sets the agent and client logger automatically
2023-09-26 12:05:19 +01:00
Kyle Carberry 1262eef2c0
feat: add support for `coder_script` (#9584)
* Add basic migrations

* Improve schema

* Refactor agent scripts into it's own package

* Support legacy start and stop script format

* Pipe the scripts!

* Finish the piping

* Fix context usage

* It works!

* Fix sql query

* Fix SQL query

* Rename `LogSourceID` -> `SourceID`

* Fix the FE

* fmt

* Rename migrations

* Fix log tests

* Fix lint err

* Fix gen

* Fix story type

* Rename source to script

* Fix schema jank

* Uncomment test

* Rename proto to TimeoutSeconds

* Fix comments

* Fix comments

* Fix legacy endpoint without specified log_source

* Fix non-blocking by default in agent

* Fix resources tests

* Fix dbfake

* Fix resources

* Fix linting I think

* Add fixtures

* fmt

* Fix startup script behavior

* Fix comments

* Fix context

* Fix cancel

* Fix SQL tests

* Fix e2e tests

* Interrupt on Windows

* Fix agent leaking script process

* Fix migrations

* Fix stories

* Fix duplicate logs appearing

* Gen

* Fix log location

* Fix tests

* Fix tests

* Fix log output

* Show display name in output

* Fix print

* Return timeout on start context

* Gen

* Fix fixture

* Fix the agent status

* Fix startup timeout msg

* Fix command using shared context

* Fix timeout draining

* Change signal type

* Add deterministic colors to startup script logs

---------

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-09-25 16:47:17 -05:00
Spike Curtis 866ba8ede5
fix: call agent directly in cli tests (#9789)
* fix: call agent directly in cli tests

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

* log verbose in TestDERPHeaders

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-21 13:30:24 +04:00
Muhammad Atif Ali fa858531a8
feat: add nomad template (#9786) 2023-09-21 08:54:56 +00:00
Eric Paulsen fae8a470df
fix(cli): display pasted session token (#9710) 2023-09-20 12:41:59 -04:00
Marcin Tojek ceeb9987a5
test(cli): ensure first option selected with is expected (#9770) 2023-09-19 13:55:51 +02:00
Spike Curtis 375c70d141
feat: integrate Acquirer for provisioner jobs (#9717)
* chore: add Acquirer to provisionerdserver pkg

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

* code review improvements & fixes

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

* feat: integrate Acquirer for provisioner jobs

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

* Fix imports, whitespace

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

* provisionerdserver always closes; remove poll interval from playwright

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

* post jobs outside transactions

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

* graceful shutdown in test

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

* Mark AcquireJob deprecated

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

* Graceful shutdown on all provisionerd tests

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

* Deprecate, not remove CLI flags

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-19 10:25:57 +04:00
Cian Johnston 45eadfc136
fix(cli): specify IgnoreErrors in slogtest options for scaletest cli tests (#9751)
* fix(cli): specify IgnoreErrors in slogtest options for scaletest cli tests
* bump test timeout
2023-09-18 16:39:28 +01:00
Ben Potter 5de5d20808
fix: remove broken fly.io template from starter templates (#9711)
Co-authored-by: Atif Ali <atif@coder.com>
2023-09-17 20:13:36 +03:00
Mathias Fredriksson bc97eaa41b
feat(scaletest): add scaletest-runner template (#9662)
Closes #9571
2023-09-15 13:23:37 +00:00
Cian Johnston 65db7a71b7
feat(coderd/database/dbtestutil): set default database timezone to non-UTC in unit tests (#9672)
- Adds dbtestutil.WithTimezone(tz) to allow setting the timezone for a test database.
- Modifies our test database setup code to pick a consistently weird timezone for the database.
- Adds the facility randtz.Name() to pick a random timezone which is consistent across subtests (via sync.Once).
- Adds a linter rule to warn against setting the test database timezone to UTC.
2023-09-15 09:01:32 +01:00
Ammar Bandukwala b63dfe7b75
perf(cli): optimize CPU consumption of help pages (#9607)
This change reduces the CPU consumption of --help by ~50%.

Also, this change removes ANSI escape codes from our golden files. I
don't think those were worth the inability to parallelize golden file tests and
global state fragility.
2023-09-14 19:48:29 -05:00
Jon Ayers 7311ffbd9d
feat: implement agent process management (#9461)
- An opt-in feature has been added to the agent to allow
   deprioritizing non coder-related processes for CPU by setting their
   niceness level to 10.
- Opting in to the feature requires setting CODER_PROC_PRIO_MGMT to a non-empty value.
2023-09-14 19:45:05 -05:00
Colin Adler 38560dd922
chore: remove coder trace telemetry (#9677) 2023-09-14 02:20:28 -04:00
Ammar Bandukwala f703a5b34e
chore(cli): lighten flags on help page (#9606) 2023-09-08 13:43:56 -05:00
Ammar Bandukwala e361f1107b
feat(cli): colorize help page (#9589) 2023-09-08 18:21:33 +00:00
Marcin Tojek ad23075e1b
refactor: build application URL (#9601)
* refactor: build application URL

* fix
2023-09-08 14:01:57 +00:00
Spike Curtis 11b6068112
feat: add support for networked provisioners (#9593)
* Refactor provisionerd to use interface to connect to provisioners

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

* feat: add support for networked provisioners

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

* fix token length and linting

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-08 09:53:48 +00:00
Ammar Bandukwala dd97fe2bce
chore(cli): replace lipgloss with coder/pretty (#9564)
This change will improve over CLI performance and "snappiness" as well as
substantially reduce our test times. Preliminary benchmarks show
`coder server --help` times cut from 300ms to 120ms on my dogfood
instance.

The inefficiency of lipgloss disproportionately impacts our system, as all help
text for every command is generated whenever any command is invoked.

The `pretty` API could clean up a lot of the code (e.g., by replacing
complex string concatenations with Printf), but this commit is too
expansive as is so that work will be done in a follow up.
2023-09-07 16:28:22 -05:00
Cian Johnston 7d7c84bb4d
feat(coderd): connect dbcrypt package implementation (#9523)
See also: https://github.com/coder/coder/pull/9522

- Adds commands `server dbcrypt {rotate,decrypt,delete}` to re-encrypt, decrypt, or delete encrypted data, respectively.
- Plumbs through dbcrypt in enterprise/coderd (including unit tests).
- Adds documentation in admin/encryption.md.

This enables dbcrypt by default, but the feature is soft-enforced on supplying external token encryption keys. Without specifying any keys, encryption/decryption is a no-op.
2023-09-07 15:49:49 +01:00
Spike Curtis 3bd0fd396c
feat: add boringcrypto builds for linux (#9543)
This reverts commit da0ef92f77.
2023-09-06 12:48:27 +04:00
Steven Masley 630d125286
chore: fix typo in OpenID on cli help (#9535) 2023-09-05 18:37:21 +00:00
Kyle Carberry da0ef92f77
Revert "feat: add boringcrypto builds for linux (#9528)" (#9529)
This reverts commit 79cd6047dc.
2023-09-05 08:37:07 -05:00
Spike Curtis 79cd6047dc
feat: add boringcrypto builds for linux (#9528)
* feat: add boringcrypto builds for linux

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

* strip debug symbols, add BoringCryto to buildinfo

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

* Fix TestVersion

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-05 13:12:38 +00:00
Mathias Fredriksson adba421524
refactor(coderd/telemetry): move CLI telemetry to cli/telemetry (#9517)
This change removes an indirect import of `coderd/database` from the
slim binary.

No size change (yet).

Ref: #9380
2023-09-04 21:42:45 +03:00
Mathias Fredriksson b240799f47
refactor(cli): use codersdk for provisioner types (#9508)
This change removes one use of `coderd/database` from the slim binary
and more correctly uses codersdk instead of database or provisionerd
packages.

No size change (yet).

Ref: #9380
2023-09-04 21:42:15 +03:00
Mathias Fredriksson 39e3b049a5
refactor(coderd/healthcheck): move derp report to derphealth package (#9506)
This change helps remove one indirect use of coderd/database in the slim
CLI.

No size change (yet).

Ref: #9380
2023-09-04 21:41:50 +03:00
Mathias Fredriksson d2115941b7
refactor(cli)!: remove reset-password from slim binary (#9520)
This is an alternative approach to #9519 and removes 2 MB instead of 1
MB (1.2 MB accounted for by embedded migration SQL files).

Combined with #9481, #9506, #9508, #9517, a total of 5 MB is removed.

Ref: #9380
2023-09-04 19:38:53 +03:00
Mathias Fredriksson ad23d33f28
refactor(coderd/schedule): move cron schedule to cron package (#9507)
This removes an indirect import of `coderd/database` from the CLI and
results in a logical separation between server related and generalized
schedule.

No size change (yet).

Ref: #9380
2023-09-04 16:48:25 +03:00
Muhammad Atif Ali 29b2eaa217
fix(cli/dotfiles): add an exception for `.gitconfig` (#9515)
* fix(cli/dotfiles): Only ignore .git directory 

Resolves #8306

* fix fmt

* add exception for .gitconfig

* Update dotfiles.go
2023-09-04 13:17:07 +00: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
Mathias Fredriksson 702b064cac
refactor: split coderd/gitauth into two, add cli/gitauth (#9479)
* refactor: split coderd/gitauth into two, add cli/gitauth

Ref: #9380
2023-09-01 15:41:22 +00:00
Mathias Fredriksson f1f9cb030d
refactor(cli): avoid importing coderd in slim server (#9483)
This small change removes 11 MB from the slim binary size.

Ref: #9380
2023-09-01 13:32:21 +00:00
Marcin Tojek 11d4b6f758
chore: move dormancy to enterprise package (#9468) 2023-08-31 17:59:53 +02:00
Cian Johnston fd17857095
fix(cli): template pull tests: await template version job before exiting (#9430) 2023-08-31 11:40:24 +01:00
Ammar Bandukwala 8f3b4075c7
ci: enable nestif linter (#9363) 2023-08-30 21:50:43 +00:00
Dean Sheather 1de61246a3
feat: add experimental template autostop requirement template settings UI (#9417) 2023-08-30 20:41:27 +00:00
Steven Masley a910e934a4
chore: improve error message around gitaskpass failures (#9407) 2023-08-30 08:58:31 -05:00
Ammar Bandukwala 16ef97a061
feat(cli): add DataDog Go tracer (#9411) 2023-08-29 22:14:28 +00:00
Dean Sheather a572800d47
chore: rename template restart requirement to autostop requirement (#9295) 2023-08-29 18:35:05 +00:00
Steven Masley fea8813f13
chore: drop 'template plan' unused command (#9386) 2023-08-28 13:33:40 -05:00
Ammar Bandukwala 6ba92ef924
ci: enable gocognit (#9359)
And, bring the server under 300:

* Removed the undocumented "disable" STUN address in favor of the
--disable-direct flag.
2023-08-27 14:46:44 -05:00
Ammar Bandukwala 4a140536e1
ci: lint against `dupl` (#9357)
This lint rule should help us keep Go code redundancy under control.
2023-08-27 11:42:51 -05:00
Kyle Carberry c3ac55ff42
feat: add `template_active_version_id` to workspaces (#9226)
* feat: add `template_active_version_id` to workspaces

This reduces a fetch in the VS Code extension when getting the
active version update message!

* Fix entities.ts

* Fix golden gen
2023-08-27 16:26:20 +00:00
Eric Paulsen 91f900ec64
docs: expand on TTL flags (#9286)
* docs: expand on TTL flags

* make: gen

* Discard changes to site/src/api/api.ts

* Discard changes to site/src/xServices/templateVersion/templateVersionXService.ts

---------

Co-authored-by: Muhammad Atif Ali <matifali@live.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-08-25 13:39:12 -04:00
Ammar Bandukwala f149db6ca6
fix(cli): add --max-ttl to template create (#9319)
It was just in template edit by mistake.
2023-08-25 11:00:38 -05:00
Spike Curtis aed891b4ff
fix: fix coder template pull on Windows (#9327)
* fix: fix coder template pull on Windows

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

* appease linter

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

* improvements from code review

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-25 10:58:13 +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
Jon Ayers 7f14b50dbe
chore: rename locked to dormant (#9290)
* chore: rename locked to dormant

- The following columns have been updated:
  - workspace.locked_at -> dormant_at
  - template.inactivity_ttl -> time_til_dormant
  - template.locked_ttl -> time_til_dormant_autodelete

This change has also been reflected in the SDK.

A route has also been updated from /workspaces/<id>/lock to /workspaces/<id>/dormant
2023-08-24 13:25:54 -05:00
Dean Sheather 64df076328
feat: add server flag to force DERP to use always websockets (#9238) 2023-08-24 17:22:31 +00:00
Marcin Tojek e845deaa89
fix: prompt when parameter options are incompatible (#9247) 2023-08-23 18:18:38 +02:00
Dean Sheather 53de47d4c8
chore: fix flake in TestDERPHeaders (#9262) 2023-08-23 21:03:39 +10:00
Marcin Tojek a3d31268a3
fix(cli): do not ask for immutables on update (#9266) 2023-08-23 12:46:52 +02:00
Ammar Bandukwala 69ec8d774b
fix(cli/server): apply log filter to log message as well as name (#9232) 2023-08-21 17:53:26 -05:00
Ammar Bandukwala 6d939b726c
fix: correctly assess quota for stopped resources (#9201) 2023-08-21 09:01:16 -05:00
Ammar Bandukwala 6b8102cf4c
feat(cli): add daily_cost to `coder ls` (#9200) 2023-08-19 12:56:08 -05: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
Cian Johnston 95458ac8a5
chore(scripts/develop.sh): restore original access url setting (#9174) 2023-08-18 13:24:17 +00:00
Marcin Tojek 669ae9d4d3
fix(cli): remove prompt for immutable parameters on start and restart (#9173) 2023-08-18 14:06:46 +02:00
Ammar Bandukwala be40dc85ab
chore: cleanup extraneous logging (#9156)
* The batchstats warning went out on every Ctrl+C in my development

Rule of silence:

The provisioner and connect messages messages were sent out on every startup
without a corresponding user event, making them annoying and more-so
debug messages.
2023-08-17 21:01:55 +00:00
Steven Masley 25ce30df36
feat: add azure oidc PKI auth instead of client secret (#9054)
* feat: add azure oidc PKI auth instead of client secret
* add client cert and key as deployment options
* Custom token refresher to handle pki auth
2023-08-14 17:33:13 -05:00
Asher 37f9d4b783
feat: add --header-command flag (#9059)
This allows specifying a command to run that can output headers for
cases where users require dynamic headers (like to authenticate to their
VPN).

The primary use case is to add this flag in SSH configs created by the
VS Code plugin, although maybe config-ssh should do the same.
2023-08-14 12:12:17 -08:00
Kyle Carberry 0d01d022f7
fix: remove unnecessary newlines from the end of cli output (#9068)
`Infof` already adds a newline, so we don't need to as well!
2023-08-13 11:48:11 -05:00
Steven Masley 40f3fc3a1c
feat: allow creating manual oidc/github based users (#9000)
* feat: allow creating manual oidc/github based users
* Add unit test for oidc and no login type create
2023-08-10 20:04:35 -05:00
Dean Sheather d2f22b063a
fix: move STUN servers into their own regions (#9030) 2023-08-11 05:04:17 +10:00
Marcin Tojek 9d9814c6b0
refactor(cli): adjust parameter resolver (#9019) 2023-08-10 12:08:00 +02:00
Colin Adler 370bdd6a03
fix(cli): only init `clistat.Client` when calling `coder stat` (#9013) 2023-08-09 19:17:57 -05:00
Colin Adler bc862fa493
chore: upgrade tailscale to v1.46.1 (#8913) 2023-08-09 19:50:26 +00:00
Colin Adler 612f1c6a55
chore: use echo provisioners in logging tests (#9008) 2023-08-09 19:03:02 +00:00
Marcin Tojek 0d382d1e05
feat(cli): provide parameter values via command line (#8898) 2023-08-09 13:00:25 +02:00
Dean Sheather 07fd73c4a0
chore: allow multiple agent subsystems, add exectrace (#8933) 2023-08-08 22:10:28 -07:00
Steven Masley f4122fa9f5
feat: add auto group create from OIDC (#8884)
* add flag for auto create groups
* fixup! add flag for auto create groups
* sync missing groups
Also added a regex filter to filter out groups that are not
important
2023-08-08 11:37:49 -05:00
Dean Sheather b2a84462ab
chore: fix ruleguard xerrors rules (#8967) 2023-08-08 12:32:41 +00:00
Colin Adler 694729b4f7
chore: disable goleak in windows cli tests (#8955) 2023-08-07 22:23:00 -05:00
Cian Johnston 82e0e2e43c
fix(cli): clistat: accept positional arg for stat disk cmd (#8911) 2023-08-07 16:26:16 +01:00
Ammar Bandukwala 81752d1b84
fix(cli/delete): prompt for confirmation after workspace is found (#8579) 2023-08-05 11:25:37 -05:00
Cian Johnston 9fb18f3ae5
feat(coderd): batch agent stats inserts (#8875)
This PR adds support for batching inserts to the workspace_agents_stats table.
Up to 1024 stats are batched, and flushed every second in a batch.
2023-08-04 17:00:42 +01:00
Cian Johnston ae88b79fd7
fix(cli): stat: set --host arg in TestStatCPUCmd to avoid test flakes in containers (#8806) 2023-08-04 15:15:33 +00:00
Cian Johnston 607cd11724
fix(cli): address race condition in scaletest_test output (#8902) 2023-08-04 15:06:28 +00:00
Spike Curtis cb4989cd8d
feat: add PSK for external provisionerd auth (#8877)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-04 12:32:28 +04:00
Dean Sheather 6ea32e4e80
fix: show current DERP name correctly in vscode (#8856) 2023-08-03 01:30:43 +10:00
Marcin Tojek d6e9870209
feat: add "dormant" user state (#8644) 2023-08-02 16:31:25 +02:00
Kyle Carberry bd944e0d21
chore: rename startup logs to agent logs (#8649)
* chore: rename startup logs to agent logs

This also adds a `source` property to every agent log. It
should allow us to group logs and display them nicer in
the UI as they stream in.

* Fix migration order

* Fix naming

* Rename the frontend

* Fix tests

* Fix down migration

* Match enums for workspace agent logs

* Fix inserting log source

* Fix migration order

* Fix logs tests

* Fix psql insert
2023-07-28 15:57:23 +00:00
Ammar Bandukwala edd9628aa6
fix(cli): correctly print deprecated warnings (#8771)
In the previous implementation, it was possible for default-set values
to trigger the deprecation warning.
2023-07-27 16:42:18 +00:00
Cian Johnston 32829080ac
feat(cli): add dashboard load test command (#8723) 2023-07-27 09:40:13 +01:00
Jon Ayers c3aface285
fix: fix coder stat mem (#8762)
- For cgroups v1 the wrong cgroup file was being read
  to determine max memory. This commit updates the file
  from '/sys/fs/cgroup/memory/memory.max_usage_in_bytes' to
  '/sys/fs/cgroup/memory/memory.limit_in_bytes'
2023-07-27 09:33:43 +01:00
Colin Adler 5cfa7082d1
chore: attempt to fix windows goleak failures (#8753) 2023-07-26 18:50:13 -05:00
Ammar Bandukwala 02550a9062
fix(cli): apply log-filter to debug logs only (#8751) 2023-07-26 22:31:41 +00:00
Ammar Bandukwala 25e30c6f41
feat(cli): support fine-grained server log filtering (#8748) 2023-07-26 16:46:22 -05:00
Dean Sheather 2f0a9996e7
chore: add derpserver to wsproxy, add proxies to derpmap (#7311) 2023-07-27 02:21:04 +10:00
Ammar Bandukwala 2a01747804
feat(cli): add --var shorthand for --variable (#8710)
`--variable` is used frequently enough to deserve a shorthand. Unfortunately,
`-v` is taken by verbose, and `-V` is too easily confused with version or
verbose, so we're left with "--var".
2023-07-25 14:36:02 +00:00
Bruno Quaresma 30e16052d6
fix(coderd): update icon url to the right one (#8718) 2023-07-25 14:06:58 +00:00
Ammar Bandukwala f6f61dfa26
docs: fix duplicate sentence (#8712)
Resolves #8664
2023-07-25 02:22:41 +00:00
Steven Masley f827829afe
feat: synchronize oidc user roles (#8595)
* feat: oidc user role sync
User roles come from oidc claims. Prevent manual user role changes
if set.
* allow mapping 1:many
2023-07-24 08:34:24 -04:00
Jyotirmoy Bandyopadhayaya 65583eca47
feat(cli): check if dotfiles install script is executable (#8588)
* feat(cli): check if dotfiles install script is executable

* feat(docs): add section for dotfiles setup and document executable fix

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: Muhammad Atif Ali <matifali@live.com>
2023-07-21 18:39:50 +00:00
Cian Johnston fd372f6735
fix(cli/clistat): improve detection of container environment (#8643)
Use the presence of /var/run/secrets/kubernetes.io/serviceaccount/token to determine if we are in a container in addition to sniffing /proc/1/cgroup
2023-07-21 10:18:56 +00:00
Colin Adler 2901147ae3
test: fix race in `templateedit_test.go` (#8641) 2023-07-21 03:26:55 +00:00
Dean Sheather dc8b73168e
feat: add user quiet hours schedule and restart requirement feature flag (#8115) 2023-07-20 23:35:41 +10:00
Marcin Tojek 9689bca5d2
feat(cli): implement ssh remote forward (#8515) 2023-07-20 12:05:39 +02:00
Cian Johnston 0965a2de70
fix(cli/clistat): read from alternate cgroup path (#8591)
* Attempts reading cgroupv1 quota, period, usage from /sys/fs/cgroup/cpu,cpuacct by default
* Fall back to /sys/fs/cgroup/cpu for v1 quota and period
* Fall back to /sys/fs/cgroup/cpuacct for v1 usage

Fixes https://github.com/coder/coder/issues/8468
2023-07-19 16:25:26 +01:00
Marcin Tojek 4232a2eb96
feat: add custom docs URL to deployment config (#8590) 2023-07-19 08:31:17 -03:00
Kyle Carberry 98164f687e
fix!: remove startup logs eof for streaming (#8528)
* fix: remove startup logs eof for streaming

We have external utilities like logstream-kube that may send
logs after an agent shuts down unexpectedly to report additional
information. In a recent change we stopped accepting these logs,
which broke these utilities.

In the future we'll rename startup logs to agent logs or something
more generalized so this is less confusing in the future.

* fix(cli/cliui): handle never ending startup log stream in Agent

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-07-18 09:57:29 -06:00
Cian Johnston 278527cff4
feat(scaletest): add option to send traffic over SSH (#8521)
- Refactors the metrics logic to avoid needing to pass in a whole prometheus registry
- Adds an --ssh option to the workspace-traffic command to send SSH traffic

Fixes #8242
2023-07-18 12:17:11 +01:00
Marcin Tojek ab54008c94
feat: make ephemeral parameters optional (#8571) 2023-07-18 11:56:41 +02:00
Mathias Fredriksson d467160581
feat(cli): show workspace health in show (#8548) 2023-07-18 11:28:47 +03:00
Cian Johnston 56889d6cd4
fix(cli): unskip TestStatCPUCmd/JSON and explicitly set --host in test cmd invocation (#8558)
- Un-skips TestStatCPUCmd/JSON
- Explicitly sets --host flag when running the cli tests for the stat command as when these are invoked inside a container without a CPU or memory limit set, these tests may fail.
2023-07-17 17:24:46 +01:00
Mathias Fredriksson dfac0745f3
feat(cli): show workspace health in list (#8541)
Ref #6461
2023-07-17 15:04:06 +03:00
Steven Masley 4c4d966c7b
feat: add ability to make workspace for other user from cli (#8481)
* feat: add ability to make workspace for other user from cli
* Add example to show functionality
2023-07-14 09:48:02 -04:00
Steven Masley c2acc35d45
feat: add custom coder bin path for ProxyCommand (#8425)
* feat: add custom coder bin path for ProxyCommand
* force cli path to be absolute (on non-windows)
2023-07-13 13:17:39 -04:00
Marcin Tojek 3727e02bbf
feat(cli): add `--create` flag to `templates push` (#8454) 2023-07-13 12:58:34 +02:00
Marcin Tojek 5432c3f5ea
feat(cli): support ephemeral parameters (#8415) 2023-07-13 12:56:02 +02:00
Colin Adler b5c17048c6
chore: upgrade `github.com/codeclysm/extract` to `v3.1.1` (#8480) 2023-07-12 14:33:46 -05:00
Colin Adler 1c3bfacca3
fix(cli): ensure `cliui.Agent` doesn't fetch infinitely (#8446) 2023-07-12 10:21:54 -05:00
Steven Masley e9d7a230fa
chore: server header specifies if wsproxy (#8432) 2023-07-12 12:07:36 +00:00
Steven Masley bc102d6bd7
feat: add cli first class validation (#8374)
* feat: add cli first class validation
* feat: add required flag to cli options
* Add unit test to catch invalid and missing flag
2023-07-11 09:59:55 -04:00
Mathias Fredriksson 75f62dc39d
feat: add support for template version messages in api and cli (#8336) 2023-07-11 13:11:08 +03:00
Colin Adler 9df80530d7
chore(cli): unhide `netcheck` command (#8412) 2023-07-10 21:38:02 -05:00
Mathias Fredriksson b73f9d8e86
feat: add computed workspace and agent health fields to the api (#8280) 2023-07-10 12:40:11 +03:00
Cian Johnston c1ab5cf0ba
fix(cli/clistat): better handle cgroups with no limits (#8373) 2023-07-07 15:49:36 +01:00
Cian Johnston 435c67ab75
refactor(cli)!: move scaletest to exp/scaletest (#8339)
* refactor(cli): mv scaletest exp/scaletest

* make gen
2023-07-07 09:10:14 +01:00
Steven Masley 9f5bc7c10b
feat: add --branch option to clone or checkout different dotfiles branch (#8331)
* feat: --branch option to clone different dotfiles branch
* chore: checkout specified branch if dotfiles already exist
2023-07-06 20:24:04 +00:00
Cian Johnston 7fcf319e01
fix(cli)!: protect client Logger and refactor cli scaletest tests (#8317)
- (breaking) Protects Logger and LogBodies fields of codersdk.Client with its mutex. This addresses a data race in cli/scaletest.
- Fillets the existing cli/createworkspaces unit test and moves the testing logic there into the tests under scaletest/createworkspaces.
- Adds testutil.RaceEnabled bool const and conditionaly skips previously-skipped tests under scaletest/ if the race detector is enabled. This is unfortunate and sad, but I would prefer to have these tests at least running without the race detector than not running at all.
- Adds IgnoreErrors option to fake in-memory agent loggers; having the agents fail the test immediately when they encounter any sort of error isn't really helpful.
2023-07-06 09:43:39 +01:00
Steven Masley 4a008a8f34
chore: prevent nil dereferences on cmd handlers (#8319)
* chore: detect nil cmd handlers

Prevent nil panic dereferences on cmd handlers. Add a unit test
to prevent future mistakes
2023-07-05 17:20:12 +00:00
Steven Masley 9a7705c656
feat: generate a new session with coder login --token (#8275)
* feat: coder login --token generates a new session

Makes sure /logout does not delete the inputted token
* flag to enable previous behavior if needed
2023-07-05 08:59:38 -04:00
Steven Masley f0bd258ff1
feat: move proxy settings page to deployment options (#8246)
* feat: Move workspace proxy page to deployment options

Workspace proxy settings page is now an admin feature

* WorkspaceProxy response extends region
2023-06-30 11:32:35 -04:00
Steven Masley b5f26d9bdf
feat: add ability for users to convert their password login type to oauth/github login (#8105)
* Currently toggled by experiment flag

---------

Co-authored-by: Bruno Quaresma <bruno@coder.com>
2023-06-30 08:38:48 -04:00
Kyle Carberry 34467a3289
feat: add github device flow for authentication (#8232)
* feat: add github device flow for authentication

This will allow us to add a GitHub OAuth provider out-of-the-box
to reduce setup requirements.

* Improve askpass view

* Add routes to improve clarity of git auth

* Redesign the git auth page

* Refactor to add a page view

* Fix sideways layout

* Remove legacy notify

* Fix git auth redirects

* Add E2E tests

* Fix route documentation

* Fix imports

* Remove unused imports

* Fix E2E web test

* Fix friendly message appearance

* Fix layout shifting for full-screen sign-in

* Fix height going to 100%

* Fix comments
2023-06-29 18:58:01 +00:00
Marcin Tojek 83fee4b192
feat: enable Terraform debug mode via deployment configuration (#8260) 2023-06-29 15:22:21 +02:00
Jon Ayers 749307ef08
feat: provide endpoint to lock/unlock workspace (#8239) 2023-06-28 16:12:49 -05:00
Mathias Fredriksson d3c39b60c9
feat: add agent log streaming and follow provisioner format (#8170) 2023-06-28 10:54:13 +02:00
Mathias Fredriksson b4751c72d8
fix(cli/agent): wrap lumberjack logger to prevent re-open (#8229) 2023-06-27 12:49:44 +00:00
Cian Johnston 80ef147060
fix(cli): stat: explicitly specify resource SI prefix (#8206)
* fix(cli): move to explicitly specifying units

* make gen
2023-06-26 18:06:38 +01:00
Dean Sheather 98a5ae7f48
feat: add provisioner job hang detector (#7927) 2023-06-25 13:17:00 +00:00
Steven Masley 797e91d4c6
feat: add flag for Windows to create unix compatible filepaths (#8164)
* feat: add flag for Windows to create unix compatible filepaths
2023-06-22 17:08:12 -05:00
Jon Ayers 1b0124ecdb
feat: automatically stop workspaces based on failure_ttl (#7989) 2023-06-22 00:33:22 -04:00
Kyle Carberry d434181941
feat: add cohesive e2e tests for the web terminal, apps, and workspaces (#8140)
* feat: add cohesive e2e tests for the web terminal, apps, and workspaces

* Fix web terminal flake
2023-06-22 00:21:40 +00:00
Dean Sheather a28d422c35
feat: add flag to disable all direct connections (#7936) 2023-06-21 22:02:05 +00:00
Dean Sheather 24b95e16c4
feat: add --disable-direct flag to CLI (#8131) 2023-06-21 20:22:43 +00:00
Colin Adler bc739bdfce
feat(cli): add hidden netcheck command (#8136) 2023-06-21 14:33:19 -05:00
Kyle Carberry 69f911dfd5
feat: add queue_position and queue_size to provisioner jobs (#8074) 2023-06-20 15:07:18 -05:00
Kyle Carberry 467b0a1004
chore: restyle provisioner job output format (#8106)
Reduce colors and formatting to reduce bugs and increase UNIX-feel.
2023-06-20 16:16:27 +00:00
Colin Adler adf14f1917
chore(cli): warn on template push or create when no lockfile present (#8059) 2023-06-20 15:02:44 +00:00
Cian Johnston eb0783ff24
chore(cli): do not assert non-zero host cpu usage (#8097) 2023-06-20 13:03:56 +00:00
Cian Johnston 0f754f0bb9
fix(clistat): do not include buffers/cache for host memory used (#8095) 2023-06-20 13:29:27 +01:00
Marcin Tojek 06a5e24f5b
skip: TestStatCPUCmd/JSON (#8093) 2023-06-20 12:08:11 +00:00
Marcin Tojek b1d1b63113
chore: ensure logs consistency across Coder (#8083) 2023-06-20 12:30:45 +02:00
Cian Johnston d6f8bd7847
feat(cli): add `coder stat` command (#8005) 2023-06-20 11:16:57 +02:00
Marcin Tojek 247f8a973f
feat: replace ssh maxTimeout with keep-alive mechanism (#8062)
* Bump up coder/ssh

* feat: Set default agent timeout to ~72h

* Address PR comments

* Fix
2023-06-16 15:22:18 +02:00
Cian Johnston 6e598234b6
fix: only collect prometheus database metrics when explicitly enabled (#8045)
* fix: only collect prometheus database metrics when explicitly enabled

* add missing test

* de-duplicate wrapping
2023-06-15 12:34:16 +01:00
Steven Masley 6c4c3d6ce5
feat: add login type 'none' to prevent password login (#8009)
* feat: add login type 'none' to prevent login

Users with this login type must use tokens to authenticate.
Tokens must come from some other source, not a /login with password
authentication
2023-06-14 12:48:43 -05:00
Steven Masley 3619a3a6dd
feat: add disabling of default 'everyone' group access to template (#7982)
* feat: add disabling of default 'everyone' group access to template
* add FE to disable everyone group
* require entitlement to uncheck box
2023-06-14 11:08:58 -05:00
Kyle Carberry e4b6f5695b
chore: separate pubsub into a new package (#8017)
* chore: rename store to dbmock for consistency

* chore: remove redundant dbtype package

This wasn't necessary and forked how we do DB types.

* chore: separate pubsub into a new package

This didn't need to be in database and was bloating it.
2023-06-14 15:34:54 +00:00
Dean Sheather 2c843f4011
fix: fix --header flag in CLI (#8023) 2023-06-14 21:52:01 +10:00
Cian Johnston df842b31e8
chore: fix miscellaneous issues in scaletest scripts (#8006)
* chore: scaletest: plumb through more options

* bump terraform version

* scaletest.sh: pprof during traffic gen

* cli/scaletest: actually wait for prometheus metrics to be scraped

* increase prometheus wait
2023-06-14 09:38:04 +01:00
Steven Masley 9cf3c582cb
test: add unit test that deletes abandoned workspace (#7990)
* test: add unit test that deletes abandoned workspace

This is to ensure we do not break this functionality in future.
This is important incase this edge case happens, an admin can
clean up the abandoned resources.
2023-06-13 10:42:18 -05:00
Steven Masley b70d2b1767
fix: correct the correct cli output for 'template version list --output=json' (#7984)
* fix: correct 'template version list --output=json' cli cmd
2023-06-12 14:35:51 -05:00
Mathias Fredriksson 4bc4e63637
fix(cli/ssh): fix lint error (#7974) 2023-06-12 16:17:41 +00:00
Ammar Bandukwala 5de1084639
feat(cli/ssh): simplify log file flags (#7863)
And, fix a race condition.
2023-06-12 09:18:33 +04:00
Steven Masley 065206345e
test: add golden files to enterprise cli (#7924)
* test: Add golden files to enterprise cli
2023-06-09 11:35:20 -05:00
Steven Masley a4cc883be1
chore: add proxy health interval flag/env config (#7919)
* chore: plumbing for proxy health interval from flag/env
2023-06-08 12:58:24 -05:00
Mathias Fredriksson 03034dc508
chore(cli/configssh): add comment about wait and skip proxy (#7917) 2023-06-08 14:23:03 +00:00
Mathias Fredriksson fa91e11105
fix(cli/help): show deprecation notice properly for flags (#7904) 2023-06-08 14:14:42 +00:00
Mathias Fredriksson a1c32954d9
feat(cli/configssh): add support for wait yes/no/auto (#7893)
Refs #7768
2023-06-08 14:06:50 +00:00
Mathias Fredriksson 94aa9be33a
feat(cli/ssh): implement wait options and deprecate no-wait (#7894)
Fixes #7768
Refs #7893
2023-06-08 16:52:44 +03:00
Steven Masley b2324325fa
chore: add warning log if misconfigured groups oidc (#7874)
* chore: add warning log if misconfigured groups oidc

This is not perfect, but if we find a 'groups' claim and it is not
configured, put out a warning log to give some information
2023-06-08 08:51:59 -05:00
Cian Johnston 4f29f9abe3
fixup! fix(cli): speed up CLI over SSH (#7885) (#7888) 2023-06-07 09:13:22 +00:00
Ammar Bandukwala 5eaf809851
fix(cli): speed up CLI over SSH (#7885)
By caching the terminal's color profile, we avoid myriad round trips during command execution.
2023-06-07 05:22:58 +00:00
goodspark 0665a6c2f2
feat: add metric for provisioner daemons (#7858) 2023-06-06 16:50:11 -05:00
Mathias Fredriksson 660bbb8d38
refactor: deprecate `login_before_ready` in favor of `startup_script_behavior` (#7837)
Fixes #7758
2023-06-06 11:58:07 +03:00
goodspark e2613c91a7
feat(cli): support non-active template version pushes (#7488)
So that we can push template updates for testing without impacting
normal users of the template.

---------

Co-authored-by: Ammar Bandukwala <ammar@ammar.io>
Co-authored-by: Muhammad Atif Ali <matifali@live.com>
Co-authored-by: Atif Ali <atif@coder.com>
2023-06-03 22:39:00 +00:00
Colin Adler c6cd042e80
fix(clitest): use slogtest for logging stdin and stdout (#7828) 2023-06-02 22:38:31 +00:00
Colin Adler edccd2de73
fix(agent): configure logger for both reaper and agent (#7823) 2023-06-02 15:51:10 -05:00
Colin Adler 6fdebd8a07
hotfix(agent): only retain 1 logfile at a time (#7815) 2023-06-02 12:28:38 -05:00
Marcin Tojek a7366a8b76
feat!: drop support for legacy parameters (#7663) 2023-06-02 11:16:46 +02:00
Asher 9704945428
fix: standardize on CODER_PG_CONNECTION_URL (#7781)
Fixes #7513.
2023-06-01 15:02:29 -08:00
Cian Johnston 784696dfa5
feat: add prometheus metrics to database.Store (#7713)
* Adds dbmetrics package and wraps database.Store with a Prometheus HistogramVec of timings.
* Adds Wrappers method to database.Store to avoid double-wrapping interfaces
* Fixes test flake in TestLicensesListFake
2023-05-31 14:55:57 +01:00
Ammar Bandukwala 43eee35ae8
chore(cli): correctly report telemetry even when transport replaced (#7670)
By introducing the "ExtraHeaders" map, we can apply headers even when
handlers replace the transport, as in the case of our scaletests.

Also, only send telemetry header when it's small.
2023-05-31 00:11:56 +00:00
Marcin Tojek 702c9081e0
fix: do not skip parameter validation if min or max = 0 (#7707) 2023-05-30 14:57:06 +02:00
Mathias Fredriksson 66f5d39ff5
test(agent): Improve use of `inv.Context()` (#7696)
This will ensure tests timeout instead of hang indefinitely since
`inv.Context()` is assigned a timeout by default.
2023-05-26 13:48:39 +00:00
Mathias Fredriksson 05efd64320
test: Skip tests that send `os.Interrupt` to test pid (#7695)
This can cause test flakes due to clitest commands running in memory and
listening to interrupt signals.
2023-05-26 16:17:09 +03:00
Cian Johnston 795050bba3
chore: add prometheus monitoring of workspace traffic generation (#7583)
- Exposes reads/writes from scaletest traffic generation (default: 0.0.0.0:21112)
- Adds self-hosted prometheus with remote_write to loadtest terraform
- Adds convenience script to run a traffic generation test
2023-05-26 13:53:35 +01:00
Marcin Tojek 14efdadd3c
feat: Collect agent SSH metrics (#7584) 2023-05-25 12:52:36 +02:00
Spike Curtis 6a1e7ee1d0
feat: add file logger to coder ssh (#7646)
* coder ssh can log to file

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

* Update golden file

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

* generate CLI docs

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

* Fix imports, typo

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

* log more things!

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-05-25 05:07:39 +00:00
Colin Adler dd69cc9148
fix: use different terraform cache dir (#7672) 2023-05-24 22:35:00 +00:00
Colin Adler 5eb41e8794
feat(cli): allow specifying the listen address in `coder port-forward` (#7635) 2023-05-24 15:38:40 -04:00
Ammar Bandukwala ec117e841a
chore: add CLI invokation telemetry (#7589) 2023-05-24 11:08:03 -05:00
goodspark 71c52ea93c
feat: Add logging options for coder agent (#7474)
Similar to logging options in the coderd server, but for the agent
running in workspaces. Meant to make hollistic log collection and
querying simpler.
2023-05-24 14:32:40 +00:00
Mathias Fredriksson b6c8e5be48
fix(cli/ssh): Fetch up-to-date build info to avoid ws has no agents (#7650)
Fixes #5836
2023-05-24 12:37:22 +03:00
Colin Adler c8ea76c7fa
fix(cli): correctly use cache dir for provisionerd work dir (#7651) 2023-05-23 13:37:27 -04:00
Steven Masley d203f5259d
fix: Port forward should ignore coder ports (#7645)
Ports opened by coder agent should be ignored in the listening ports
map.
2023-05-23 17:14:05 +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
Jon Ayers 00a2413c03
feat: add telemetry support for workspace agent subsystem (#7579) 2023-05-17 22:49:25 -05:00
Kyle Carberry 6e7175b589
chore: fix lengthy tests in psql (#7545)
* chore: fix lengthy tests in psql

This was adding at a minimum 3mins to our psql tests!

* fix: automatically cancel tests on cleanup
2023-05-17 11:26:53 -05:00
Marcin Tojek 97b4743a47
Revert "fix: set default sshMaxTimeout to 60s (#7532)" (#7544)
This reverts commit 049e557675.
2023-05-16 15:28:15 +02:00
Spike Curtis 0b156420de
Make coder dotfiles symlinking idempotent (#7525)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-05-15 21:00:50 +04:00
Marcin Tojek 049e557675
fix: set default sshMaxTimeout to 60s (#7532)
* fix: set default sshMaxTimeout to 60s

* fix
2023-05-15 10:40:19 -05:00
Ammar Bandukwala f05f12231d
feat: update slog to use logfmt (#7477) 2023-05-14 20:23:13 +00:00
Ammar Bandukwala 640fcf450c
chore: improve terraform install performance (#7478) 2023-05-11 19:30:51 +00:00