Commit Graph

1121 Commits

Author SHA1 Message Date
Colin Adler 13dd526f11
fix: prevent stdlib logging from messing up ssh (#13161)
Fixes https://github.com/coder/coder/issues/13144
2024-05-03 22:12:06 +00:00
Michael Brewer 060f023174
feat: mask coder login token to enhance security (#12948)
* feat(login): treat coder token as a secret

* Update login.go
2024-05-03 17:03:13 -04:00
Steven Masley 94a3e3a563
chore: allow terraform & echo built-in provisioners (#13121)
* chore: allow terraform & echo built-in provisioners

Built-in provisioners serve all specified types. This allows running terraform, echo, or both in built in.
The cli flag to control the types is hidden by default, to be used primarily for testing purposes.
2024-05-03 10:14:26 -05:00
Spike Curtis 3de737fdc8
fix: start packet capture immediately on speedtest (#13128)
I initially made this change when hacking wgengine to also capture wireguard packets going into the magicsock, so that we could capture the initial wireguard handshake. 

I don't think we should ship that additional capture logic, but... it seems generally useful to capture packets from the get go on speedtest, so that you can see disco and pings before the TCP speedtest session starts.
2024-05-02 19:44:32 +04:00
Aaron Lehmann 0e3dc2a80f
feat: influence parameter defaults through cli flag/env (#13039)
* feat: influence parameter defaults through cli flag/env

Add a --parameter-default flag / CODER_RICH_PARAMETER_DEFAULT
environment variable which overrides default values suggested for
parameters.

This allows scripts or middleware wrapping the CLI to substitute
defaults for parameter values beyond those defined at the template
level. For example, Git repository/branch parameters can be given
defaults based on the current checkout, or default parameter values can
be parsed out of files inside the repo.

* Rename defaults arg to defaultOverrides
2024-04-29 14:23:54 -04:00
Cian Johnston 365231b1e5
fix(cli): scaletest: ignore errors syncing output (#13076) 2024-04-26 09:18:33 +01:00
Kayla Washburn-Love 74f27719b8
feat: specify a custom "terms of service" link (#13068) 2024-04-25 16:36:51 -06:00
Aaron Lehmann 8a1216254e
feat(cli): add `--env` flag for `coder ssh` (#12991)
This allows environment variables to be set on the SSH session.

Example:

   coder ssh myworkspace --env VAR1=val1,VAR2=val2
2024-04-22 13:13:48 +03:00
Mathias Fredriksson e17e8aa3c9
feat(coderd/database): keep only 1 day of `workspace_agent_stats` after rollup (#12674) 2024-04-22 13:11:50 +03:00
Dean Sheather d426569d4a
fix: make terminal raw in ssh command on windows (#12990) 2024-04-17 18:01:20 +00:00
Cian Johnston 8e1e0f04a4
feat(cli): support bundle: show links to docs/admin/healthcheck (#12974) 2024-04-16 16:21:09 +01:00
Cian Johnston 407e61ecd4
feat(cli): support bundle: dump healthcheck summary (#12963)
* refactor(codersdk): extract common fields from HealthReport and friends
* feat(codersdk/healthsdk): add Summarize() method
* feat(cli): support bundle: dump healthcheck summary
2024-04-16 13:31:56 +01:00
Cian Johnston 9a4703a311
feat(coderd/healthcheck): improve detection of STUN issues (#12951)
Adds checks to coderd/healthcheck/derphealth for STUN issues:
- Alerts if there is not least one healthy STUN server,
- Alerts if we see variable port mapping.
2024-04-15 17:10:49 +01:00
Kyle Carberry d3790bb5be
fix: use provided username when fetching workspaces (#12955) 2024-04-13 14:39:57 -04:00
Cian Johnston b163bc7f01
fix(support): correctly rename existing agent connection info, add real netcheck (#12946) 2024-04-12 09:40:04 +01:00
Cian Johnston fad97a14f9
fix(cli): allow generating partial support bundles with no workspace or agent (#12933)
* fix(cli): allow generating partial support bundles with no workspace or agent

* nolint control flag
2024-04-11 10:09:10 +01:00
Jon Ayers 426e9f2b96
feat: support adjusting child proc oom scores (#12655) 2024-04-03 09:42:03 -05:00
Kyle Carberry 7698cfda72
chore: remove unnecessary extraction library (#12847)
This was allocating ~256KB on init.
2024-04-02 11:19:54 -04:00
Steven Masley 5137433123
chore: add validation errors to the cli output (#12814)
* chore: add validation errors to the cli output
2024-04-02 10:02:30 -05:00
Danny Kopping 79fb8e43c5
feat: expose workspace statuses (with details) as a prometheus metric (#12762)
Implements #12462
2024-04-02 09:57:36 +02:00
Kyle Carberry d428c05694
chore: move log output message before logs begin streaming (#12836) 2024-04-01 20:02:50 +00:00
elasticspoon cfb94284e0
feat(cli): add golden tests for errors (#11588) (#12698)
* feat(cli): add golden tests for errors (#11588)

Creates golden files from `coder/cli/errors.go`.
Adds a unit test to test against golden files.
Adds a make file command to regenerate golden files.
Abstracts test against golden files.
2024-04-01 09:19:26 -05:00
Steven Masley b785e996f8
chore: explain GIT_ASKPASS behavior in docs (#12784)
* chore: docs explaining GIT_ASKPASS behavior

- VSCode configuration requirements
2024-03-28 13:59:03 -05:00
Steven Masley 93a233ac10
chore: write auto-update message after success (#12804) 2024-03-28 08:55:15 -05:00
Danny Kopping a74ef4096e
feat: allow number options with monotonic validation (#12726)
NOTE: terraform-provider-coder was updated to facilitate this change, and your template will require v0.19.0 for this feature to work. You can run terraform init -upgrade in your template directory. If you have a version constraint set, ensure it points to this version.
2024-03-27 08:54:42 +00:00
Colin Adler 4d5a7b2d56
chore(codersdk): move all tailscale imports out of `codersdk` (#12735)
Currently, importing `codersdk` just to interact with the API requires
importing tailscale, which causes builds to fail unless manually using
our fork.
2024-03-26 12:44:31 -05:00
Mathias Fredriksson f418ece9ae
test(cli): prevent flake due to outdated build in TestSSH (#12760)
Fixes #12752
2024-03-26 10:46:58 +00:00
Kyle Carberry 03ab37b343
chore: remove middleware to request version and entitlement warnings (#12750)
This cleans up `root.go` a bit, adds tests for middleware HTTP transport
functions, and removes two HTTP requests we always always performed previously
when executing *any* client command.

It should improve CLI performance (especially for users with higher latency).
2024-03-25 15:01:42 -04:00
Cian Johnston ba3879ac47
fix(cli): fix newline escape sequence in support blurb (#12749) 2024-03-25 16:51:48 +00:00
Cian Johnston 01f9a9ab77
feat(cli): unhide support bundle cmd (#12745)
* chore(cli): add another test to ensure no secret leakage

* feat(cli): unhide support bundle cmd
2024-03-25 15:14:27 +00:00
Colin Adler 37a05372fa
fix: disable relay if built-in DERP is disabled (#12654)
Fixes https://github.com/coder/coder/issues/12493
2024-03-21 16:53:41 -05:00
Cian Johnston 28730ca3d8
fix(support): sanitize manifest (#12711) 2024-03-21 19:55:34 +00:00
Cian Johnston f2a9e515df
feat(cli/support): confirm before creating bundle (#12684)
Forces user to confirm before creating a support bundle.
Also adds contextual information to the bundle under cli_logs.txt.
2024-03-21 17:06:28 +00:00
Cian Johnston 5454f4997b
chore(ci): clean up databases after test finishes in CI (#12702) 2024-03-21 14:53:16 +00:00
Garrett Delfosse 4d9fe05f5a
feat: add awsiamrds db auth driver (#12566) 2024-03-20 13:14:43 -04:00
Ammar Bandukwala 0d86dca852
fix(codersdk): abort in-progress writes/reads when closing websocket (#12650)
Fixes #9203

Related #12065

Also, adds some basic tracing infrastructure that we can build upon for more improvements.
2024-03-20 11:53:32 -05:00
Cian Johnston 92aa1eba97
fix(cli): port-forward: update workspace last_used_at (#12659)
This PR updates the coder port-forward command to periodically inform coderd that the workspace is being used:

- Adds workspaceusage.Tracker which periodically batch-updates workspace LastUsedAt
- Adds coderd endpoint to signal workspace usage
- Updates coder port-forward to periodically hit this endpoint
- Modifies BatchUpdateWorkspacesLastUsedAt to avoid overwriting with stale data

Co-authored-by: Danny Kopping <danny@coder.com>
2024-03-20 16:44:12 +00:00
Steven Masley d789a60d47
chore: remove max_ttl from templates (#12644)
* chore: remove max_ttl from templates

Completely removing max_ttl as a feature on template scheduling. Must use other template scheduling features to achieve autostop.
2024-03-20 10:37:57 -05:00
Danny Kopping 9cfd5baa91
feat(coderd): export metric indicating each experiment's status (#12657) 2024-03-19 14:11:27 +02:00
Danny Kopping ab95ae827d
feat(coderd): add enabled experiments to telemetry (#12656) 2024-03-19 11:05:29 +02:00
Ammar Bandukwala e5cc17af92
chore(cli): hide --organization (#12626)
It's potentially confusing to users since we aren't fleshing out organizations right now.
2024-03-18 09:09:26 -05:00
Danny Kopping 93933d7905
feat(cli): show queue position during workspace builds (#12606) 2024-03-18 12:05:05 +02:00
Danny Kopping 53b58ed74b
fix: correct troubleshooting links (#12608) 2024-03-18 08:52:20 +02:00
elasticspoon 5011edc292
fix(cli): show error/hide help for unsupported subcommands (#10760) (#12624)
Fixes #10760 

The coder CLI quietly accepts any subcommand arguments and silently swallows them.

Currently:
```sh
❯ coder | head -n5
coder v2.3.3+e491217

USAGE:
  coder [global-flags] <subcommand>
```

```sh
❯ coder idontexist | head -n5
coder v2.3.3+e491217

USAGE:
  coder [global-flags] <subcommand>
```

Now help output will not be show when there is an unknown subcommand error. Instead users will be given the command for the help output.

```sh
❯ coder idontexist
Encountered an error running "coder", see "coder --help" for more information 
error: unrecognized subcommand "idontexist"
```
```sh
❯ coder iexistbut idontexist
Encountered an error running "coder iexistbut", see "coder iexistbut --help" for more information 
error: unrecognized subcommand "idontexist"
```

Also this stuff: `Encountered an error running "coder iexistbut"... ` gets written to `os.Stdout` in `prettyErrorFormatter{w: os.Stderr, verbose: r.verbose}`, not sure how to test that output.
2024-03-17 22:17:43 -05:00
Ammar Bandukwala b4c0fa80d8
chore(cli): rename Cmd to Command (#12616)
I think Command is cleaner and my original decision to use "Cmd"
a mistake.

Plus this creates better parity with cobra.
2024-03-17 09:45:26 -05:00
Ammar Bandukwala 496232446d
chore(cli): replace clibase with external `coder/serpent` (#12252) 2024-03-15 11:24:38 -05:00
Cian Johnston b0c4e7504c
feat(support): add client magicsock and agent prometheus metrics to support bundle (#12604)
* feat(codersdk): add ability to fetch prometheus metrics directly from agent
* feat(support): add client magicsock and agent prometheus metrics to support bundle
* refactor(support): simplify AgentInfo control flow

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-03-15 15:33:49 +00:00
Kyle Carberry 895df54051
fix: separate signals for passive, active, and forced shutdown (#12358)
* fix: separate signals for passive, active, and forced shutdown

`SIGTERM`: Passive shutdown stopping provisioner daemons from accepting new
jobs but waiting for existing jobs to successfully complete.

`SIGINT` (old existing behavior): Notify provisioner daemons to cancel in-flight jobs, wait 5s for jobs to be exited, then force quit.

`SIGKILL`: Untouched from before, will force-quit.

* Revert dramatic signal changes

* Rename

* Fix shutdown behavior for provisioner daemons

* Add test for graceful shutdown
2024-03-15 13:16:36 +00:00
Cian Johnston 2abc1cd2b7
feat(support): fetch agent network info over tailnet (#12577)
Adds agent-related information to support bundle command.
2024-03-15 11:01:39 +00:00
Steven Masley 29c8cf20e0
fix: handle CLI default organization when none exists in <v2.9.0 coderd (#12594)
* chore: 'coder org set' help message was incorrect
* fix: handler coder cli against older versions of Coder
2024-03-14 15:11:29 -05:00