Compare commits

...

2367 Commits

Author SHA1 Message Date
Colin Adler c4a01a42ce chore(docs): add v2.8.2 changelog 2024-02-12 05:33:05 +00:00
Dean Sheather c0aeb2fc2e fix: copy app ID in healthcheck (#12087)
(cherry picked from commit 429144da22)
2024-02-12 05:30:34 +00:00
Bruno Quaresma 908d236a19 fix(site): enable submit when auto start and stop are both disabled (#12055) 2024-02-07 18:28:33 +00:00
Spike Curtis f519db88fb fix: allow startup scripts larger than 32k (#12060)
Fixes #12057 and adds a regression test.
2024-02-07 18:28:14 +00:00
Ben e996e8b7e8 fix typo 2024-02-07 00:10:37 +00:00
Ben da60671b33 formatting + add TF version 2024-02-07 00:08:19 +00:00
Ben 963a1404c0 fmt 2024-02-06 23:41:58 +00:00
Ben 002110228c docs: add v2.8.0 changelog 2024-02-06 23:39:03 +00:00
Kayla Washburn-Love b8e32a37de fix: use replace when redirecting from /health (#12039)
`pushHistory` will break the back button, so we need to use `replaceHistory` instead
2024-02-06 14:27:32 -07:00
Marcin Tojek 3f04e98cfa feat(cli): pull templates in zip format (#12032) 2024-02-06 19:17:29 +01:00
Spike Curtis 213ae69bee fix: start timer before subscribing to avoid test race (#12031)
Fixes #12030

This is a good example of the kind of thing I'd like to address with a time-testing lib.  The problem is that there is a race between the watchdog starting it's timer and the test incrementing the time.  What would make this easier is if the time-testing library could wait for and assert the call to start the timer before incrementing the time.
2024-02-06 20:21:23 +04:00
Marcin Tojek b6806bca70 fix: nix: google-chrome installed conditionally (#12029) 2024-02-06 16:46:58 +01:00
Dean Sheather 98b86f3cd6 chore: add logs to pq notification dialer (#12020) 2024-02-06 15:21:48 +00:00
Spike Curtis e09cd2c6bd feat: add watchdog to pubsub (#12011)
adds a watchdog to our pubsub and runs it for Coder server.

If the watchdog times out, it triggers a graceful exit in `coder server` to give any provisioner jobs a chance to shut down.

c.f. #11950
2024-02-06 16:58:45 +04:00
Cian Johnston f1e5b4fbb8 ci: stop deploying legacy wsproxies (#12025) 2024-02-06 11:00:10 +00:00
Cian Johnston 26379877b2 fix(dogfood): stop overriding /etc/apt/sources.list with tsw mirrors (#11999) 2024-02-06 09:39:05 +00:00
Colin Adler c7f52b73bb feat(coderd): add prometheus metrics to servertailnet (#11988) 2024-02-05 23:57:18 -06:00
Spike Curtis c84a637116 fix: stop logging error on query canceled (#12017)
Fixes flake seen here: https://github.com/coder/coder/actions/runs/7782340530/job/21218566449
2024-02-06 08:43:34 +04:00
Kayla Washburn-Love b73e66e9a9 feat: show workspace name suggestions below the name field (#12001) 2024-02-05 10:40:15 -07:00
dependabot[bot] 52ec3edd5d ci: bump the github-actions group with 4 updates (#12019)
Bumps the github-actions group with 4 updates: [buildjet/cache](https://github.com/buildjet/cache), [crate-ci/typos](https://github.com/crate-ci/typos), [codecov/codecov-action](https://github.com/codecov/codecov-action) and [hmarr/auto-approve-action](https://github.com/hmarr/auto-approve-action).


Updates `buildjet/cache` from 3 to 4
- [Changelog](https://github.com/BuildJet/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/buildjet/cache/compare/v3...v4)

Updates `crate-ci/typos` from 1.17.2 to 1.18.0
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.17.2...v1.18.0)

Updates `codecov/codecov-action` from 3 to 4
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

Updates `hmarr/auto-approve-action` from 3 to 4
- [Release notes](https://github.com/hmarr/auto-approve-action/releases)
- [Commits](https://github.com/hmarr/auto-approve-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: buildjet/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: hmarr/auto-approve-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-05 14:46:05 +00:00
dependabot[bot] 1f0ba745e9 chore: bump github.com/bramvdbogaerde/go-scp (#12015)
Bumps [github.com/bramvdbogaerde/go-scp](https://github.com/bramvdbogaerde/go-scp) from 1.2.1-0.20221219230748-977ee74ac37b to 1.3.0.
- [Release notes](https://github.com/bramvdbogaerde/go-scp/releases)
- [Commits](https://github.com/bramvdbogaerde/go-scp/commits/v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/bramvdbogaerde/go-scp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-05 14:50:02 +02:00
dependabot[bot] c1e01dfb7b chore: bump github.com/elastic/go-sysinfo from 1.11.0 to 1.12.0 (#12013)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-05 15:37:57 +03:00
Spike Curtis e5ba586e30 fix: fix graceful disconnect in DialWorkspaceAgent (#11993)
I noticed in testing that the CLI wasn't correctly sending the disconnect message when it shuts down, and thus agents are seeing this as a "lost" peer, rather than a "disconnected" one. 

What was happening is that we just used a single context for everything from the netconn to the RPCs, and when the context was canceled we failed to send the disconnect message due to canceled context.

So, this PR splits things into two contexts, with a graceful one set to last up to 1 second longer than the main one.
2024-02-05 14:01:37 +04:00
Spike Curtis bb99cb7d2b chore: move FakeCoordinator to tailnettest (#11992)
Moves FakeCoordinator to tailnettest since it's reused in testing multiple packages in this stack of PRs.
2024-02-05 13:49:32 +04:00
Spike Curtis 646ac942b2 chore: rename FakeCoordinator for export (#11991)
Part of a stack that fixes graceful disconnect from the CLI to tailnet.  I reuse FakeCoordinator in a test for graceful disconnects.
2024-02-05 13:33:31 +04:00
Eric Paulsen f57ce97b5a docs: add faq for gateway reconnects (#12007)
* docs: add faq for gateway reconnects

* make: fmt
2024-02-04 15:50:53 -06:00
Kayla Washburn-Love 1d14d4e58c fix: use dark background in terminal, even when a light theme is selected (#12004) 2024-02-02 15:05:52 -07:00
Jon Ayers 73c5993bea fix: only display xray results if vulns > 0 (#11989) 2024-02-02 11:02:46 -06:00
Cian Johnston 6593de3c73 fix(dogfood/flake.nix): add google-chrome (#11974) 2024-02-02 15:56:06 +00:00
Bruno Quaresma 9b930f8fad feat(site): show deprecation message on template page (#11996) 2024-02-02 14:13:35 +00:00
Bruno Quaresma 2e378b4894 fix(site): fix parameter input icon shrink (#11995) 2024-02-02 13:49:49 +00:00
Mathias Fredriksson aae228ac01 fix(dogfood): resolve module.git-clone.repo_dir containing ~/ (#11994) 2024-02-02 14:21:34 +02:00
Mathias Fredriksson bddea7bcf9 feat(cli/vscodessh): add support for --wait and scripts that block login (#10473) 2024-02-02 13:18:26 +02:00
Kayla Washburn-Love c6c71de353 fix: change build status colors (#11985) 2024-02-01 18:02:40 -07:00
dependabot[bot] efac9ced3e chore: bump github.com/moby/moby (#11975)
Bumps [github.com/moby/moby](https://github.com/moby/moby) from 24.0.1+incompatible to 25.0.2+incompatible.
- [Release notes](https://github.com/moby/moby/releases)
- [Commits](https://github.com/moby/moby/compare/v24.0.1...v25.0.2)

---
updated-dependencies:
- dependency-name: github.com/moby/moby
  dependency-type: direct:production
  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>
2024-02-01 13:58:13 -06:00
Muhammad Atif Ali 21237d96a5 docs: update remote docker host docs (#11919)
* docs: update remote docker host docs

Adds a link to external provisioners as a method to use remote docker hosts

* `make fmt`

* Update docker.md

* fmt
2024-02-01 22:43:38 +03:00
Muhammad Atif Ali 9616b92f0e chore(dogfood): fix nix icon path (#11984) 2024-02-01 19:27:41 +00:00
Bruno Quaresma 96346525e0 fix(site): fix text overflow on batch ws deletion (#11981)
Before:
![image](https://github.com/coder/coder/assets/3165839/723a8fd7-8f63-4712-8af1-cd442455c723)

After:
<img width="674" alt="Screenshot 2024-02-01 at 13 48 56" src="https://github.com/coder/coder/assets/3165839/91c3099e-6a11-4beb-b46b-70a9a6c4abb4">
2024-02-01 14:02:08 -03:00
Marcin Tojek ad8e0db172 feat: add custom error message on signups disabled page (#11959) 2024-02-01 18:01:25 +01:00
Kayla Washburn-Love e070a55142 refactor: stabilize theme.roles (#11969) 2024-02-01 09:53:26 -07:00
Bruno Quaresma 6c9f60a9c5 refactor(site): only display quota if it is higher than 0 (#11979) 2024-02-01 13:49:48 -03:00
Steven Masley 79d5c238cc fix: always return a clean http client for promoauth (#11963)
* fix: add unit test to verify default client is not broken

* always return a clean http client
* No need to clone the tripper
2024-02-01 11:13:34 -05:00
Bruno Quaresma 1a94686928 refactor(site): add table chosmetic changes (#11977)
- Set default 14px as the default font size for the table content
- Add `xsmall` size for checkboxes
- Remove checkbox wrapper padding on the table heading

Before:
<img width="1512" alt="Screenshot 2024-02-01 at 10 22 10" src="https://github.com/coder/coder/assets/3165839/92b844ae-f2bf-476a-89fe-90b16f19c306">

After: 
<img width="1512" alt="Screenshot 2024-02-01 at 10 26 00" src="https://github.com/coder/coder/assets/3165839/0f87d098-4b13-4373-96d2-2c18ee2587f6">
2024-02-01 10:41:15 -03:00
Spike Curtis 1aa117b9ec chore: rename client Listen to ConnectRPC (#11916)
ConnectRPC seems more appropriate for this function
2024-02-01 14:44:11 +04:00
dependabot[bot] 1031ccb3c9 chore: bump github.com/opencontainers/runc from 1.1.5 to 1.1.12 (#11968)
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.1.5 to 1.1.12.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Changelog](https://github.com/opencontainers/runc/blob/v1.1.12/CHANGELOG.md)
- [Commits](https://github.com/opencontainers/runc/compare/v1.1.5...v1.1.12)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/runc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-01 13:15:01 +03:00
Spike Curtis d5a98cc6d7 fix: avoid race in TestPGPubsub_Metrics by using Eventually (#11973)
Annoyingly, prometheus Registry collects metrics async, which is causing our test to be racy.  They also don't export enough from the Metric interface for us to replicate a synchronous collect, so we have to use Eventually to test.
2024-02-01 12:10:19 +04:00
Spike Curtis 5a359d50dd feat: add metrics to PGPubsub (#11971)
Adds prometheus metrics to PGPubsub for monitoring its health and performance in production.

Related to #11950 --- additional diagnostics to help figure out what's happening
2024-02-01 11:25:03 +04:00
Asher e748312193 fix(dogfood): fix startup script looping (#11972)
Seems to be on account of the quotes interpreting a ~ literally.  We do
replace it with /home/coder but only if it matches ~/, not ~ alone.
2024-01-31 21:33:02 -09:00
Colin Adler 3ace7982aa fix: rewrite url to agent ip in single tailnet (#11810)
This restores previous behavior of being able to cache connections
across agents in single tailnet.
2024-02-01 00:25:52 -06:00
Spike Curtis 073d1f7078 chore: remove pingWebSocket since yamux runs keepalives (#11914)
Since we run yamux over the websocket, we don't need to ping at the websocket layer because yamux has a 30 second keepalive mechanism enabled in the default config.
2024-02-01 09:48:58 +04:00
Colin Adler 4ed1f5581a chore(coderd): add logging to agent rpc yamux conn (#11965) 2024-01-31 23:17:20 -06:00
Spike Curtis cc0dc103b6 chore: remove agentsdk client RPC() function (#11913)
The RPC() function isn't called, since Listen() was modified to do this job.

Listen() has the right signature, since it returns a drpc.Conn, rather than the Agent API.  That's because tailnet v2 and agent v2 are separate APIs served over the same connection.

It might be clearer to rename `Listen()` to `RPC()` but I'll save that for a different PR.
2024-02-01 08:22:12 +04:00
Spike Curtis eb03e4490a feat: add statsReporter for reporting stats on agent v2 API (#11920)
Adds a new statsReporter subcomponent of the agent, which in a later PR will be used to report stats over the v2 API.

Refactors the logic a bit so that we can handle starting and stopping stats reporting if the agent API connection drops and reconnects.
2024-02-01 08:21:01 +04:00
Spike Curtis b79785c86f feat: move agent v2 API connection monitoring to yamux layer (#11910)
Moves monitoring of the agent v2 API connection to the yamux layer.

Present behavior monitors this at the websocket layer, and closes the websocket on completion. This can cause yamux to hit unexpected errors since the connection is closed underneath it.

This might be the cause of yamux errors that some customers are seeing

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/tCz4CxRU9jhAJ7zH8RTi/53b8b5ef-e9e5-44a5-b559-99c37c136071.png)

In any case, it's more graceful to close yamux first and let yamux close the underlying websocket.  That should limit yamux error logging to truly unexpected/error cases.

The only downside is that the yamux `Close()` doesn't accept a reason, so if the agent becomes outdated and we close the API connection, the agent just sees the connection close without a reason.  I'm not sure we log this at the agent anyway, but it would be nice.  I think more accurate logging on Coderd are more important.

I've also added some logging when the monitor disconnects for reasons other than the context being canceled (e.g. agent outdated, failed pings).
2024-02-01 08:18:35 +04:00
Spike Curtis 13e214f7f1 feat: add logging to agent yamux session (#11912)
Log yamux errors and warnings in the agent.
2024-02-01 08:18:13 +04:00
Michael Smith b0a855caa4 fix: improve click UX and styling for Auth Token page (#11863)
* wip: commit progress for clipboard update

* wip: push more progress

* chore: finish initial version of useClipboard revamp

* refactor: update API query to use newer RQ patterns

* fix: update importers of useClipboard

* fix: increase clickable area of CodeExample

* fix: update styles for CliAuthPageView

* fix: resolve issue with ref re-routing

* docs: update comments for clarity

* wip: commit progress on clipboard tests

* chore: add extra test case for referential stability

* wip: disable test stub to avoid breaking CI

* wip: add test case for tab-switching

* feat: finish changes

* fix: improve styling for strong text

* fix: make sure period doesn't break onto separate line

* fix: make center styling more friendly to screen readers

* refactor: clean up mocking implementation

* fix: resolve security concern for clipboard text

* fix: update CodeExample to obscure text when appropriate

* fix: apply secret changes to relevant code examples

* refactor: simplify code for obfuscating text

* fix: partially revert clipboard changes

* fix: clean up page styling further

* fix: remove duplicate property identifier

* refactor: rename variables for clarity

* fix: simplify/revert CopyButton component design

* fix: update how dummy input is hidden from page

* fix: remove unused onClick handler prop

* fix: resolve unused import

* fix: opt code examples out of secret behavior
2024-01-31 21:25:30 -05:00
Colin Adler c7f51a9d70 chore(site): update time until shutdown tooltip language (#11964) 2024-01-31 16:21:35 -06:00
Kayla Washburn-Love d2e6405322 chore: add inactive role to experimental theme (#11967) 2024-01-31 15:16:17 -07:00
Bruno Quaresma 4df913372f feat(site): display xray scan result in the agent (#11955) 2024-01-31 19:16:01 -03:00
Steven Masley ac64155282 fix: strip timezone information from a date in dau response (#11962)
* fix: strip timezone information from a date in dau response

Timezone information is lost, so do not forward it to the client.

* fix: timezone offset should be flipped
* Make tests deterministic
2024-01-31 16:01:50 -06:00
Kayla Washburn-Love 76e73287a5 refactor: add modules/templates and modules/workspaces (#11947) 2024-01-31 12:09:36 -07:00
Muhammad Atif Ali 4604db072a fix(dogfood): fix startup script on workspace creation (#11958) 2024-01-31 18:01:22 +03:00
Muhammad Atif Ali d2b4d58e96 chore(dogfood): use better names for image options (#11957) 2024-01-31 14:36:01 +00:00
Muhammad Atif Ali 215a9d1b30 chore: experiment building dogfood image with nix (#11680) 2024-01-31 14:27:11 +00:00
Marcin Tojek 13cbca679e feat: support template bundles as zip archives (#11839) 2024-01-31 14:49:55 +01:00
Mathias Fredriksson b25deaae20 fix(coderd/database): fix limit in GetUserWorkspaceBuildParameters (#11954) 2024-01-31 13:56:36 +02:00
Spike Curtis a34cada09a feat: add logging to pgPubsub (#11953)
Should be helpful for #11950

Adds a logger to pgPubsub and logs various events, most especially connection and disconnection from postgres.
2024-01-31 15:49:16 +04:00
Spike Curtis 1c8b803785 feat: add logging to pgcoord subscribe/unsubscribe (#11952)
Adds logging to unsubscribing from peer and tunnel updates in pgcoordinator, since #11950 seems to be problem with these subscriptions
2024-01-31 12:15:58 +04:00
Jon Ayers 0c30dde9b5 feat: add customizable upgrade message on client/server version mismatch (#11587) 2024-01-30 17:11:37 -06:00
Ammar Bandukwala adbb025e74 feat: add user-level parameter autofill (#11731)
This PR solves #10478 by auto-filling previously used template values in create and update workspace flows.

I decided against explicit user values in settings for these reasons:

* Autofill is far easier to implement
* Users benefit from autofill _by default_ — we don't need to teach them new concepts
* If we decide that autofill creates more harm than good, we can remove it without breaking compatibility
2024-01-30 16:02:21 -06:00
Kayla Washburn-Love aeb4112513 chore: update storybook (#11936) 2024-01-30 14:23:40 -07:00
Spike Curtis 520b12e1a2 fix: close MultiAgentConn when coordinator closes (#11941)
Fixes an issue where a MultiAgentConn isn't closed properly when the coordinator it is connected to is closed.

Since servertailnet checks whether the conn is closed before reinitializing, it is important that we check this, otherwise servertailnet can get stuck if the coordinator closes (e.g. when we switch from AGPL to PGCoordinator after decoding a license).
2024-01-31 00:38:19 +04:00
Colin Adler 2fd1a726aa fix: only delete expired agents on success (#11940) 2024-01-30 14:11:45 -06:00
Colin Adler 27f3b7a814 fix: add timeout to listening ports request (#11935)
This can potentially hang for 15m if the agent is unreachable.
2024-01-30 13:53:52 -06:00
Bruno Quaresma 7f1c808ff9 feat(site): simplify create template form by removing advanced settings (#11918) 2024-01-30 16:40:59 -03:00
Kayla Washburn-Love 619bdd1e7a refactor: redesign Paywall component (#11907) 2024-01-30 10:26:19 -07:00
Kayla Washburn-Love 20dcefa156 add an interaction test to InfoTooltip (#11905) 2024-01-30 10:20:11 -07:00
Bruno Quaresma e26ba1affd feat(site): do not show popover on update deadline (#11921) 2024-01-30 14:11:15 -03: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
Mathias Fredriksson 83eea2d323 feat(scaletest/templates): add support for concurrent scenarios (#11753) 2024-01-30 14:54:54 +02:00
Bruno Quaresma 4b27c77969 fix(site): fix parameters' request upon template variables update (#11898)
Fix https://github.com/coder/coder/issues/11870
2024-01-30 08:03:53 -03:00
Mathias Fredriksson 60653bbacb fix(cli): allow template name length of 32 in template push and create (#11915) 2024-01-30 12:47:10 +02:00
Muhammad Atif Ali 86e33257af chore(docs): fix a typo (#11895) 2024-01-30 12:00:25 +03:00
Spike Curtis 0fc177203e feat: use agent v2 API to update app health (#11889)
Use the Agent v2 API to update App Health
2024-01-30 11:35:12 +04:00
Spike Curtis 2599850e54 feat: use agent v2 API to post startup (#11877)
Uses the v2 Agent API to post startup information.
2024-01-30 11:23:28 +04:00
Spike Curtis da8bb1c198 feat: use agent v2 API to fetch manifest (#11832)
Agent uses the v2 API to obtain the manifest, instead of the HTTP API.
2024-01-30 10:11:28 +04:00
Spike Curtis 9cf4e7f15a fix: prevent agent_test.go from failing on error logs (#11909)
We're failing tests on error logs like this: https://github.com/coder/coder/actions/runs/7706053882/job/21000984583

Unfortunately, the error we hit, when the underlying connection is closed, is unexported, so we can't specifically ignore it.

Part of the issue is that agent.Close() doesn't wait for these goroutines to complete before returning, so the test harness proceeds to close the connection. This looks to our product code like the network connection failing.  It would be possible to fix this, but just doesn't seem worth it for the extra insurance of catching other error logs in these tests.
2024-01-30 10:04:01 +04:00
Spike Curtis d3983e4dba feat: add logging to client tailnet yamux (#11908)
Adds logging to yamux when used for tailnet client connections, e.g. CLI and wsproxy.  This could be useful for debugging connection issues with tailnet v2 API.
2024-01-30 09:58:59 +04:00
Spike Curtis 0eff646c31 chore: move proto to sdk conversion to agentsdk (#11831)
`agentsdk` depends on `agent/proto` because it needs to get the version to dial.

Therefore, the conversion routines need to live in `agentsdk` so that we can convert to and from the Manifest.

I briefly considered refactoring the agent to only reference `proto.Manifest`, but decided against it because we might have multiple protocol versions in the future, its useful to have a protocol-independent data structure.
2024-01-30 09:04:56 +04:00
Spike Curtis 1e8a9c09fe chore: remove legacy wsconncache (#11816)
Fixes #8218

Removes `wsconncache` and related "is legacy?" functions and API calls that were used by it.

The only leftover is that Agents still use the legacy IP, so that back level clients or workspace proxies can dial them correctly.

We should eventually remove this: #11819
2024-01-30 07:56:36 +04:00
Spike Curtis 13e24f21e4 feat: use Agent v2 API for Service Banner (#11806)
Agent uses the v2 API for the service banner, rather than the v1 HTTP API.

One of several for #10534
2024-01-30 07:44:47 +04:00
Jon Ayers 4f5a2f0a9b feat: add backend for jfrog xray support (#11829) 2024-01-29 19:30:02 -06:00
dependabot[bot] 46d92dac57 ci: bump the github-actions group with 5 updates (#11890)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-30 00:38:59 +03:00
dependabot[bot] 5937027c86 chore: bump github.com/gohugoio/hugo from 0.121.2 to 0.122.0 (#11883)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-30 00:36:23 +03:00
dependabot[bot] 4dc6a302f2 chore: bump google.golang.org/grpc from 1.60.1 to 1.61.0 (#11885)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-30 00:36:12 +03:00
dependabot[bot] 3b65a1508c chore: bump github.com/google/uuid from 1.5.0 to 1.6.0 (#11886)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-30 00:36:01 +03:00
dependabot[bot] 71b79eace4 chore: bump alpine from 3.19.0 to 3.19.1 in /scripts (#11887)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-30 00:35:44 +03:00
Eric Paulsen d8a3ebef31 docs: fix example template README 404s and semantics (#11903)
* docs: fix example template README 404s and semantics

* make: gen
2024-01-29 21:34:12 +00:00
Kayla Washburn-Love f572e18144 fix: fix cliui prompt styling (#11899) 2024-01-29 13:56:43 -07:00
Spike Curtis 207328ca50 feat: use appearance.Fetcher in agentapi (#11770)
This PR updates the Agent API to use the appearance.Fetcher, which is set by entitlement code in Enterprise coderd.

This brings the agentapi into compliance with the Enterprise feature.
2024-01-29 21:22:50 +04:00
Garrett Delfosse f54278cdfe fix: respect wait flag on ping (#11896) 2024-01-29 11:50:35 -05:00
Colin Adler bc14e926d8 feat: add option to speedtest to dump a pcap of network traffic (#11848) 2024-01-29 09:57:31 -06:00
Spike Curtis b2bc3fff33 fix: wait for new template version before promoting (#11874)
Fixes a test flake due to not waiting for the correct template version prior to promoting it.
2024-01-29 19:29:56 +04:00
Steven Masley 04a23261e6 chore: ensure github uids are unique (#11826) 2024-01-29 09:13:46 -06:00
Steven Masley d66e6e78ee fix: always attempt external auth refresh when fetching (#11762) (#11830)
* fix: always attempt external auth refresh when fetching
* refactor validate to check expiry when considering "valid"
2024-01-29 08:55:15 -06:00
Cian Johnston eeef56a655 feat(cli): show workspace favorite status in list output (#11878) 2024-01-29 14:14:12 +00:00
Cian Johnston 9abf6ec170 feat(site): show favorite workspaces in ui (#11875)
* Add Star beside workspace name to indicate favorite status in WorkspacesList
* Add button in workspace top row to toggle workspace favorite status
2024-01-29 13:39:31 +00:00
Bruno Quaresma acd22b2c65 fix(site): fix capitalized username (#11891)
Fix #11888
2024-01-29 10:24:19 -03:00
Mathias Fredriksson 3e89ba23e5 test(scaletest): fix websocket error during close (#11879)
Fixes #11735
2024-01-29 13:42:30 +02:00
Muhammad Atif Ali 8398b4188b ci: fix winget-release workflow (#11865) 2024-01-29 13:49:20 +03:00
Spike Curtis bc4ae53261 chore: refactor Appearance to an interface callable by AGPL code (#11769)
The new Agent API needs an interface for ServiceBanners, so this PR creates it and refactors the AGPL and Enterprise code to achieve it.

Before we depended on the fact that the HTTP endpoint was missing to serve an empty ServiceBanner on AGPL deployments, but that won't work with dRPC, so we need a real interface to call.
2024-01-29 12:17:31 +04:00
Marcin Tojek aacb4a2b4c feat: use map instead of slice in metrics aggregator (#11815) 2024-01-29 09:12:41 +01:00
Spike Curtis 37e9479815 fix: fix TestServiceBanners/Agent (#11768)
The original test is bugged in that it

1. creates a new AGPL coderd with a new database, so no appearance is set in the DB.
2. overwrites the agentClient so the assertion after removing the license is against the AGPL coderd
2024-01-29 11:56:33 +04:00
Spike Curtis f9fdd44510 feat: change codersdk to use tailnet v2 for DERPMap updates (#11736)
fixes #10533


refactors `codersdk` workspace agent dialer to use a single websocket connection to the tailnet v2 API for both coordination and DERPMap updates, rather than separate websockets (and the v1 API for DERPMaps).
2024-01-29 11:26:50 +04:00
Muhammad Atif Ali 699a4b8dd4 chore(dogfood): use built-in VS Code Desktop button over the module (#11869) 2024-01-29 00:37:22 +03:00
Eric Paulsen be4d5221ba docs: add guide for azure federation (#11864)
* docs: add guide for azure federation

* make: fmt

* refactor: arm secrets and semantics
2024-01-28 15:51:11 -05:00
Muhammad Atif Ali 2f9bf1ebe1 ci: validate template before pushing (#11867) 2024-01-27 10:02:10 +03:00
Spike Curtis 4825b7ccd2 fix: use new context after t.Parallel in TestOAuthAppSecrets
c.f. https://coder.com/blog/go-testing-contexts-and-t-parallel

fixes flakes like https://github.com/coder/coder/runs/20856469613
2024-01-27 08:45:43 +04:00
Muhammad Atif Ali de6d4794dc chore(dogfood): replace repo_dir with base_repo_dir in git-clone module (#11835)
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-01-27 01:45:07 +00:00
Kayla Washburn-Love bb8ce7bc02 chore: move components/Resources to modules/resources (#11852) 2024-01-26 15:11:07 -07:00
Kayla Washburn-Love 8f46beef72 chore: remove most usage of PropsWithChildren (#11859) 2024-01-26 12:04:22 -07:00
Kayla Washburn-Love c2b6e204f3 fix: type error from theme update (#11844) 2024-01-26 10:56:19 -07:00
Kayla Washburn-Love c85fc3c8fe refactor: add more fill variants to the experimental theme (#11827) 2024-01-26 10:28:59 -07:00
Cian Johnston 42e997d39e fix(coderd/rbac): do not cache context cancellation errors (#11840)
#7439 added global caching of RBAC results.
Calls are cached based on hash(subject, object, action).
We often use dbauthz.AsSystemRestricted to handle "internal" authz calls, and these are often repeated with similar arguments and are likely to get cached.
So a transient error doing an authz check on a system function will be cached for up to a minute.
I'm just starting off with excluding context.Canceled but there's likely a whole suite of different errors we want to also exclude from the global cache.
2024-01-26 16:19:55 +00:00
Spike Curtis d6baa3cab0 fix: stop running tests that exec sh scripts in parallel (#11834)
Ok, so my last attempt at a fix here failed

https://github.com/coder/coder/actions/runs/7666229961/job/20893608286

I have a new theory: it's not the `terraform` binary that's busy, it's actually `fake_cancel.sh` and it gets marked busy when we `exec` it from the script we write.

Use of `exec` also replaces the executing code in place, rather than starting a new process/shell, so that's why the error we get says `terraform` is busy.
2024-01-26 19:22:35 +04:00
Bruno Quaresma 0ba035a16d refactor(site): improve parameters field (#11802) 2024-01-26 11:31:52 -03:00
Kira Pilot 4c71cccbc3 fix(site): disable autostart and autostop according to template settings (#11809)
* fix (site): disable autostart and autostop according to template settings

* checking form values again; wrote tests

* fixed closure and label bugs

* fix broken query key

* tweaks
2024-01-26 09:06:01 -05:00
Mathias Fredriksson 52c08a98bb test(scaletest): fix worksapcebuild retry (#11836) 2024-01-26 15:49:19 +02:00
Mathias Fredriksson 02124758fb feat(cli/exp): extend scaletest create-workspaces with --retry option (#11825)
Part of #11801
2024-01-26 11:29:48 +00:00
Cian Johnston fdf9f03097 fix(enterprise/cli): add ID to default columns in licenses list output (#11823) 2024-01-26 09:55:16 +00:00
Dean Sheather 29707099d7 chore: add agentapi tests (#11269) 2024-01-26 07:04:19 +00:00
Muhammad Atif Ali 541154b74b docs: simplify JFrog integration docs (#11787) 2024-01-25 19:50:06 -05:00
Steven Masley 005c014f13 chore: instrument additional github api calls (#11824)
* chore: instrument additional githubapi calls

This only affects github as a login source, not external auth.
2024-01-25 18:34:46 -06:00
Bruno Quaresma e371716b38 refactor(site): add minor workspace improvements (#11822) 2024-01-25 21:05:29 -03:00
Kayla Washburn-Love 73a6899f2c chore: miscellaneous cleanup (#11785) 2024-01-25 14:22:52 -07:00
Ammar Bandukwala 79568bf628 Revert "fix: always attempt external auth refresh when fetching (#11762)"
This reverts commit 0befc0826a.
2024-01-25 14:22:47 -06:00
Steven Masley 0befc0826a fix: always attempt external auth refresh when fetching (#11762)
* fix: always attempt external auth refresh when fetching
* refactor validate to check expiry when considering "valid"
2024-01-25 10:54:56 -06:00
Bruno Quaresma fd7f85bc5e fix(site): fix proxy settings link (#11817) 2024-01-25 12:16:24 +00:00
Cian Johnston 8eae4f83bf fix(coderd/provisionerdserver): fix test flake in TestHeartbeat (#11808) 2024-01-25 12:05:57 +00:00
Muhammad Atif Ali 979a920832 docs: use coder modules in offline deployments (#11788)
* docs: use coder modules in offline deployments

* fix typos

* Update offline installation instructions with Artifactory support for Coder modules

* Review suggestions
2024-01-25 08:01:56 +03:00
Ben Potter 6b0e1291d2 docs: add v2.7.3 changelog (#11811)
* docs: add v2.7.1 changelog

* docs: add v2.7.2 changelog
2024-01-24 16:53:08 -06:00
Kayla Washburn-Love 3d76e1b55c chore: clean up package.json and tsconfig (#11757) 2024-01-24 13:53:44 -07:00
Cian Johnston ecae6f9135 fix(enterprise/tailnet): handle query canceled error in sendBeat() (#11794) 2024-01-24 18:42:05 +00:00
Bruno Quaresma 8bc91b489e refactor(site): increase form fields gap (#11803) 2024-01-24 14:16:42 -03:00
Marcin Tojek 560e8cc1ae fix: check update permission to start workspace (#11798) 2024-01-24 17:18:03 +01:00
Cian Johnston 4616ccf462 fix(coderd): alter return signature of convertWorkspace, add check for requesterID (#11796) 2024-01-24 14:13:14 +00:00
Cian Johnston 70dc282b7d feat(cli): add favorite/unfavorite commands (#11793) 2024-01-24 14:05:39 +00:00
Cian Johnston f92336c4d5 feat(coderd): allow workspace owners to mark workspaces as favorite (#11791)
- Adds column `favorite` to workspaces table
- Adds API endpoints to favorite/unfavorite workspaces
- Modifies sorting order to return owners' favorite workspaces first
2024-01-24 13:39:19 +00:00
Bruno Quaresma 6145da8a9e refactor(site): verify external auth before display ws form (#11777) 2024-01-24 09:45:22 -03:00
Spike Curtis 5cbb76b47a fix: stop spamming DERP map updates for equivalent maps (#11792)
Fixes 2 related issues:

1. wsconncache had incorrect logic to test whether to send DERPMap updates, sending if the maps were equivalent, instead of if they were _not equivalent_.
2. configmaps used a bugged check to test equality between DERPMaps, since it contains a map and the map entries are serialized in random order. Instead, we avoid comparing the protobufs and instead depend on the existing function that compares `tailcfg.DERPMap`. This also has the effect of reducing the number of times we convert to and from protobuf.
2024-01-24 16:27:15 +04:00
Spike Curtis f5dbc718a7 fix: accept agent RPC connection without version query parameter (#11790)
Fixes an issue where Coder v2.7.1 agents connect to /api/v2/workspaceagents/me/rpc without a version query parameter
2024-01-24 09:10:16 +04:00
Colin Adler 13beb04521 fix: disable keepalives in workspaceapps transport (#11789)
Connection caching causes requests to hit the wrong workspaces. See
comment.

Fixes https://github.com/coder/coder/issues/11767
2024-01-24 14:46:59 +10:00
Muhammad Atif Ali 1e2634d2d0 chore(dogfood): use versioning for coder modules (#11774) 2024-01-24 01:33:25 +00:00
Kayla Washburn-Love 31a6a5dc6d chore: add stories for DropdownArrow (#11764) 2024-01-23 16:02:57 -07:00
Jon Ayers 383eed93f8 fix: use correct logger for lifecycle_executor (#11763) 2024-01-23 14:33:55 -06:00
Bruno Quaresma e828daba6e refactor(site): simplify create workspace form (#11771)
This is the first PR of a series of PRs trying to simplify and improve the create workspace flow.
- Use the existent template header and remove the selected template card
- Move the owner field to the general section so we don't have "anemic" sections with single fields

Before:
<img width="1512" alt="Screenshot 2024-01-23 at 10 22 45" src="https://github.com/coder/coder/assets/3165839/6a2ba6b4-9ffb-4576-9282-7901691f45ee">

Now:
<img width="1512" alt="Screenshot 2024-01-23 at 10 22 56" src="https://github.com/coder/coder/assets/3165839/84301548-4af9-4de0-96ff-2a6363fc8cf7">
2024-01-23 15:39:23 -03:00
Steven Masley d6ba0dfecb feat: add "updated" search param to workspaces (#11714)
* feat: add "updated" search param to workspaces
* rego -> sql needs to specify which <table>.organization_id
2024-01-23 11:52:06 -06:00
Steven Masley 081fbef097 fix: code-server path based forwarding, defer to code-server (#11759)
Do not attempt to construct a path based port forward url.
Always defer to code server, as it has it's own proxy method.
2024-01-23 11:36:44 -06:00
Marcin Tojek 77a4792ecd fix(cli): ssh: auto-update workspace (#11773) 2024-01-23 18:01:44 +01:00
Bruno Quaresma 369821ea19 feat(site): generates unique workspace names by default (#11772) 2024-01-23 15:55:29 +00:00
Bruno Quaresma 910f17f4e7 refactor(site): refactor external auth component (#11758)
Recommended improvements:
- Rename component for clarity 
- Simplify interface for contextual relevance 
- Handle polling errors based on section, not every button

Before:
<img width="1511" alt="Screenshot 2024-01-22 at 15 24 26" src="https://github.com/coder/coder/assets/3165839/cfb8c0bc-f5a2-4708-bd97-fdfc46bd1eee">

Now:
<img width="1512" alt="Screenshot 2024-01-22 at 15 24 41" src="https://github.com/coder/coder/assets/3165839/5aaad448-1bb2-45ea-9250-cd374a072be2">
2024-01-23 12:26:12 -03:00
Spike Curtis 059e533544 feat: agent uses Tailnet v2 API for DERPMap updates (#11698)
Switches the Agent to use Tailnet v2 API to get DERPMap updates.

Subsequent PRs will do the same for the CLI (`codersdk`) and `wsproxy`.
2024-01-23 14:42:07 +04:00
Spike Curtis 3e0e7f8739 feat: check agent API version on connection (#11696)
fixes #10531

Adds a check for `version` on connection to the Agent API websocket endpoint.  This is primarily for future-proofing, so that up-level agents get a sensible error if they connect to a back-level Coderd.

It also refactors the location of the `CurrentVersion` variables, to be part of the `proto` packages, since the versions refer to the APIs defined therein.
2024-01-23 14:27:49 +04:00
Spike Curtis eb12fd7d92 feat: make ServerTailnet set peers lost when it reconnects to the coordinator (#11682)
Adds support to `ServerTailnet` to set all peers lost before attempting to reconnect to the coordinator. In practice, this only really affects `wsproxy` since coderd has a local connection to the coordinator that only goes down if we're shutting down or change licenses.
2024-01-23 13:17:56 +04:00
dependabot[bot] f86186eef2 chore: bump github.com/hashicorp/terraform-json from 0.20.0 to 0.21.0 (#11738)
Bumps [github.com/hashicorp/terraform-json](https://github.com/hashicorp/terraform-json) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/hashicorp/terraform-json/releases)
- [Commits](https://github.com/hashicorp/terraform-json/compare/v0.20.0...v0.21.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/terraform-json
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-23 09:46:11 +03:00
Ben Potter 18d43405c0 chore: change SSH wording on workspace page (#11702) 2024-01-23 09:45:44 +03:00
dependabot[bot] ca38bfd2fc ci: bump the github-actions group with 2 updates (#11745)
Bumps the github-actions group with 2 updates: [crate-ci/typos](https://github.com/crate-ci/typos) and [toshimaru/auto-author-assign](https://github.com/toshimaru/auto-author-assign).


Updates `crate-ci/typos` from 1.17.1 to 1.17.2
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.17.1...v1.17.2)

Updates `toshimaru/auto-author-assign` from 2.0.1 to 2.1.0
- [Release notes](https://github.com/toshimaru/auto-author-assign/releases)
- [Changelog](https://github.com/toshimaru/auto-author-assign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/toshimaru/auto-author-assign/compare/v2.0.1...v2.1.0)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: toshimaru/auto-author-assign
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-23 09:43:02 +03:00
Stephen Kirby 91a8b1b886 chore: fix broken docs links (#11760)
* fixed broken install/packages.md link

* fixed broken docs links

* fixed admin/auth link

* fixed example-guide links

* replaced mitchell tweet with nix docs

* make fmt

* replaced private image with imgur
2024-01-22 18:45:34 -06:00
Asher 3014777d2a feat: add endpoints to oauth2 provider applications (#11718)
These will show up when configuring the application along with the
client ID and everything else.  Should make it easier to configure the
application, otherwise you will have to go look up the URLs in the
docs (which are not yet written).

Co-authored-by: Steven Masley <stevenmasley@gmail.com>
2024-01-22 13:25:25 -09:00
Steven Masley 8e0a153725 chore: implement device auth flow for fake idp (#11707)
* chore: implement device auth flow for fake idp
2024-01-22 20:46:05 +00:00
Asher 16c6cefde8 chore: pass lifetime directly into api key generate (#11715)
Rather than passing all the deployment values.  This is to make it
easier to generate API keys as part of the oauth flow.

I also added and fixed a test for when the lifetime is set and the
default and expiration are unset.

Co-authored-by: Steven Masley <stevenmasley@gmail.com>
2024-01-22 11:42:55 -09:00
Bruno Quaresma a31d19d538 refactor(site): apply cosmetic changes and remove ExternalAuth from settings page (#11756) 2024-01-22 16:07:43 -03:00
Asher 7589df325b fix: display error when fetching OAuth2 provider apps (#11713) 2024-01-22 09:56:36 -09:00
Kayla Washburn-Love 69e963b1a2 refactor: move dashboard functionality to modules/dashboard/ (#11721) 2024-01-22 11:44:33 -07:00
Bruno Quaresma 14f114b224 chore(site): add test for sensitive value (#11755) 2024-01-22 15:03:15 -03:00
Kayla Washburn-Love f74ef142d0 refactor: reorganize auth components and hooks (#11717) 2024-01-22 10:43:32 -07:00
Bruno Quaresma f02561a599 chore(site): minor refactor to the resource metadata code (#11746) 2024-01-22 12:55:46 -03:00
Spike Curtis 5388a1b6d7 fix: use TSMP ping for reachability, not latency (#11749)
Use TSMP ping for reachability, but leave Disco ping for when we call Ping() since we often use that to determine whether we have a direct connection.

Also adds unit tests to make sure Ping() returns direct connection vs DERP correctly.
2024-01-22 17:37:15 +04:00
Ben Potter 66f119bde8 docs: add v2.7.1 changelog (#11747) 2024-01-22 07:09:18 -06:00
Spike Curtis 7ffd99cfe2 fix: use DiscoPing (partially reverts #11306) (#11744) 2024-01-22 12:40:21 +00:00
Spike Curtis 3d85cdfa11 feat: set peers lost when disconnected from coordinator (#11681)
Adds support to Coordination to call SetAllPeersLost() when it is closed. This ensure that when we disconnect from a Coordinator, we set all peers lost.

This covers CoderSDK (CLI client) and Agent.  Next PR will cover MultiAgent (notably, `wsproxy`).
2024-01-22 15:26:20 +04:00
Danny Kopping 9f6b38ce9c chore: use correct anchor link on scale.md (#11728) 2024-01-22 10:34:38 +00:00
Dean Sheather 15a90f028e chore: collect more template telemetry to gauge feature usage
We don't have visibility into some feature usage, so this adds a lot of fields missing from `database.Template` to `telemetry.Template`. Deprecation message is not collected, just whether it's set or not.
2024-01-22 18:55:27 +10:00
Spike Curtis b7b936547d feat: add setAllPeersLost to the configMaps subcomponent (#11665)
adds setAllPeersLost to the configMaps subcomponent of tailnet.Conn --- we'll call this when we disconnect from a coordinator so we'll eventually clean up peers if they disconnect while we are retrying the coordinator connection (or we don't succeed in reconnecting to the coordinator).
2024-01-22 12:12:15 +04:00
Spike Curtis f01cab9894 feat: use tailnet v2 API for coordination (#11638)
This one is huge, and I'm sorry.

The problem is that once I change `tailnet.Conn` to start doing v2 behavior, I kind of have to change it everywhere, including in CoderSDK (CLI), the agent, wsproxy, and ServerTailnet.

There is still a bit more cleanup to do, and I need to add code so that when we lose connection to the Coordinator, we mark all peers as LOST, but that will be in a separate PR since this is big enough!
2024-01-22 11:07:50 +04:00
Muhammad Atif Ali 5a2cf7cd14 chore(docs): remove tabs from appearance settings (#11726) 2024-01-20 13:27:28 +00:00
dependabot[bot] 83013792b1 chore: bump vite from 4.5.1 to 4.5.2 in /site (#11723)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 12:19:26 +00:00
Muhammad Atif Ali 4bed9611a8 fix(docs): fix tabs for support links (#11724) 2024-01-20 15:12:07 +03:00
Ben Potter 77de24c94f docs: add v2.7.0 changelog (#11719)
* docs: add v2.7.0 changelog

* some modifications
2024-01-19 23:11:35 +00:00
Kayla Washburn-Love 80eac73ed1 chore: remove useLocalStorage hook (#11712) 2024-01-19 16:04:19 -07:00
Asher fa99f6a200 chore: make yarn use the right version of node (#11716)
Otherwise if for example you try to run `yarn storybook` it complains
that the version of Node is wrong.

`pnpm storybook` works fine and that is probably what we should
actually use, but as long as we are installing Yarn and not restricting
its use we might as well make it use the right version of Node.
2024-01-19 12:59:38 -09:00
Kayla Washburn-Love 76911f1375 chore: fix TemplateVersionEditor story (#11709) 2024-01-19 12:13:30 -07:00
Steven Masley ca48b8783b fix: update template with noop returned undefined template (#11688)
* fix: doing a noop patch to templates resulted in 404

The patch response did not include the template. The UI required the
template to be returned to form the new page path

null is more explicit, and harder to make occur by mistake.
2024-01-19 18:54:25 +00:00
Kayla Washburn-Love 75d70a9542 chore: add a story for WorkspaceOutdatedTooltip (#11695) 2024-01-19 11:41:18 -07:00
Muhammad Atif Ali 6090007708 docs: update docs to set SupportLinks (#11699) 2024-01-19 20:10:10 +03:00
Steven Masley d67c9d1bb5 fix: set request header before do (#11706) 2024-01-19 16:14:08 +00:00
Steven Masley ccfd1a561b chore: improve device handling error message (#11606) 2024-01-19 09:41:52 -06:00
Mathias Fredriksson 593a1e9f60 feat(cli/exp): add target workspace/users to scaletest commands (#11701) 2024-01-19 15:32:46 +00:00
Marcin Tojek 4b059c4c93 fix: make workspace tooltips actionable (#11700) 2024-01-19 15:17:02 +01:00
Mathias Fredriksson 200a87e7d4 feat(cli/ssh): allow multiple remote forwards and allow missing local file (#11648) 2024-01-19 15:21:10 +02:00
Mathias Fredriksson 73e6bbff7e feat(cli/exp): add app testing to scaletest workspace-traffic (#11633) 2024-01-19 15:20:19 +02:00
Bruno Quaresma 1f63a11396 refactor(site): refactor resource and agents (#11647) 2024-01-19 09:06:33 -03:00
Marcin Tojek 89fd29478d feat: expose support links as env variables (#11697) 2024-01-19 11:20:36 +01:00
Garrett Delfosse bf0a6fcc32 feat: manage provisioner tags in template editor (#11600) 2024-01-18 17:35:20 -05:00
Kayla Washburn-Love 9ed3487f67 feat: batch workspace updates (#11583) 2024-01-18 15:14:25 -07:00
Bruno Quaresma 156aaba335 feat(site): show version files diff based on active version (#11686) 2024-01-18 16:08:17 -03:00
Steven Masley 6bb1a34a37 fix: allow ports in wildcard url configuration (#11657)
* fix: allow ports in wildcard url configuration

This just forwards the port to the ui that generates urls.
Our existing parsing + regex already supported ports for
subdomain app requests.
2024-01-18 09:44:05 -06:00
Spike Curtis 1f0e6ba6c6 fix: use raw syscalls to write binary we execute (#11684)
Fixes flake seen here, I think

https://github.com/coder/coder/actions/runs/7565915337/job/20602500818

golang's file processing is complex, and in at least some cases it can return from a file.Close() call without having actually closed the file descriptor.

If we're holding open the file descriptor of an executable we just wrote, and try to execute it, it will fail with "text file busy" which is what we have seen.

So, to be extra sure, I've avoided the standard library and directly called the syscalls to open, write, and close the file we intend to use in the test.

I've also added some more logging so if it's some issue of multiple tests writing to the same location, the we might have a chance to see it.
2024-01-18 16:21:11 +04:00
Marcin Tojek c5d73b86d6 feat: change owner name using account form (#11683) 2024-01-18 12:32:01 +01:00
Muhammad Atif Ali 1ea70ba573 ci: build a multi-arch image on each commit to main (#11544) 2024-01-18 10:57:35 +00:00
Spike Curtis 8910ac715c feat: add tailnet v2 support to wsproxy coordinate endpoint (#11637)
wsproxy also needs to be updated to use tailnet v2 because the `tailnet.Conn` stores peers by ID, and the peerID was not being carried by the JSON protocol.  This adds a query param to the endpoint to conditionally switch to the new protocol.
2024-01-18 10:10:36 +04:00
Spike Curtis 07427e06f7 chore: add setBlockEndpoints to nodeUpdater (#11636)
nodeUpdater also needs block endpoints, so that it can stop sending nodes with endpoints.
2024-01-18 10:02:15 +04:00
Spike Curtis 5b4de667d6 chore: add setCallback to nodeUpdater (#11635)
we need to be able to (re-)set the node callback when we lose and regain connection to a coordinator over the network.
2024-01-18 09:51:09 +04:00
Spike Curtis e725f9d7d4 chore: stop passing addresses on configMaps constructor (#11634)
moving this out of the constructor so that setting this when creating a new `tailnet.Conn` triggers configuring the engine.
2024-01-18 09:43:28 +04:00
Spike Curtis a514df71ed chore: add setDERPMap to configMaps (#11590)
Add setDERPMap
2024-01-18 09:34:30 +04:00
Spike Curtis 25e289e1f6 chore: add setAddresses to nodeUpdater (#11571)
Adds setAddresses to nodeUpdater
2024-01-18 09:24:16 +04:00
Spike Curtis 387723a596 fix: close pg PubSub listener to avoid race (#11640)
Fixes flake as seen here: https://github.com/coder/coder/runs/20528529187
2024-01-18 09:18:59 +04:00
Asher 72d9ec07aa fix: detect JetBrains running on local ipv6 (#11676) 2024-01-17 14:08:15 -09:00
Jon Ayers 552e9fe22f fix: avoid returning 500 on apps when workspace stopped (#11656) 2024-01-17 12:06:59 -06:00
Bruno Quaresma 1be119b08f fix(site): fix search menu for creating workspace and templates filter (#11674) 2024-01-17 17:54:56 +00:00
Steven Masley b246f08d84 chore: move app URL parsing to its own package (#11651)
* chore: move app url parsing to it's own package
2024-01-17 10:41:42 -06:00
Bruno Quaresma 1aee8da4b6 fix(site): fix sidebar scroll (#11671) 2024-01-17 16:05:05 +00:00
dependabot[bot] fa6176c2ff chore: bump github.com/u-root/u-root from 0.11.0 to 0.12.0 (#11625)
* chore: bump github.com/u-root/u-root from 0.11.0 to 0.12.0

Bumps [github.com/u-root/u-root](https://github.com/u-root/u-root) from 0.11.0 to 0.12.0.
- [Release notes](https://github.com/u-root/u-root/releases)
- [Changelog](https://github.com/u-root/u-root/blob/main/RELEASES)
- [Commits](https://github.com/u-root/u-root/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: github.com/u-root/u-root
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* `go mod tidy`

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-01-18 01:36:47 +10:00
Marcin Tojek e83f13d8c5 fix: typo in whitespace (#11667) 2024-01-17 12:36:15 +00:00
Marcin Tojek 5eb3e1cdaa feat: expose owner_name in coder_workspace resource (#11639) 2024-01-17 13:20:45 +01:00
Spike Curtis b173195e0d Revert "fix: detect JetBrains running on local ipv6 (#11653)" (#11664)
This reverts commit 2d61d5332a.
2024-01-17 15:38:39 +04:00
Spike Curtis 2aa3cbbd03 chore: add logging to nodeUpdater (#11569)
Add debug logging for nodeUpdater and configMaps
2024-01-17 14:15:45 +04:00
Spike Curtis bad2ce562e fix: stop asserting fuzz bytes written in test
Fixes a flake seen here: https://github.com/coder/coder/actions/runs/7541558190/job/20528545916

```
=== FAIL: enterprise/provisionerd TestRemoteConnector_Fuzz (0.06s)
    t.go:84: 2024-01-16 12:32:27.024 [info]  connector: failed provisioner authentication  remote_addr=[::1]:45138 ...
        error= failed to receive jobID:
                   github.com/coder/coder/v2/enterprise/provisionerd.(*remoteConnector).authenticate
                       /home/runner/actions-runner/_work/coder/coder/enterprise/provisionerd/remoteprovisioners.go:438
                 - bufio.Scanner: token too long
    t.go:84: 2024-01-16 12:32:27.024 [debu]  connector: closed connection  remote_addr=[::1]:45138  error=<nil>
    remoteprovisioners_test.go:209: 
            Error Trace:    /home/runner/actions-runner/_work/coder/coder/enterprise/provisionerd/remoteprovisioners_test.go:209
            Error:          "2992256" is not less than "2097152"
            Test:           TestRemoteConnector_Fuzz
            Messages:       should not allow more than 1 MiB
```

This was an attempt to test that malicious actors can't abuse our authentication protocol to make us allocate a bunch of memory.
However, the test asserted on the number of bytes sent by the fuzzer, not the number of bytes read (& allocated) by the service.  The former is affected by network queue sizes and is thus flaky without actively managing the socket queues, which I don't think we want to do.

In actual practise, the thing that matters is how much memory the bufio Scanner allocates. By inspection, the scanner will allocate up to 64k, and testing this is true devolves into testing the go standard library, which I don't think is worth doing.

So... let's just drop the assertion because 

a) its flaky, 

b) it doesn't test what we actually want to test, 

c) the behavior we actually care about is part of the standard library.
2024-01-17 12:59:45 +04:00
Spike Curtis 38d9ce5267 chore: add setStatus support to nodeUpdater (#11568)
Add support for the wgengine Status callback to nodeUpdater
2024-01-17 09:06:34 +04:00
Spike Curtis f6dc707511 chore: add DERPForcedWebsocket to nodeUpdater (#11567)
Add support for DERPForcedWebsocket to nodeUpdater
2024-01-17 08:55:45 +04:00
Asher 2d61d5332a fix: detect JetBrains running on local ipv6 (#11653) 2024-01-16 15:53:41 -09:00
Colin Adler be43d6247d feat: add additional fields to first time setup trial flow (#11533)
* feat: add additional fields to first time setup trial flow

* trial generator typo
2024-01-16 18:19:16 -06:00
Jon Ayers 1196f83ebd feat: automatically activate dormant workspaces when manually started (#11655) 2024-01-16 16:42:04 -06:00
Stephen Kirby d74aae7a4a removed alpha tags from workspace actions features in template settings (#11654) 2024-01-16 16:23:19 -06:00
Muhammad Atif Ali 417270a6d7 chore(docs): remove the template_update_policies experiment from docs (#11615) 2024-01-17 00:18:57 +03:00
Jon Ayers 6ebcee3b49 docs: add workspace cleanup docs (#11146)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
Co-authored-by: kirby <kirby@coder.com>
2024-01-16 15:12:56 -06:00
Mathias Fredriksson 385d58caf6 fix(agent/agentssh): allow remote forwarding a socket multiple times (#11631)
* fix(agent/agentssh): allow remote forwarding a socket multiple times

Fixes #11198
Fixes https://github.com/coder/customers/issues/407
2024-01-16 21:26:13 +02:00
Steven Masley 08b4eb3124 fix: refresh all oauth links on external auth page (#11646)
* fix: refresh all oauth links on external auth page
2024-01-16 11:03:55 -06:00
Cian Johnston d583acad00 fix(coderd): workspaceapps: update last_used_at when workspace app reports stats (#11603)
- Adds a new query BatchUpdateLastUsedAt
- Adds calls to BatchUpdateLastUsedAt in app stats handler upon flush
- Passes a stats flush channel to apptest setup scaffolding and updates unit tests to assert modifications to LastUsedAt.
2024-01-16 14:06:39 +00:00
Muhammad Atif Ali 5bfbf9f9e6 chore(docs/install/docker.md): shorten headings length (#11630) 2024-01-16 07:19:58 +00:00
Steven Masley 5087f7b5f6 chore: improve fake IDP script (#11602)
* chore: testIDP using static defaults for easier reuse
2024-01-15 10:01:41 -06:00
Marcin Tojek f915bdf26c feat: support links with custom icons (#11629) 2024-01-15 16:56:01 +01:00
dependabot[bot] 5c310ec334 chore: bump github.com/prometheus/common from 0.45.0 to 0.46.0 (#11618)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 18:19:16 +03:00
dependabot[bot] 288f879f72 ci: bump the github-actions group with 1 update (#11616)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 14:48:19 +00:00
dependabot[bot] af013fc3a1 chore: bump github.com/go-playground/validator/v10 from 10.16.0 to 10.17.0 (#11626)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 17:45:49 +03:00
dependabot[bot] 476d72e63d chore: bump github.com/andybalholm/brotli from 1.0.6 to 1.1.0 (#11621)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 17:44:48 +03:00
dependabot[bot] ecefb8c0c1 chore: bump golang.org/x/tools from 0.16.1 to 0.17.0 (#11622)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 17:44:17 +03:00
Cian Johnston 244ca88645 ci: set CODER_VERBOSE=true for fly.io wsproxies (#11405) 2024-01-15 13:14:38 +00:00
dependabot[bot] 054420bb33 chore: bump github.com/go-logr/logr from 1.3.0 to 1.4.1 (#11475)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 14:08:28 +03:00
sharkymark f65b2efb95 chore: replace remote with cloud when referencing development environments; add Slack as an enterprise option for community sharing (#11375) 2024-01-15 05:31:35 -05:00
Eric Paulsen c799f0ff43 docs: add steps to configure supportLinks in Helm chart (#11612) 2024-01-15 05:29:59 -05:00
Eric Paulsen e1493b220a fix: guide naming (#11613) 2024-01-15 05:29:43 -05:00
Muhammad Atif Ali 8b10d21a70 chore(docs): fix a minor punctuation error (#11610) 2024-01-14 08:03:07 +00:00
Eric Paulsen e70a97a722 docs: add guide for template ImagePullSecret (#11608)
* docs: add guide for template imagepullsecret

* add: manifest

* make: fmt
2024-01-12 18:44:26 -06:00
Kayla Washburn-Love 4c3f05b8aa fix: show error when creating a new group fails (#11560) 2024-01-12 16:06:02 -07:00
Steven Masley 905292053a fix: improve wsproxy error when proxyurl is set to a primary (#11586)
* coder error first
2024-01-12 20:32:02 +00:00
Steven Masley 03ee63931c chore: remove duplicate validate calls on same oauth token (#11598)
* chore: remove duplicate validate calls on same oauth token
2024-01-12 14:27:22 -06:00
Bruno Quaresma 8181c9f349 refactor(site): make cosmetic changes on agent logs (#11601) 2024-01-12 17:09:36 -03:00
Bruno Quaresma 68e5a51d90 feat(site): display builds logs by default (#11597) 2024-01-12 16:39:23 -03:00
Bruno Quaresma ec166cf423 fix(site): remove search menu vertical padding (#11599) 2024-01-12 19:33:21 +00:00
Bruno Quaresma f3edc42b76 fix(site): fix workspace resource width on ultra wide screens (#11596) 2024-01-12 16:09:12 -03:00
Bruno Quaresma 130d5d68a0 refactor(site): refactor workspace notifications (#11520) 2024-01-12 15:55:31 -03:00
Stephen Kirby bdefd4e2e6 chore: convert faq headers to dropdowns (#11585)
* changed FAQs from headers to twists

* added dropdowns and mild formatting

* make fmt
2024-01-12 12:49:41 -06:00
Bruno Quaresma 162c91ec2a fix(site): fix resource selection when workspace has no prev resources (#11594) 2024-01-12 15:45:06 -03:00
Marcin Tojek cb77f04104 feat: load variables from tfvars files (#11549) 2024-01-12 15:08:23 +01:00
Bruno Quaresma aeb1ab8ad8 fix(site): fix resource selection when workspace resources change (#11581) 2024-01-12 10:14:31 -03:00
Cian Johnston 0e96115d5d fix(coderd): correctly show warning when no provisioner daemons are registered (#11591) 2024-01-12 11:22:59 +00:00
Steven Masley f5a9f5ca3d chore: handle errors in wsproxy server for cli using buildinfo (#11584)
Cli errors are pretty formatted. This handles nested pretty types. Before it found the first error it could understand and return that. Now it will print the full error stack with more information.

To prevent information loss, a "[Trace=...]" was added to capture some extra error context for debugging.
2024-01-11 16:55:34 -06:00
Jon Ayers aecdafdcf2 fix: fix template edit overriding with flag defaults (#11564) 2024-01-11 16:18:46 -06:00
Kayla Washburn-Love eb8d85f432 feat: treat deprecation messages as markdown (#11562) 2024-01-11 14:15:29 -07:00
Cian Johnston 95fd0bb22b feat(site): remove experiment deployment_health_page (#11572) 2024-01-11 21:03:10 +00:00
Cian Johnston 26f5ce63a8 feat(site): add docs links on health page (#11582)
* feat(site): add docs links on health page

* apply suggestions
2024-01-11 20:32:25 +00:00
Garrett Delfosse 5b122d108e fix: publish workspace update on quota failure (#11559) 2024-01-11 14:59:40 -05:00
Kayla Washburn-Love 05eac64be4 feat: add a character counter for fields with length limits (#11558)
- refactors`getFormHelpers` to accept an options object
- adds a `maxLength` option which will display a message and character counter for fields with length limits
- set `maxLength` option for template description fields
2024-01-11 12:15:43 -07:00
Garrett Delfosse f9f94b5d01 fix: remove cancel button if user cannot cancel job (#11553) 2024-01-11 13:48:44 -05:00
Kayla Washburn-Love 8c3a4f2d7f chore: move some components into pages/ (#11536) 2024-01-11 11:30:15 -07:00
Steven Masley e3ad9580e9 chore: allow running fake idp with coderd dev (#11555)
* chore: allow running fake idp with coderd dev
2024-01-11 18:10:57 +00:00
sharkymark c91b885a4a chore: add optional coder_app to faq (#11351)
Merging since Mark is out.

* chore: add optional coder_app to faq

* applied Atif's suggestions

* make fmt again

---------

Co-authored-by: kirby <kirby@coder.com>
Co-authored-by: Stephen Kirby <58410745+stirby@users.noreply.github.com>
2024-01-11 12:07:22 -06:00
Steven Masley fcd299109c chore: update language about autostop on templates page (#11552)
* chore: update language about autostop on templates page
2024-01-11 12:01:07 -06:00
Steven Masley 8b61ff3e0e fix: apply appropriate artifactory defaults for external auth (#11580) 2024-01-11 11:58:27 -06:00
Cian Johnston f3d091fa01 fix(site): improve rendering of provisioner tags (#11575)
* fix(site): improve rendering of provisioner tags

* fixup! fix(site): improve rendering of provisioner tags

* Update site/src/pages/HealthPage/ProvisionerDaemonsPage.tsx

* fixup! Update site/src/pages/HealthPage/ProvisionerDaemonsPage.tsx
2024-01-11 17:42:21 +00:00
Colin Adler 4a0808259a fix: ensure wsproxy MultiAgent is closed when websocket dies (#11414)
The `SingleTailnet` behavior only checked to see if the `MultiAgent` was
closed, but the websocket error was not being propogated into the
`MultiAgent`, causing it to never be swapped for a new working one.

Fixes https://github.com/coder/coder/issues/11401

Before:
```
Coder Workspace Proxy v0.0.0-devel+85ff030 - Your Self-Hosted Remote Development Platform
Started HTTP listener at http://0.0.0.0:3001

View the Web UI: http://127.0.0.1:3001

==> Logs will stream in below (press ctrl+c to gracefully exit):
2024-01-04 20:11:56.376 [warn]  net.workspace-proxy.servertailnet: broadcast server node to agents ...
    error= write message:
               github.com/coder/coder/v2/enterprise/wsproxy/wsproxysdk.(*remoteMultiAgentHandler).writeJSON
                   /home/coder/coder/enterprise/wsproxy/wsproxysdk/wsproxysdk.go:524
             - failed to write msg: WebSocket closed: failed to read frame header: EOF
```

After:
```
Coder Workspace Proxy v0.0.0-devel+12f1878 - Your Self-Hosted Remote Development Platform
Started HTTP listener at http://0.0.0.0:3001

View the Web UI: http://127.0.0.1:3001

==> Logs will stream in below (press ctrl+c to gracefully exit):
2024-01-04 20:26:38.545 [warn]  net.workspace-proxy.servertailnet: multiagent closed, reinitializing
2024-01-04 20:26:38.546 [erro]  net.workspace-proxy.servertailnet: reinit multi agent ...
    error= dial coordinate websocket:
               github.com/coder/coder/v2/enterprise/wsproxy/wsproxysdk.(*Client).DialCoordinator
                   /home/coder/coder/enterprise/wsproxy/wsproxysdk/wsproxysdk.go:454
             - failed to WebSocket dial: failed to send handshake request: Get "http://127.0.0.1:3000/api/v2/workspaceproxies/me/coordinate": dial tcp 127.0.0.1:3000: connect: connection refused
2024-01-04 20:26:38.587 [erro]  net.workspace-proxy.servertailnet: reinit multi agent ...
    error= dial coordinate websocket:
               github.com/coder/coder/v2/enterprise/wsproxy/wsproxysdk.(*Client).DialCoordinator
                   /home/coder/coder/enterprise/wsproxy/wsproxysdk/wsproxysdk.go:454
             - failed to WebSocket dial: failed to send handshake request: Get "http://127.0.0.1:3000/api/v2/workspaceproxies/me/coordinate": dial tcp 127.0.0.1:3000: connect: connection refusedhandshake request: Get "http://127.0.0.1:3000/api/v2/workspaceproxies/me/coordinate": dial tcp 127.0.0.1:3000: connect: connection refused
2024-01-04 20:26:40.446 [info]  net.workspace-proxy.servertailnet: successfully reinitialized multiagent  agents=0  took=1.900892615s
```
2024-01-11 11:37:09 -06:00
Bruno Quaresma d708ac7c04 fix(site): remove refetch on windows focus (#11574)
It causes the sign-in page to reload whenever a user enters a page or changes the window's focus. This is happening because when the "user" fetch is made, the server returns an error, making the react-query mark the data as stale and try to load it whenever possible.
2024-01-11 11:06:36 -03:00
Bruno Quaresma 3695b74ab6 fix(site): fix loading indicator alignment (#11573) 2024-01-11 10:53:36 -03:00
Cian Johnston 8a12ee7831 fix(site): show wsproxy errors in context in WorkspaceProxyPage (#11556)
* Shows the overall report error at the top of the page, if present.
* Shows workspaceproxy errors above warnings inside the corresponding element, if present.
* Improves unregistered proxy status
2024-01-11 10:47:02 +00:00
Spike Curtis 8701dbc874 chore: add nodeUpdater to tailnet (#11539)
Adds a nodeUpdater component, which serves a similar role to configMaps, but tracks information from tailscale going out to the coordinator as node updates.  This first PR just handles netInfo, subsequent PRs will
handle DERP forced websockets, endpoints, and addresses.
2024-01-11 09:29:42 +04:00
Spike Curtis 7005fb1b2f chore: add support for blockEndpoints to configMaps (#11512)
Adds support for setting blockEndpoints on the configMaps
2024-01-11 09:18:31 +04:00
Spike Curtis 617ecbfb1f chore: add support for peer updates to tailnet.configMaps (#11487)
Adds support to configMaps to handle peer updates including lost and disconnected peers
2024-01-11 09:11:43 +04:00
bamhm182 4e5367c4a4 chore: update Digital Ocean example template (#11528) (#11535)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-01-11 00:00:25 +00:00
Jon Ayers 9b437032e9 feat: remove workspace_actions experiment (#11427) 2024-01-10 16:19:39 -06:00
Steven Masley 04afb88e6f fix: return a more sophisticated error for device failure on 429 (#11554)
* fix: return a more sophisticated error for device failure on 429
2024-01-10 11:29:44 -06:00
Mathias Fredriksson b1d53a68c2 fix(agent/agentssh): fix X11 forwarding by improving Xauthority management (#11550)
Fixes #11531
2024-01-10 19:04:44 +02:00
Steven Masley 89ab659114 chore: add oauth2 prometheus metrics for to documentation (#11534) 2024-01-10 15:46:37 +00:00
Steven Masley 3f9da674c6 chore: instrument github oauth2 limits (#11532)
* chore: instrument github oauth2 limits

Rate limit information for github oauth2 providers instrumented in prometheus
2024-01-10 15:29:33 +00:00
Steven Masley 50b78e3325 chore: instrument external oauth2 requests (#11519)
* chore: instrument external oauth2 requests

External requests made by oauth2 configs are now instrumented into prometheus metrics.
2024-01-10 09:13:30 -06:00
Garrett Delfosse aa7fe075a8 fix: correct flag name (#11525) 2024-01-10 09:36:26 -05:00
Garrett Delfosse 0727535342 fix: correct app url format in comment (#11523) 2024-01-10 09:36:10 -05:00
Muhammad Atif Ali 6e5c2efca1 chore(docs): remove provider logos from 1-click install (#11548)
* docs: remove cloud logos from 1-click install

They were looking good and are not adding much value.

* Delete docs/images/install/render.png

* Delete docs/images/install/ec2.svg

* Delete docs/images/install/eks.svg

* Delete docs/images/install/fly.io.svg

* Delete docs/images/install/gce.svg

* Delete docs/images/install/heroku.svg

* Delete docs/images/install/railway.svg
2024-01-10 13:28:40 +00:00
Spike Curtis cae095fdb6 fix: stop logging errors on canceled cleanup queries (#11547)
Fixes flake seen here: https://github.com/coder/coder/actions/runs/7474259128/job/20340051975
2024-01-10 16:20:29 +04:00
Muhammad Atif Ali 9682db593e chore(docs): reorganize installation docs (#11465) 2024-01-10 15:00:19 +03:00
Spike Curtis dfe8efc186 fix: use background context for inmem provisionerd (#11545)
This test case fails with an error log, showing "context canceled" when trying to send an acquired job to an in-mem provisionerd.

https://github.com/coder/coder/runs/20331469006

In this case, we don't want to supress this error, since it could mean that we acquired a job, locked it in the database, then failed to send it to a provisioner.
(We also don't want to mark the job as failed because we don't know whether the job made it to the provisionerd or not --- in the failed test you can see that the job is actually processed just fine).

The reason we got context canceled is because the API was shutting down --- we don't want provisionerdserver to abruptly stop processing job stuff as the API shuts down as this will leave jobs in a bad state.  This PR fixes up the use of contexts with provisionerdserver and the associated drpc service calls.
2024-01-10 15:29:57 +04:00
Muhammad Atif Ali c125206b24 docs(faqs): add FAQ regarding unsupported base image for VS Code Server (#11543) 2024-01-10 12:16:44 +03:00
Cian Johnston 5ecb0db4f2 chore(coderd): fix test flake in TestAgentWebsocketMonitor_SendPings (#11518) 2024-01-10 08:45:46 +00:00
Cian Johnston 5ed3c413cd chore(coderd): fix test flake in TestWorkspaceUpdateAutomaticUpdates_OK (#11521) 2024-01-10 08:45:32 +00:00
dependabot[bot] 61cd9f087b chore: bump follow-redirects from 1.15.2 to 1.15.4 in /site (#11540)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-10 10:30:05 +03:00
Spike Curtis 89e3bbe0f5 chore: add configMaps component to tailnet (#11400)
Work in progress on a subcomponent of the Conn which will handle configuring the wireguard engine on changes.  I've implemented setAddresses as the simplest case and added unit tests of the reconfiguration loop.

Besides making the code easier to test and understand, the goal is for this component to handle disconnect and loss updates about peers, and thereby, implement the v2 Tailnet API.

Further PRs will handle peer updates, status updates, and net info updates.

Then, after the subcomponent is implemented and tested, I will refactor Conn to use it instead of the current monolithic architecture.
2024-01-10 10:58:53 +04:00
Asher d837d66e29 chore: update sqlc to 1.25.0 (#11538)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-01-10 09:19:41 +03:00
Asher 0912cfc2d6 chore: update flake to include new mockgen (#11537)
It looks like we updated mockgen to use Uber's fork, but the flake still
pointed to a nixos-unstable commit containing the old mockgen resulting 
in an error like:

missing go.sum entry for module providing package github.com/golang/mock/mockgen/model
2024-01-09 15:37:51 -09:00
Kayla Washburn 97bd74b468 chore: add additional stories to storybook (#11524)
add stories for ActiveUserChart, CopyableValue, and CopyButton
2024-01-09 14:03:40 -07:00
Kayla Washburn 8a48485014 refactor: clean up Welcome component (#11526) 2024-01-09 14:03:33 -07:00
Garrett Delfosse 4fa07124cd feat: display application name over sign in form (#11500) 2024-01-09 12:51:16 -05:00
Garrett Delfosse 30d5ac060b fix: carry tags to new templateversions (#11502) 2024-01-09 12:47:44 -05:00
Cian Johnston 952706e905 fix(site): HealthPage/WorkspaceProxyPage: adjust border colour for unhealthy regions (#11516) 2024-01-09 17:36:41 +00:00
Kayla Washburn e77b1a5ffd chore: miscellaneous cleanup (#11027) 2024-01-09 10:14:19 -07:00
Cian Johnston 9f4f953350 fix(coderd/healthcheck): ignore deleted wsproxies in wsproxy healthcheck (#11515) 2024-01-09 16:36:26 +00:00
Marcin Tojek e5b9d63901 docs: escape enum pipe (#11513) 2024-01-09 13:39:38 +00:00
Marcin Tojek 525e6e5dc8 docs: remove empty page (#11511) 2024-01-09 12:52:45 +01:00
Marcin Tojek b8373e6fab fix: nix: force node version v18 (#11510) 2024-01-09 12:27:56 +01:00
Spike Curtis fdd60d316e fix: fix MetricsAggregator check for metric sameness (#11508)
Fixes #11451

A refactor of the Agent API passes metrics as protobufs, which include pointers to label name/value pairs.  The aggregator tested for sameness by doing a shallow compare of label values, which for different stats reports would compare unequal because the pointers would be different.

This fix does a deep compare.

While testing I also noted that we neglect to compare template names. This is unlikely to have caused any issue in practice, since the combination of username/workspace is unique, but in the context of comparing metric labels we should do the comparison.

If a user creates a workspace, deletes it, then recreates from a different template, we could in principle have reported incorrect stats for the old template.
2024-01-09 15:21:30 +04:00
Spike Curtis 21093c00f0 fix: stop logging error on canceled query (#11506)
Fixes flake seen here: https://github.com/coder/coder/actions/runs/7447779208/job/20260756050
2024-01-09 14:38:56 +04:00
Cian Johnston 0c953b4b8c fix(enterprise/coderd): make primary workspace proxy always be updatd now (#11499) 2024-01-09 10:03:08 +00:00
Steven Masley fb29af664b fix: relax csrf to exclude path based apps (#11430)
* fix: relax csrf to exclude path based apps
* add unit test to verify path based apps are not CSRF blocked
2024-01-08 22:33:57 +00:00
Kayla Washburn 9f5a59d5c5 feat(site): improve icon compatibility across themes (#11457) 2024-01-08 14:12:40 -07:00
Garrett Delfosse 427afe13e0 fix: generate new random username to prevent flake (#11501) 2024-01-08 19:09:14 +00:00
Cian Johnston 220e95dd5c feat(site): add healthcheck page for provisioner daemons (#11494)
Part of #10676

- Adds a health section for provisioner daemons (mostly cannibalized from the Workspace Proxy section)
- Adds a corresponding storybook entry for provisioner daemons health section
- Fixed an issue where dismissing the provisioner daemons warnings would result in a 500 error
- Adds provisioner daemon error codes to docs
2024-01-08 17:14:09 +00:00
dependabot[bot] 6096af77c8 chore: bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 (#11495)
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.3 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.3...v1.3.7)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 20:10:59 +03:00
Bruno Quaresma a613a0a4da refactor(site): improve settings option (#11489) 2024-01-08 13:16:16 -03:00
Bruno Quaresma 61450863ff feat(site): move resources into the sidebar (#11456) 2024-01-08 13:14:25 -03:00
dependabot[bot] 359a642e7e chore: bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 (#11474)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 17:07:56 +03:00
Cian Johnston 93cf5dcd47 fix(coderd/healthcheck): add daemon-specific warnings to healthcheck output (#11490)
- Sorts provisioner daemons by name ascending in output
- Adds daemon-specific warnings to healthcheck output
- Reword some messages
2024-01-08 13:55:00 +00:00
dependabot[bot] f4393d0c3f chore: bump github.com/hashicorp/terraform-json from 0.18.0 to 0.20.0 (#11483)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 13:20:14 +00:00
Bruno Quaresma 0186241880 fix(site): display github login config (#11488) 2024-01-08 10:17:09 -03:00
dependabot[bot] efb1ee31c0 chore: bump github.com/unrolled/secure from 1.13.0 to 1.14.0 (#11476)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 16:15:53 +03:00
dependabot[bot] 4c7a93dd7e chore: bump github.com/coreos/go-oidc/v3 from 3.7.0 to 3.9.0 (#11479)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 15:32:05 +03:00
dependabot[bot] a6c746e4e0 chore: bump github.com/aws/smithy-go from 1.17.0 to 1.19.0 (#11484)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 15:31:43 +03:00
dependabot[bot] 2c9589d883 chore: bump github.com/google/uuid from 1.4.0 to 1.5.0 (#11485)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 15:31:23 +03:00
dependabot[bot] 58f5f324b0 chore: bump github.com/gohugoio/hugo from 0.120.3 to 0.121.2 (#11473)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 15:31:09 +03:00
Muhammad Atif Ali acec1f7716 chore: increase dependabot PRs limit for go (#11472) 2024-01-08 14:54:28 +03:00
dependabot[bot] 5337a70561 chore: bump google.golang.org/protobuf from 1.31.0 to 1.32.0 (#11468)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 13:43:33 +03:00
Cian Johnston 04fd96a014 feat(coderd): add provisioner_daemons to /debug/health endpoint (#11393)
Adds a healthcheck for provisioner daemons to /debug/health endpoint.
2024-01-08 09:29:04 +00:00
Michael Smith 31f8fac1b9 fix: make ProxyMenu more accessible to screen readers (#11312)
* wip: commit progress on latency update

* chore: add stories and clean up tests

* refactor: clean up code

* fix: make sure headers aren't treated as interactive elements

* refactor: clean up tests

* fix: clean up stories

* docs: add clarifying comment

* fix: update stories again

* fix: clean up/extend prop definitions

* refactor: quick cleanup

* fix: apply Kira's feedback

* refactor: clean up abbr markup to account for pronunciation

* fix: more cleanup

* fix: refine screen reader output for VoiceOver

* refactor: clean up and redefine tests

* feature: add finishing touches
2024-01-07 18:37:01 -05:00
dependabot[bot] 8a9fe2bf00 chore: bump golang.org/x/term from 0.15.0 to 0.16.0 (#11463)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.15.0 to 0.16.0.
- [Commits](https://github.com/golang/term/compare/v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 12:28:39 +00:00
dependabot[bot] 64f239c844 chore: bump github.com/go-chi/httprate from 0.7.4 to 0.8.0 (#11461)
Bumps [github.com/go-chi/httprate](https://github.com/go-chi/httprate) from 0.7.4 to 0.8.0.
- [Commits](https://github.com/go-chi/httprate/compare/v0.7.4...v0.8.0)

---
updated-dependencies:
- dependency-name: github.com/go-chi/httprate
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 12:27:29 +00:00
dependabot[bot] ceb0ec43ad chore: bump google.golang.org/grpc from 1.59.0 to 1.60.1 (#11444)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.59.0 to 1.60.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.59.0...v1.60.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-07 12:18:00 +00:00
Muhammad Atif Ali a2f86e5e5e chore(dogfood): install corepack (#11459) 2024-01-06 03:11:16 +03:00
Muhammad Atif Ali 965b1e69e2 ci: add variable to template push in dogfood.yaml (#11458) 2024-01-05 21:35:49 +00:00
Garrett Delfosse b21da38bea chore: deprecate template create command in favor of template push (#11390) 2024-01-05 21:04:14 +00:00
Garrett Delfosse 3d54bc06f6 feat: display current version on coder list (#11450)
* feat: display current version on coder list

* fix make gen

* update golden
2024-01-05 15:33:08 -05:00
Muhammad Atif Ali 31f7b39513 chore(dogfood): update dogfood template to use artifactory (#11452)
* chore(dogfood): update to use artifactory

* Update main.tf
2024-01-05 23:25:51 +03:00
Steven Masley da7859c445 chore: change language on autostop (#11454)
* chore: change language on autostop
2024-01-05 11:40:25 -06:00
Bruno Quaresma c428395d71 feat(site): move history into sidebar (#11413) 2024-01-05 13:32:05 -03:00
Steven Masley f0132b543d fix: fix workspace proxy command app link href (#11423)
* fix: workspace proxy command app link href
2024-01-05 10:27:06 -06:00
dependabot[bot] 46b90ce898 chore: bump github.com/golang-migrate/migrate/v4 from 4.16.0 to 4.17.0 (#11446)
Bumps [github.com/golang-migrate/migrate/v4](https://github.com/golang-migrate/migrate) from 4.16.0 to 4.17.0.
- [Release notes](https://github.com/golang-migrate/migrate/releases)
- [Changelog](https://github.com/golang-migrate/migrate/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang-migrate/migrate/compare/v4.16.0...v4.17.0)

---
updated-dependencies:
- dependency-name: github.com/golang-migrate/migrate/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-05 09:42:53 -06:00
dependabot[bot] f3efa0803b ci: bump the github-actions group with 3 updates (#11447)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-05 14:11:09 +00:00
dependabot[bot] 45e989a519 chore: bump golang.org/x/sync from 0.5.0 to 0.6.0 (#11445)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-05 17:09:11 +03:00
dependabot[bot] bf00e61f10 chore: bump github.com/jedib0t/go-pretty/v6 from 6.4.0 to 6.5.0 (#11442)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-05 16:51:19 +03:00
Muhammad Atif Ali 118ab7d4de ci: ungroup go dependencies (#11441) 2024-01-05 13:40:10 +00:00
Bruno Quaresma 9389c2b283 refactor(site): only show derp tags if they are true (#11439) 2024-01-05 09:45:34 -03:00
Cian Johnston 4d2fe2685a chore(coderd): extract api version validation to util package (#11407) 2024-01-05 10:22:07 +00:00
Spike Curtis 58873fa7e2 chore: remove unused context/cancel in tailnet Conn (#11399)
Spotted during code read; unused fields
2024-01-05 08:15:42 +04:00
Spike Curtis 64638b381d feat: promote PG Coordinator out of experimental (#11398)
Promotes PG Coordinator out of experimental to GA
2024-01-05 08:03:36 +04:00
Eric Paulsen e816dc0e60 fix: gcp federation guide formatting (#11432) 2024-01-05 03:31:05 +00:00
Eric Paulsen 138d31621f docs: add guide for Google to AWS federation (#11429)
* feat: add docs for Google to AWS federation

* make: fmt
2024-01-04 20:13:29 -05:00
Steven Masley dd05a6b13a chore: mockgen archived, moved to new location (#11415)
* chore: mockgen archived, moved to new location
2024-01-04 18:35:56 -06:00
dependabot[bot] bb3510631b chore: bump the offlinedocs group in /offlinedocs with 1 update (#11428)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-05 02:03:26 +03:00
Steven Masley c6366e5b73 chore: prevent nil derefs in non-critical paths (#11411)
* chore: prevent nil derefs in non-critical paths

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-01-04 14:51:48 -06:00
Steven Masley 85ff030ab4 chore: update LastConnectedReplicaID in dbmem (#11412) 2024-01-04 19:18:54 +00:00
Cian Johnston 4f433e7f3d ci: broaden scope of needs.changes.db (#11386)
* Broadens scope of needs.changes.db to include anything under the path coderd/database.
* Removes dependency of test-go-pg on sqlc-vet.
2024-01-04 16:24:54 +00:00
Garrett Delfosse 5981abd689 fix: handle unescaped userinfo in postgres url (#11396)
* fix: handle unescaped userinfo in postgres url

* add tests

* fix tests
2024-01-04 08:46:00 -05:00
Muhammad Atif Ali f0db302df2 chore: add lxc logo (#11404) 2024-01-04 16:31:16 +03:00
Cian Johnston 4355894b2b fix(coderd/database): revert addition of v prefix to provisioner_daemons.api_version (#11403)
"Reverts" #11385 by adding an inverse migration.
2024-01-04 11:47:31 +00:00
Spike Curtis f9ebe8c719 fix: send end of logs when dbfake completes job (#11402) 2024-01-04 15:18:00 +04:00
Spike Curtis 48cd4c3a10 feat: promote single-tailnet out of experimental (#11366) 2024-01-04 09:27:36 +04:00
Kayla Washburn ffa7722c31 feat: select group avatars with the emoji picker (#11395) 2024-01-03 15:47:24 -07:00
Ben Potter ee2daedae0 chore: template update policies are GA (#11397) 2024-01-03 15:49:29 -06:00
Dean Sheather 06f519d7f1 docs: add template autostop requirement docs (#11235)
* chore: template autostop requirement docs

* fixup! chore: template autostop requirement docs

* fixes from feedback.

* fmt

---------

Co-authored-by: Ben <me@bpmct.net>
2024-01-03 14:25:25 -06:00
Kyle Carberry 30afe43f8a fix: create tempdir prior to cleanup (#11394)
See https://github.com/coder/coder/actions/runs/7399827933/job/20132407700

Seems like this happened because the test was being cleaned up
while the tempdir was being made.
2024-01-03 19:18:15 +00:00
Bruno Quaresma 4edd21ae9e fix(site): fix loading spinner on template version status badge (#11392) 2024-01-03 16:29:04 +00:00
Bruno Quaresma f5196c06e1 fix(site): fix insights picker and disable animation (#11391) 2024-01-03 16:25:01 +00:00
Cian Johnston f80a1cf3c8 fix(coderd/database): add missing v prefix to provisioner_daemons.api_version (#11385) 2024-01-03 14:11:02 +00:00
Cian Johnston 068e730046 chore(coderd/database/dbfake): fix pq test flake in TestStart_Starting (#11384) 2024-01-03 12:27:50 +00:00
Bruno Quaresma d74e7ca20f docs: update FE fetching data docs (#11376) 2024-01-03 12:27:33 +00:00
Spike Curtis 5d76210b0d fix: change coder start to be a no-op if workspace is started
Fixes #11380
2024-01-03 13:24:37 +04:00
Cian Johnston 1ef96022b0 feat(coderd): add provisioner build version and api_version on serve (#11369)
* assert provisioner daemon version and api_version in unit tests
* add build info in HTTP header, extract codersdk.BuildVersionHeader
* add api_version to codersdk.ProvisionerDaemon
* testutil.MustString -> testutil.MustRandString
2024-01-03 09:01:57 +00:00
Muhammad Atif Ali 9031b498ea ci: use depot.dev to build dogfood image (#11378) 2024-01-02 23:27:37 +03:00
Garrett Delfosse 227234ded5 fix: correct wording on logo url field (#11377) 2024-01-02 14:53:18 -05:00
Bruno Quaresma ac899be74c chore(site): move workspace topbar component (#11374) 2024-01-02 16:02:11 -03:00
Mathias Fredriksson df3c310379 feat(cli): add coder open vscode (#11191)
Fixes #7667
2024-01-02 20:46:18 +02:00
Bruno Quaresma 099be249a7 fix(site): fix external auth button loading state (#11373) 2024-01-02 18:30:05 +00:00
Kayla Washburn 6308a78365 chore: clean up light theme code (#11319) 2024-01-02 15:19:20 -03:00
Bruno Quaresma c37c0e7d1b refactor(site): simplify workspace topbar (#11370) 2024-01-02 15:17:42 -03:00
Bruno Quaresma 62a20e86fd chore(site): ignore deletion date on chromatic (#11372) 2024-01-02 18:17:24 +00:00
Bruno Quaresma a1341ee9ac fix(site): fix pill spinner size (#11368) 2024-01-02 15:05:20 -03:00
Bruno Quaresma 467a1a3e71 fix(site): fix workspace topbar back button (#11371) 2024-01-02 18:01:06 +00:00
Kayla Washburn a24c3b4dc7 chore: cleanup inline prop type definitions (#11317) 2024-01-02 10:39:00 -07:00
Bruno Quaresma cf17fabcc6 feat(site): refactor workspace header to be more slim (#11327) 2024-01-02 12:42:51 -03:00
Muhammad Atif Ali 608937c79c chore(site): update node to version 18.19.0 (#11344) 2024-01-02 12:41:24 +00:00
Bruno Quaresma 8717fdfc20 refactor(site): refactor pill component API (#11329)
Refactor the Pill API to make it easier to extend and reuse.
2024-01-02 09:28:51 -03:00
Spike Curtis c9b7d61769 chore: refactor agent connection updates (#11301)
Refactors the code that handles monitoring an agent websocket with pings and updating the connection times in the DB.

Consolidates v1 and v2 agent APIs under the same code for this.

One substantive change (not _just_ a refactor) is that I've made it so that we actually disconnect if the agent fails to respond to our pings, rather than the old behavior where we would update the database, but not actually tear down the websocket.
2024-01-02 16:04:37 +04:00
Spike Curtis 520c3a8ff7 fix: use TSMP for pings and checking reachability (#11306)
We're seeing some flaky tests related to agent connectivity - https://github.com/coder/coder/actions/runs/7286675441/job/19856270998

I'm pretty sure what happened in this one is that the client opened a connection while the wgengine was in the process of reconfiguring the wireguard device, so the fact that the peer became "active" as a result of traffic being sent was not noticed.

The test calls `AwaitReachable()` but this only tests the disco layer, so it doesn't wait for wireguard to come up.

I think we should be using TSMP for pinging and reachability, since this operates at the IP layer, and therefore requires that wireguard comes up before being successful.

This should also help with the problems we have seen where a TCP connection starts before wireguard is up and the initial round trip has to wait for the 5 second wireguard handshake retry.

fixes: #11294
2024-01-02 15:53:52 +04:00
Muhammad Atif Ali 58e40f6cd6 chore: update nfpm to v2.35.1 (#11310) 2024-01-02 10:27:46 +00:00
Spike Curtis 4071f1713b feat: add logging to agent stats and JetBrains tracking (#11364)
Adds logging so we can hope to diagnose #11363
2024-01-02 13:34:49 +04:00
dependabot[bot] 893a8ea583 chore: bump golang.org/x/tools from 0.15.0 to 0.16.1 (#11357)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-02 12:26:45 +03:00
dependabot[bot] a439507c6a ci: bump the github-actions group with 1 update (#11355)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-02 12:26:29 +03:00
Steven Masley 8f49f10134 chore: put overrides and renames in pkg context in sqlc.yaml (#11347)
* chore: Put overrides and renames in pkg context in sqlc.yaml

---------

Co-authored-by: Andrew Benton <andrewmbenton@gmail.com>
2024-01-02 08:56:38 +00:00
Spike Curtis 36636bb6a5 feat: add tailnet to agent RPC service (#11304)
Adds tailnet.DRPCService to the agent API

Supports #10531 but we still need to add version negotiation to the websocket endpoint
2024-01-02 10:10:20 +04:00
Spike Curtis 25f2abf9ab chore: remove tailnet from agent API and rename client API to tailnet (#11303)
Refactors our DRPC service definitions slightly.

In the previous version, I inserted the RPCs from the tailnet proto directly into the Agent service.  This makes things hard to deal with because DRPC then generates a new set of methods with new interfaces with the `DRPCAgent_` prefixed.  Since you can't have a single method that takes different argument types, we couldn't reuse the implementation of those RFCs without a lot of extra classes and pass-thru methods.

Instead, the "right" way to do it is to integrate at the DRPC layer.  So, we have two DRPC services available over the Agent websocket, and register them both on the DRPC `mux`.

Since the tailnet proto RPC service is now for both clients and agents, I renamed some things to clarify and shorten.

This PR also removes the `TailnetAPI` implementation from the `agentapi` package, and the next PR in the stack replaces it with the implementation from the `tailnet` package.
2024-01-02 10:02:45 +04:00
Spike Curtis 65290997c1 chore: disable failing metrics check until it can be fixed (#11361) 2024-01-02 05:39:48 +00:00
Spike Curtis f28f340c7b fix: test for expiry 3 months on Azure certs (#11362) 2024-01-02 09:30:36 +04:00
Spike Curtis d257f8163d feat: implement DERP streaming on tailnet Client API (#11302)
Implements DERPMap streaming from client API.

In a subsequent PR I plan to remove the implementation in coderd/agentapi in favor of the tailnet one
2024-01-02 08:07:57 +04:00
dependabot[bot] 055a160431 chore: bump the offlinedocs group in /offlinedocs with 1 update (#11358)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-02 05:49:33 +03:00
sharkymark 3582284977 chore: update images in appearance docs and correct inconsistencies (#11346)
* chore: update images in appearance docs and correct inconsistencies

* fix: spelling

---------

Co-authored-by: Eric <ericpaulsen@coder.com>
2023-12-28 15:06:54 -06:00
Myne 6fcc49f030 fix(examples/templates/nomad-docker): ignore NOMAD_NAMESPACE and NOMAD_REGION when Coder is running in nomad (#11341) 2023-12-28 10:24:18 +03:00
Muhammad Atif Ali e9437e2662 chore(site): update miscellaneous svg icons (#11343) 2023-12-27 23:05:03 +03:00
Muhammad Atif Ali e3a1bdb60d chore(dogfood): update nodejs installation method (#11339) 2023-12-26 16:53:41 +03:00
Muhammad Atif Ali 0ebd656cd1 refactor: refactor JFrog docs and template (#11336) 2023-12-25 07:26:34 +00:00
Muhammad Atif Ali 5a558b69c3 chore(examples/jfrog): always install the latest JFrog extension (#11335) 2023-12-24 13:59:04 +03:00
Muhammad Atif Ali b69ccab390 fix(docs): add missing scoped token resource to JFrog docs (#11334) 2023-12-24 13:30:52 +03:00
Muhammad Atif Ali ed3ecfc923 chore: build dogfood image on PRs and skip pushing to registry (#11311) 2023-12-24 11:43:38 +03:00
Muhammad Atif Ali efe8c67774 ci: fix close reason type for stale issues
The action was faking because we were incorrectly using `not planned` instead of `not_planned`.
2023-12-23 18:43:13 +03:00
Mathias Fredriksson be3889af07 test(site/e2e): catch missing agent defaults in fillResource (#11105) 2023-12-23 11:52:27 +00:00
Yonatan Arbel 8271cb01c0 docs: fix broken link to JFrog module (#11322) 2023-12-22 14:42:59 +03:00
Cian Johnston 19abde12fb chore(coderd): fix test flake with auditor (#11316) 2023-12-22 09:50:49 +00:00
Michael Smith 167c15238a fix: prevent UI from jumping around when selecting workspaces (#11321) 2023-12-21 22:36:42 +00:00
Ben Potter b3e3521274 docs: add v2.6.0 changelog (#11320)
* docs: add v2.6.0 changelog

* fmt
2023-12-21 22:33:13 +00:00
Kayla Washburn 029c92fede fix: fix name for external auth connections (#11318) 2023-12-21 15:27:16 -07:00
Kayla Washburn db71c0fa54 refactor: remove theme "color palettes" (#11314) 2023-12-21 14:45:54 -07:00
Asher 5cfa34b31e feat: add OAuth2 applications (#11197)
* Add database tables for OAuth2 applications

These are applications that will be able to use OAuth2 to get an API key
from Coder.

* Add endpoints for managing OAuth2 applications

These let you add, update, and remove OAuth2 applications.

* Add frontend for managing OAuth2 applications
2023-12-21 21:38:42 +00:00
Kayla Washburn e044d3b752 fix: add additional theme colors (#11313) 2023-12-21 12:59:39 -07:00
Jon Ayers 0b7d68dc3f chore: remove template_update_policies experiment (#11250) 2023-12-21 13:39:33 -06:00
Muhammad Atif Ali 5b071f4d94 feat(examples/templates): add GCP VM devcontainer template (#11246) 2023-12-21 13:01:10 +00:00
Spike Curtis 52b87a28b0 fix: stop printing warnings on external provisioner daemon command (#11309)
fixes #11307
2023-12-21 16:55:34 +04:00
Spike Curtis db9104c02e fix: avoid panic on nil connection (#11305)
Related to https://github.com/coder/coder/actions/runs/7286675441/job/19855871305

Fixes a panic if the listener returns an error, which can obfuscate the underlying problem and cause unrelated tests to be marked failed.
2023-12-21 14:26:11 +04:00
Steven Masley fe867d02e0 fix: correct perms for forbidden error in TemplateScheduleStore.Load (#11286)
* chore: TemplateScheduleStore.Load() throwing forbidden error
* fix: workspace agent scope to include template
2023-12-20 11:38:49 -06:00
Kira Pilot 20dff2aa5d added react query dev tools (#11293) 2023-12-20 10:08:51 -05:00
Ben Potter 19e4a86711 docs: add guidelines for debugging group sync (#11296)
* docs: add guidelines for debugging group sync

* fmt
2023-12-20 12:52:07 +00:00
Bruno Quaresma e2e56d7d4f refactor(site): move workspace schedule controls to its own component (#11281) 2023-12-20 08:46:18 -03:00
Cian Johnston bfc588955c ci: make test-go-pg depend on sqlc-vet (#11288) 2023-12-20 08:47:47 +00:00
Muhammad Atif Ali 3ffe7f55aa feat(examples/templates): add aws vm devcontainer template (#11248)
* feat(examples/templates): add aws vm devcontainer template

* Create README.md

* add code-server

* fix code-server

* `make fmt`

* Add files via upload

* Update README.md

* fix typo and persist workspace

* always land in the repo directory
2023-12-20 08:24:45 +03:00
Kayla Washburn 97f7a35a47 feat: add light theme (#11266) 2023-12-19 17:03:00 -07:00
Bruno Quaresma e0d34ca6f7 fix(site): fix error when loading workspaces with dormant (#11291) 2023-12-19 20:42:07 -03:00
Steven Masley 24080b121c feat: enable csrf token header (#11283)
* feat: enable csrf token header

* Exempt external auth requets
* ensure dev server bypasses CSRF
* external auth is just get requests
* Add some more routes
* Extra assurance nothing breaks
2023-12-19 15:42:05 -06:00
Steven Masley fbda21a9f2 feat: move moons experiment to ga (released) (#11285)
* feat: release moons experiment as ga
2023-12-19 14:40:22 -06:00
Steven Masley e8be092af0 chore: add sqlc push action on releases (#11171)
* add sqlc push action on releases
* Make sqlc push optional
2023-12-19 20:31:55 +00:00
Steven Masley c1451ca4da chore: implement yaml parsing for external auth configs (#11268)
* chore: yaml parsing for external auth configs
* Also unmarshal and check the output again
2023-12-19 18:09:45 +00:00
dependabot[bot] 016b3ef5a2 chore: bump golang.org/x/crypto from 0.15.0 to 0.17.0 (#11274)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.15.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.15.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-19 20:52:43 +03:00
Cian Johnston d2d7628522 fix(enterprise/cli): add CODER_PROVISIONER_DAEMON_LOG_* options (#11279)
- Extracts cli.BuildLogger to clilog package
- Updates existing usage of cli.BuildLogger and removes it
- Use clilog to initialize provisionerd logger
2023-12-19 16:49:50 +00:00
Bruno Quaresma 7c4fbe5bae refactor(site): make HelpTooltip easier to reuse and compose (#11242) 2023-12-19 10:43:23 -03:00
Spike Curtis f2606a78dd fix: avoid converting nil node
fixes: #11276
2023-12-19 13:38:15 +04:00
Stephen Kirby 83e1349c2c moved docker installation warning to install/docker (#11273) 2023-12-18 18:19:20 -06:00
MarkE 280d38d4b8 added UI as Dashboard synonym (#11271) 2023-12-18 17:13:07 -06:00
Kayla Washburn 3ab4800a18 chore: clean up lint (#11270) 2023-12-18 14:59:39 -07:00
Bruno Quaresma e84d89353f fix(site): fix template editor filetree navigation (#11260)
Close https://github.com/coder/coder/issues/11203
2023-12-18 14:21:24 -03:00
Cian Johnston ff61475239 fix(coderd/provisionerdserver): use s.timeNow (#11267) 2023-12-18 17:11:50 +00:00
Steven Masley c35b560c87 chore: fix flake, use time closer to actual test (#11240)
* chore: fix flake, use time closer to actual test

The tests were queued, and the autostart time was being set
to the time the table was created, not when the test was actually
being run. This diff was causing failures in CI
2023-12-18 10:55:46 -06:00
Cian Johnston 213b768785 feat(coderd): insert provisioner daemons (#11207)
* Adds UpdateProvisionerDaemonLastSeenAt
* Adds heartbeat to provisioner daemons
* Inserts provisioner daemons to database upon start
* Ensures TagOwner is an empty string and not nil
* Adds COALESCE() in idx_provisioner_daemons_name_owner_key
2023-12-18 16:44:52 +00:00
Steven Masley a6901ae2c5 chore: fix race in cron close behavior (TestAgent_WriteVSCodeConfigs) (#11243)
* chore: add unit test to excercise flake
* Implement a *fix for cron stop() before run()

This fix still has a race condition. I do not see a clean solution
without modifying the cron libary. The cron library uses a boolean
to indicate running, and that boolean needs to be set to "true"
before we call "Close()". Or "Close()" should prevent "Run()"
from doing anything.

In either case, this solves the issue for a niche unit test bug
in which the test finishes, calling Close(), before there was
an oppertunity to start the go routine. It probably isn't worth
a lot of time investment, and this fix will suffice
2023-12-18 09:26:40 -06:00
Jon Ayers 56cbd47082 chore: fix TestWorkspaceAutobuild/DormancyThresholdOK flake (#11251) 2023-12-18 09:23:06 -06:00
Muhammad Atif Ali 45e9d93d37 chore: remove unused input from deploy-pr workflow (#11259) 2023-12-18 17:32:53 +03:00
Muhammad Atif Ali 5647e87207 ci: drop chocolatey from ci (#11245) 2023-12-18 17:31:35 +03:00
Dean Sheather 307186325f fix: avoid db import in slim builds (#11258) 2023-12-19 00:09:22 +10:00
dependabot[bot] 28a0242c27 ci: bump the github-actions group with 4 updates (#11256)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-18 13:30:18 +00:00
Dean Sheather e46431078c feat: add AgentAPI using DRPC (#10811)
Co-authored-by: Spike Curtis <spike@coder.com>
2023-12-18 22:53:28 +10:00
Cian Johnston eb781751b8 ci: update flux to 2.2.1 (#11253) 2023-12-18 09:29:46 +00:00
Muhammad Atif Ali 838ab8de7e docs: fix a broken link (#11254) 2023-12-18 09:28:55 +00:00
Ben Potter 2e86b76fb8 docs: improve structure for example templates (#9842)
Co-authored-by: Kyle Carberry <kyle@carberry.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
2023-12-17 17:05:13 +03:00
Steven Masley 3f6096b0d7 chore: unit test to enforce authorized queries match args (#11211)
* chore: unit test to enforce authorized queries match args
* Also check querycontext arguments
2023-12-15 20:31:07 +00:00
Garrett Delfosse 7924bb2a56 feat!: move workspace renames behind flag, disable by default (#11189) 2023-12-15 13:38:47 -05:00
Steven Masley e63de9a259 chore: enforcement of dbauthz tests was broken (#11218)
* chore: enforcement of dbauthz tests was broken

Implemented missing tests to catch back up

---------

Co-authored-by: Cian Johnston <cian@coder.com>
2023-12-15 18:30:21 +00:00
Stephen Kirby 0801760956 docs: add guides section (#11199)
* setup manifest

* added okta guide from steven M

* improved index by adding children

* changed icon to notes.svg

* added meta guide, fixed profile photo fmt
2023-12-15 11:10:41 -06:00
Ravindra Shinde a495952349 Upgrade code-server version to 4.19.1 (#11233) 2023-12-15 14:21:07 +00:00
Marcin Tojek 58c2ce17da refactor(cli): load template variables (#11234) 2023-12-15 14:55:24 +01:00
Cian Johnston fa91992976 ci: add audit docs gen dependency on db gen (#11231)
Audit docs gen depends on queries.sql.go so adding an explicit dependency
2023-12-15 11:49:19 +00:00
Marcin Tojek 89d8a293f0 fix: tar: do not archive .tfvars (#11208) 2023-12-15 11:15:12 +01:00
Spike Curtis 211e59bf65 feat: add tailnet v2 API support to coordinate endpoint (#11228)
closes #10532

Adds v2 support to the /coordinate endpoint via a query parameter.

v1 already has test cases, and we haven't implemented v2 at the client yet, so the only new test case is an unsupported version.
2023-12-15 14:10:24 +04:00
Cian Johnston a41cbb0f03 chore(dogfood): align Terraform version to that of dockerfile.base (#11227) 2023-12-15 10:02:59 +00:00
Dean Sheather 1e49190e12 feat: add server flag to disable user custom quiet hours (#11124) 2023-12-15 19:33:51 +10:00
Spike Curtis a58e4febb9 feat: add tailnet v2 Service and Client (#11225)
Part of #10532

Adds a tailnet ClientService that accepts a net.Conn and serves v1 or v2 of the tailnet API.

Also adds a DRPCService that implements the DRPC interface for the v2 API.  This component is within the ClientService, but needs to be reusable and exported so that we can also embed it in the Agent API.

Finally, includes a NewDRPCClient function that takes a net.Conn and runs dRPC in yamux over it on the client side.
2023-12-15 12:48:39 +04:00
Spike Curtis 9a4e1100fa chore: move drpc transport tools to codersdk/drpc (#11224)
Part of #10532

DRPC transport over yamux and in-mem pipes was previously only used on the provisioner APIs, but now will also be used in tailnet.  Moved to subpackage of codersdk to avoid import loops.
2023-12-15 12:41:39 +04:00
Dean Sheather b36071c6bb feat: allow templates to specify max_ttl or autostop_requirement (#10920) 2023-12-15 18:27:56 +10:00
Spike Curtis 30f032d282 feat: add tailnet ValidateVersion (#11223)
Part of #10532

Adds a method to validate a requested version of the tailnet API
2023-12-15 11:49:30 +04:00
Spike Curtis ad3fed72bc chore: rename Coordinator to CoordinatorV1 (#11222)
Renames the tailnet.Coordinator to represent both v1 and v2 APIs, so that we can use this interface for the main atomic pointer.

Part of #10532
2023-12-15 11:38:12 +04:00
Spike Curtis 545cb9a7cc fix: wait for coordinator in Test_agentIsLegacy (#11214)
Fixes flake https://github.com/coder/coder/runs/19639217635

AGPL coordinator used to process node updates for single_tailnet synchronously, but it's been refactored to process async, so in this test we need to wait for it to be processed.
2023-12-15 07:21:18 +04:00
Ben Potter e6e65fdc64 docs: add v2.5.1 changelog (#11220)
* docs: add v2.5.1 changelog

* fix typo
2023-12-14 17:35:36 -06:00
Colin Adler 4672700ef6 chore: add additional fields to license telemetry (#11173)
This sends the email the license was issued to, and whether or not it's a trial in the telemetry payload. It's a bit janky since the license parsing is all enterprise licensed.
2023-12-14 15:52:52 -06:00
Jon Ayers 06394a5b8c Revert "fix: prevent data race when mutating tags (#11200)" (#11216)
This reverts commit 82f7b0cef4.
2023-12-14 12:37:55 -06:00
Kayla Washburn 81ed112cd3 fix: fix auto theme (#11215) 2023-12-14 11:31:42 -07:00
Spike Curtis fad457420b fix: copy StringMap on insert and query in dbmem (#11206)
Addresses the issue in #11185 for the StringMap datatype.

There are other slice data types in our database package that also need to be fixed, but that'll be a different PR
2023-12-14 22:23:29 +04:00
Bruno Quaresma 32c93a887e fix(site): fix initial body background color 2023-12-14 18:15:25 +00:00
Bruno Quaresma 43411d20ba fix(site): fix pending color on dark blue theme (#11212) 2023-12-14 15:08:53 -03:00
Kayla Washburn 133dc66143 feat: add a theme picker (#11140) 2023-12-14 10:38:44 -07:00
Bruno Quaresma 0cd4842d18 fix(site): fix pending indicator color (#11209) 2023-12-14 11:30:40 -03:00
Cian Johnston df7ed18e1b chore(coderd/autobuild): wait for active template version and inactive template version (#11210) 2023-12-14 13:58:57 +00:00
Cian Johnston 5b0e6bfa2a feat(coderd/database): add api_version to provisioner_daemons table (#11204)
Adds column api_version to the provisioner_daemons table.
This is distinct from the coderd version, and is used to handle breaking changes in the provisioner daemon API.
2023-12-14 12:52:41 +00:00
Muhammad Atif Ali b779655f01 ci: fix syntax for ipv6 address in fly.io wsproxies (#11205) 2023-12-14 15:26:43 +03:00
Jon Ayers 82f7b0cef4 fix: prevent data race when mutating tags (#11200) 2023-12-14 08:56:59 +00:00
Colin Adler eb81fcf1e1 fix: lower amount of cached timezones for deployment daus (#11196)
Updates https://github.com/coder/customers/issues/384

This should help alleviate some pressure, but doesn't really fix the
root cause. See above issue for more details.
2023-12-13 16:50:29 -06:00
Stephen Kirby a3432b4265 docs: add faqs from sharkymark (#11168)
* added sharkymark FAQs page

* make fmt

* fixed typos for link

* changed FAQs icon to (i)

* satisfied review

* make fmt

* added docs links for coder_app, CODER_ACCESS_URL

* removed mentions of mark

* fixed some minor code formatting issues

* fixed numbered bullets rendering, make fmt
2023-12-13 15:56:11 -06:00
Muhammad Atif Ali c3eb68a585 Update CODER_WILDCARD_ACCESS_URL in fly-wsproxies configuration files (#11195) 2023-12-13 21:43:53 +00:00
Muhammad Atif Ali d82ed008f2 ci: revert fly proxies to shared cpu type (#11194) 2023-12-13 21:15:56 +00:00
Muhammad Atif Ali 3924b294fb ci: bump memory to 1024 MB for fly.io proxies (#11193)
* Update paris-coder.toml

* Update sao-paulo-coder.toml

* Update sydney-coder.toml
2023-12-13 20:03:46 +00:00
Muhammad Atif Ali 12f728189c ci: add wildcard support to fly.io wsproxies (#11188)
* ci: add wildcard support to fly.io wsproxies

* Update sao-paulo-coder.toml

* Update sydney-coder.toml

* Update paris-coder.toml

* Apply suggestions from code review

Co-authored-by: Dean Sheather <dean@deansheather.com>

* Update .github/fly-wsproxies/sao-paulo-coder.toml

Co-authored-by: Dean Sheather <dean@deansheather.com>

* Update sao-paulo-coder.toml

* Update sydney-coder.toml

---------

Co-authored-by: Dean Sheather <dean@deansheather.com>
2023-12-13 22:44:04 +03:00
Steven Masley b7bdb17460 feat: add metrics to workspace agent scripts (#11132)
* push startup script metrics to agent
2023-12-13 11:45:43 -06:00
Steven Masley 41ed581460 chore: include build version header on subdomain apps (#11172)
Idk why this was not the case before, this is very helpful to have
2023-12-13 11:45:27 -06:00
Marcin Tojek fd43985e94 fix: nix: switch to go1.21.5 (#11183) 2023-12-13 14:41:18 +01:00
Muhammad Atif Ali c60c75c833 ci: do not rebuild but use artifacts from the build job (#11180) 2023-12-13 12:46:22 +00:00
Marcin Tojek f2a91157a9 fix: update nix to include sqlc v1.24.0 (#11182) 2023-12-13 13:35:02 +01:00
Cian Johnston 4f7ae6461b feat(coderd/database): add UpsertProvisionerDaemons query (#11178)
Co-authored-by: Marcin Tojek <marcin@coder.com>
2023-12-13 12:31:40 +00:00
Marcin Tojek ef4d1b68e1 test: insights metrics: verify plugin usage (#11156) 2023-12-13 10:46:52 +01:00
Dean Sheather 8b8a763ca9 chore: use flux 2.2.0 (#11174) 2023-12-13 09:26:48 +00:00
Spike Curtis bf3b35b1e2 fix: stop logging context Canceled as error (#11177)
fixes #11166 and a related log that could have the same problem
2023-12-13 13:08:30 +04:00
Spike Curtis 43ba3146a9 feat: add test case for BlockDirect + listening ports (#11152)
Adds a test case for #10391 with single tailnet out of experimental
2023-12-13 12:28:09 +04:00
Steven Masley 6800fc8477 chore: bump go (->v1.21.5) and sqlc (->v1.24.0) to new versions (#11170) 2023-12-12 18:50:23 -06:00
Steven Masley 6b4d908e7e chore: makefile set sqlc-vet to .Phony (#11169) 2023-12-12 22:55:13 +00:00
Steven Masley e52d848d05 chore: validate queries using sqlc-vet in github actions (#11163) 2023-12-12 15:53:26 -06:00
Steven Masley dba0dfa859 chore: correct 500 -> 404 on workspace agent mw (#11129)
* chore: correct 500 -> 404
2023-12-12 15:14:32 -06:00
Steven Masley 0181e036f6 chore: remove unused query failing to prepare (#11167) 2023-12-12 15:02:15 -06:00
Ammar Bandukwala 19c0cfdabf chore(provisionersdk): add test for not following symlinks (#11165) 2023-12-12 14:44:50 -06:00
Cian Johnston 2471f3b9a8 ci: set flux version to 2.1.2 (#11164) 2023-12-12 20:17:01 +00:00
Kayla Washburn f67c5cf72b fix: only show orphan option while deleting failed workspaces (#11161) 2023-12-12 11:18:04 -07:00
Kayla Washburn 689da5b7c1 feat(site): improve bulk delete flow (#11093) 2023-12-12 10:14:28 -07:00
sempie 007b2b8db0 docs: add text to docs mentioning appearance settings for oidc sign-on page (#11159)
* add text to docs mentioning appearance settings for oidc sign-on page
2023-12-12 11:33:44 -05:00
Ben Potter cab8ffa54a docs: add v2.5.0 changelog (#11139)
* docs: add v2.5.0 changelog

* fix typos

* Apply suggestions from code review

* changes from feedback

* more fixes

* Update docs/changelogs/v2.5.0.md

Co-authored-by: Muhammad Atif Ali <atif@coder.com>

* Update docs/changelogs/v2.5.0.md

* fmt

* updates

---------

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-12-12 09:52:11 -06:00
Mathias Fredriksson b32a0a9af6 fix(go.mod): switch to sftp fork to fix file upload permissions (#11157)
Fixes #6685
Upstream https://github.com/pkg/sftp/pull/567
Related https://github.com/mutagen-io/mutagen/issues/459
2023-12-12 17:42:03 +02:00
Jon Ayers 41dbe7de4e fix: use correct permission when determining orphan deletion privileges (#11143) 2023-12-12 08:24:04 -06:00
Cian Johnston 8afbc8f7f5 chore(site): update test entities (#11155) 2023-12-12 13:03:37 +00:00
Spike Curtis edeb9bb42a fix: appease linter on darwin (#11154)
Fixing up some linting errors that show up on Darwin, but not in CI.
2023-12-12 17:02:28 +04:00
Cian Johnston 2883cad6ad fix(coderd/autobuild): wait for template version job in TestExecutorInactiveWorkspace (#11150) 2023-12-12 12:43:02 +00:00
Muhammad Atif Ali dde21cebcc chore(dogfood): use go 1.20.11 to match CI (#11153) 2023-12-12 11:45:28 +00:00
Cian Johnston b02796655e fix(coderd/database): remove column updated_at from provisioner_daemons table (#11108) 2023-12-12 11:19:28 +00:00
Cian Johnston 197cd935cf chore(Makefile): use linter version from dogfood Dockerfile (#11147)
* chore(Makefile): use golangci-lint version from dogfood Dockerfile

* chore(dogfood/Dockerfile): update golangci-lint to latest version

* chore(coderd): address linter complaints
2023-12-12 10:02:32 +00:00
Cian Johnston d07fa9c62f ci: offlinedocs: install protoc (#11148) 2023-12-12 10:00:16 +00:00
Jon Ayers 45c07317c0 docs: add documentation for template update policies (#11145) 2023-12-11 19:05:25 -06:00
Michael Smith 3ce7b2ebe6 fix: remove URL desyncs when trying to search users table (#11144)
* fix: remove URL search params desync

* refactor: clean up payload definition for clarity
2023-12-12 00:45:03 +00:00
Jon Ayers ba3b835339 fix: prevent editing build parameters if template requires active version (#11117)
Co-authored-by: McKayla Washburn <mckayla@hey.com>
2023-12-11 15:54:16 -07:00
Garrett Delfosse b7ea330aea fix: ensure we are talking to coder on first user check (#11130) 2023-12-11 14:27:32 -05:00
Stephen Kirby e37bbe6208 fixed small typo in docs/admin/configure (#11135) 2023-12-11 12:49:28 -06:00
Kayla Washburn 6775a86785 chore: make "users"."avatar_url" NOT NULL (#11112) 2023-12-11 10:09:51 -07:00
Mathias Fredriksson 3e5d292135 feat: add support for coder_env (#11102)
Fixes #10166
2023-12-11 16:10:18 +02:00
Muhammad Atif Ali 4612c28d99 ci: update tj-actions/branch-names action in dogfood.yaml (#11120) 2023-12-11 16:49:53 +03:00
dependabot[bot] 486d1fb697 chore: bump alpine from 3.18.5 to 3.19.0 in /scripts (#11126)
Bumps alpine from 3.18.5 to 3.19.0.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-11 23:24:16 +10:00
dependabot[bot] 6823194683 ci: bump the github-actions group with 7 updates (#11123)
Bumps the github-actions group with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [crate-ci/typos](https://github.com/crate-ci/typos) | `1.16.23` | `1.16.24` |
| [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud) | `1` | `2` |
| [google-github-actions/get-gke-credentials](https://github.com/google-github-actions/get-gke-credentials) | `1` | `2` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `2` | `3` |
| [docker/build-push-action](https://github.com/docker/build-push-action) | `4` | `5` |
| [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) | `0.14.0` | `0.16.0` |
| [actions/stale](https://github.com/actions/stale) | `8.0.0` | `9.0.0` |


Updates `crate-ci/typos` from 1.16.23 to 1.16.24
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.16.23...v1.16.24)

Updates `google-github-actions/setup-gcloud` from 1 to 2
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google-github-actions/setup-gcloud/compare/v1...v2)

Updates `google-github-actions/get-gke-credentials` from 1 to 2
- [Release notes](https://github.com/google-github-actions/get-gke-credentials/releases)
- [Changelog](https://github.com/google-github-actions/get-gke-credentials/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google-github-actions/get-gke-credentials/compare/v1...v2)

Updates `docker/setup-buildx-action` from 2 to 3
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

Updates `docker/build-push-action` from 4 to 5
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4...v5)

Updates `aquasecurity/trivy-action` from 0.14.0 to 0.16.0
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](https://github.com/aquasecurity/trivy-action/compare/2b6a709cf9c4025c5438138008beaddbb02086f0...91713af97dc80187565512baba96e4364e983601)

Updates `actions/stale` from 8.0.0 to 9.0.0
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v8.0.0...v9.0.0)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: google-github-actions/setup-gcloud
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: google-github-actions/get-gke-credentials
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-11 23:21:07 +10:00
Muhammad Atif Ali 2c7ad1c094 ci: ungroup Dockerfile dependabot changes (#11125) 2023-12-11 16:16:28 +03:00
Spike Curtis 8d9157dc35 fix: use provisionerd context when failing job on canceled acquire (#11118)
Spotted during code read. We need to use the provisionerd auth context when failing a job due to a lost provisioner daemon.
2023-12-11 14:52:44 +04:00
Spike Curtis 50575e1a9a fix: use fake local network for port-forward tests (#11119)
Fixes #10979

Testing code that listens on a specific port has created a long battle with flakes.  Previous attempts to deal with this include opening a listener on a port chosen by the OS, then closing the listener, noting the port and starting the test with that port.
This still flakes, notably in macOS which has a proclivity to reuse ports quickly.

Instead of fighting with the chaos that is an OS networking stack, this PR fakes the host networking in tests.

I've taken a small step here, only faking out the Listen() calls that port-forward makes, but I think over time we should be transitioning all networking the CLI does to an abstract interface so we can fake it.  This allows us to run in parallel without flakes and
presents an opportunity to test error paths as well.
2023-12-11 14:51:56 +04:00
Jon Ayers 37f6b38d53 fix: return 403 when rebuilding workspace with require_active_version (#11114) 2023-12-08 23:03:46 -06:00
Bruno Quaresma 8488afa8df chore(site): enable react-query cache (#11113) 2023-12-08 23:58:29 +00:00
Kayla Washburn d8e95001e8 chore: add theme_preference column to users table (#11069) 2023-12-08 21:59:53 +00:00
Kayla Washburn ebd6c1b573 feat(site): bring back dark blue (#11071) 2023-12-08 14:38:35 -07:00
Garrett Delfosse 716759aacf fix: provide helpful error when no login url specified (#11110) 2023-12-08 14:44:40 -05:00
Eric Paulsen 167c759149 docs: add license and template insights prom metrics (#11109)
* docs: add license and template insights prom metrics

* add: coderd_insights_applications_usage_seconds
2023-12-08 14:17:14 -05:00
Garrett Delfosse d8467c11ad fix: handle no memory limit in coder stat mem (#11107) 2023-12-08 12:46:53 -05:00
Spike Curtis 6d66cb246d feat: display 'Deprecated' warning for agents using old API version (#11058)
Fixes #10340
2023-12-08 20:20:44 +04:00
Steven Masley 78517cab52 feat: add group allowlist for oidc (#11070)
* feat: group allow list in OIDC settings
2023-12-08 10:14:19 -06:00
Steven Masley cb89bc1729 feat: restart stopped workspaces on ssh command (#11050)
* feat: autostart workspaces on ssh & port forward

This is opt out by default. VScode ssh does not have this behavior
2023-12-08 10:01:13 -06:00
Bruno Quaresma 1f7c63cf1b fix(site): hide ws proxy on menu when disabled (#11101) 2023-12-08 11:47:09 -03:00
Bruno Quaresma 9d8578e0e3 refactor(site): apply minor naming improvements (#11080)
Minor naming and logic improvements to improve readability
2023-12-08 11:46:18 -03:00
Bruno Quaresma 2c7394bb3d refactor(site): change a few names related to workspace actions (#11079) 2023-12-08 13:41:58 +00:00
Cian Johnston 2b19a2369f chore(coderd): move provisionerd tags to provisionersdk (#11100) 2023-12-08 12:10:25 +00:00
Cian Johnston 4ca4736411 ci: reconcile provisionerd as well (#11085) 2023-12-08 09:55:43 +00:00
Marcin Tojek 918a82436e fix: insights: remove time-dependent tests (#11099) 2023-12-08 09:51:18 +00:00
Jon Ayers 02696f2df9 chore: fix flake in TestExecutorAutostopTemplateDisabled (#11096) 2023-12-08 09:02:54 +00:00
Spike Curtis b4ca1d6579 feat: include server agent API version in buildinfo (#11057)
First part of #10340 -- we need this version to compare with agents to tell if they are on a deprecated Agent API version
2023-12-08 12:50:25 +04:00
Muhammad Atif Ali f0969f99ad revert: "chore(dogfood): remove agent_name from jetbrains-ide module" (#11095) 2023-12-08 01:14:37 +00:00
Jon Ayers e73a202aed feat: show dormant workspaces by default (#11053) 2023-12-07 18:09:35 -06:00
Muhammad Atif Ali be31b2e4d7 chore(dogfood): remove agent_name from jetbrains-ide module
This is no more needed.
Depends on https://github.com/coder/modules/pull/99
2023-12-08 02:34:21 +03:00
Jon Ayers ce49a55f56 chore: update build_reason 'autolock' -> 'dormancy' (#11074) 2023-12-07 17:11:57 -06:00
Steven Masley 8221544514 chore: check if process is nil (#11090)
* chore: check if process is nil

We check if process is nil in the ports_supported file.
Just matching that defensive check, not sure if it can be nil.
2023-12-07 22:23:42 +00:00
Asher dbbf8acc26 fix: track JetBrains connections (#10968)
* feat: implement jetbrains agentssh tracking

Based on tcp forwarding instead of ssh connections

* Add JetBrains tracking to bottom bar
2023-12-07 12:15:54 -09:00
Cian Johnston 51687c74c8 fix(coderd/healthcheck): do not return null regions in RegionsResponse (#11088) 2023-12-07 21:10:12 +00:00
Garrett Delfosse 228cbec99b fix: stop updating agent stats from deleted workspaces (#11026)
Co-authored-by: Steven Masley <stevenmasley@gmail.com>
2023-12-07 13:55:29 -05:00
Cian Johnston 1e349f0d50 feat(cli): allow specifying name of provisioner daemon (#11077)
- Adds a --name argument to provisionerd start
- Plumbs through name to integrated and external provisioners
- Defaults to hostname if not specified for external, hostname-N for integrated
- Adds cliutil.Hostname
2023-12-07 16:59:13 +00:00
Garrett Delfosse 8aea6040c8 fix: use unique workspace owners over unique users (#11044) 2023-12-07 10:53:15 -05:00
Kira Pilot 091fdd6761 fix: redirect unauthorized git users to login screen (#10995)
* fix: redirect to login screen if unauthorized git user

* consolidated language

* fix redirect
2023-12-07 09:19:31 -05:00
Barton Ip 5d2e87f1a7 docs: add warning about Sysbox before installation (#10619)
* Add warning about Sysbox before installation

* Formatting tings
2023-12-07 16:58:50 +03:00
Spike Curtis b34ecf1e9e fix: fix deadlock of mappingQuery on context canceled
Fixes #11078

replace bare channel send with SendCtx so that we properly shut down when context is canceled.
2023-12-07 17:19:18 +04:00
Marcin Tojek 941e3873a8 fix: implement fake DeleteOldWorkspaceAgentStats (#11076) 2023-12-07 14:08:16 +01:00
Bruno Quaresma c0d68a4c2c fix(site): fix clickable props on the workspace table row (#11072) 2023-12-06 19:50:39 +00:00
dependabot[bot] 567ecca61b chore: bump vite from 4.5.0 to 4.5.1 in /site (#11052)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.1/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-06 22:40:24 +03:00
Bruno Quaresma 667ee41165 refactor(site): improve minor queries and visuals on external auth (#11066) 2023-12-06 16:17:31 -03:00
Bruno Quaresma 8a6bfc9d28 feat(site): do not show health warning when the warning is dismissed (#11068) 2023-12-06 16:06:58 -03:00
Steven Masley 2947b827fb chore: use httpError to allow better error elevation (#11065) 2023-12-06 10:27:40 -06:00
Bruno Quaresma dd01bde9b6 fix(site): fix template editor route (#11063) 2023-12-06 15:59:00 +00:00
Bruno Quaresma 44f9613bf2 feat(site): dismiss health section warnings (#11059) 2023-12-06 12:50:35 -03:00
Bruno Quaresma 2bc11d2e63 fix(site): fetch health data only if has permissions (#11062) 2023-12-06 15:47:58 +00:00
Bruno Quaresma 43488b44ce chore(site): refactor pagination text (#11061) 2023-12-06 12:19:29 -03:00
Steven Masley b376b2cd13 feat: add user/settings page for managing external auth (#10945)
Also add support for unlinking on the coder side to allow reflow.
2023-12-06 08:41:45 -06:00
Marcin Tojek f6891bc465 fix: implement fake DeleteOldWorkspaceAgentLogs (#11042) 2023-12-06 14:31:43 +01:00
Bruno Quaresma 088fd0b904 chore(site): ignore updated at on chromatic (#11060) 2023-12-06 10:19:33 -03:00
Spike Curtis 2c86d0bed0 feat: support v2 Tailnet API in AGPL coordinator (#11010)
Fixes #10529
2023-12-06 15:04:28 +04:00
Cian Johnston 38ed816207 fix(coderd/debug): fix caching issue with dismissed sections (#11051) 2023-12-06 08:38:03 +00:00
Kira Pilot 53453c06a1 fix: display app templates correctly in build preview (#10994)
* fix: appropriately display display_app apps in template build preview

* added display apps to build preview

* added test, consolidated names

* handling empty state
2023-12-05 16:01:40 -05:00
Steven Masley 81a3b36884 feat: add endpoints to list all authed external apps (#10944)
* feat: add endpoints to list all authed external apps

Listing the apps allows users to auth to external apps without going through the create workspace flow.
2023-12-05 14:03:44 -06:00
Cian Johnston feaa9894a4 fix(site/src/api/typesGenerated): generate HealthSection enums (#11049)
Relates to #8971

- Introduces a codersdk.HealthSection enum type
- Refactors existing references using strings to use new HealthSection type
2023-12-05 20:00:27 +00:00
Cian Johnston f66e802fae fix(coderd/debug): putDeploymentHealthSettings: use 204 instead of 304 if not modified (#11048) 2023-12-05 19:06:56 +00:00
Bruno Quaresma 876d448d69 fix(site): fix padding for loader (#11046) 2023-12-05 17:18:31 +00:00
Eric Paulsen 3dcbf63cbe add: document suspended users not consuming seat (#11045) 2023-12-05 12:05:05 -05:00
Bruno Quaresma 0f47b58bfb feat(site): refactor health pages (#11025) 2023-12-05 13:58:51 -03:00
Cian Johnston 2e4e0b2d2c fix(scripts/apitypings): force health.Message and health.Severity to correct types (#11043)
* Force typegen types for some fields of derp health report
* Explicitly allocate slices for RegionReport.{Errors,Warnings} to avoid nulls in API response
2023-12-05 16:31:48 +00:00
Cian Johnston a235644046 fix(codersdk): make codersdk.ProvisionerDaemon.UpdatedAt a codersdk.NullTime (#11037) 2023-12-05 15:40:45 +00:00
Michael Smith fab343a2e9 fix: increase default staleTime for paginated data (#11041)
* fix: update default staleTime for paginated data

* fix: swap cacheTime for staleTime in app-wide query client

* fix: revert cacheTime change

* fix: update debug limit

* fix: apply staleTime to prefetches

* refactor: cleanup code
2023-12-05 14:41:06 +00:00
Muhammad Atif Ali f0b4badf74 ci: add arm64 and amd64 portable binaries to winget (#11030)
* ci: add arm64 and amd64 portable binaries to winget 

This PR updates `release.yaml` workflow to automate updates for `arm64` and `x64` zip installers to winget. This has recently been merged into [winget](https://github.com/microsoft/winget-pkgs/pull/129175).

Thanks to @mdanish-kh for the upstream PR.

* fixup!

* remove extra `--urls` flags

* remove architecture override.

`wingetcreate` does not need architecture override as it now supports parsing the URL for `amd64` and correctly marking it as x64 architecture. 

Reference: 
1. https://github.com/microsoft/winget-create/blob/08baf0e61e62dabcb2487397984fc69fad6a7499/src/WingetCreateCore/Common/PackageParser.cs#L594C56-L594C61
2. PR: https://github.com/microsoft/winget-create/pull/445
2. This has been available since version https://github.com/microsoft/winget-create/releases/tag/v1.5.3.0

* fixup!

* Update release.yaml
2023-12-05 17:06:39 +03:00
Cian Johnston 5fad611020 feat(coderd): add last_seen_at and version to provisioner_daemons table (#11033)
Related to #10676

- Adds columns last_seen_at and version to provisioner_daemons table
- Adds the above to codersdk.ProvisionerDaemons struct
2023-12-05 13:54:38 +00:00
Michael Smith dd1f8331de fix: disable prefetches for audits table (#11040) 2023-12-05 08:49:11 -05:00
Cian Johnston 1b2ed5bc9b ci: add missing go tools to offlinedocs build step (#11034) 2023-12-05 12:03:29 +00:00
Mathias Fredriksson e300b036be feat(scaletest): add greedy agent test to runner (#10559) 2023-12-05 12:37:10 +02:00
Spike Curtis dca8125263 fix: update tailscale to include fix to prevent race (#11032)
fixes #10876
2023-12-05 14:30:19 +04:00
Dean Sheather 695f57f7ff fix: use header flags in wsproxy server (#10985) 2023-12-05 14:13:42 +04:00
Dean Sheather b07b40b346 chore: revert nix dogfood image (#11022)
The nix image isn't used because it doesn't work, and we haven't been
updating our "pre-nix" tag since the changes were made. Reverts back to
being a regular Dockerfile.
2023-12-05 09:02:57 +00:00
Cian Johnston d70f9ea26c chore(docs): apply async suggestions from #10915 (#10976) 2023-12-05 09:01:03 +00:00
Bruno Quaresma dff53d0787 fix(site): fix filter font size (#11028) 2023-12-04 18:17:43 -03:00
Kayla Washburn 185400db11 refactor: remove usage of <Box> and sx (#10702) 2023-12-04 12:09:04 -07:00
Garrett Delfosse 1e6ea6133c fix: pass in time parameter to prevent flakes (#11023)
Co-authored-by: Dean Sheather <dean@deansheather.com>
2023-12-04 12:20:22 -05:00
Marcin Tojek a42b6c185d fix(site): e2e: use click instead of check (#11024) 2023-12-04 18:02:46 +01:00
dependabot[bot] b8e9262c51 chore: bump the scripts-docker group in /scripts with 1 update (#11020)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-04 10:38:58 -06:00
Garrett Delfosse ccd5e1a749 fix: use database for user creation to prevent flake (#10992) 2023-12-04 11:05:17 -05:00
Steven Masley 2f54f769be feat: allow IDP to return single string for roles/groups claim (#10993)
* feat: allow IDP to return single string instead of array for roles/groups claim

This is to support ADFS
2023-12-04 10:01:45 -06:00
dependabot[bot] 3883d7181d chore: bump the offlinedocs group in /offlinedocs with 6 updates (#11014)
* chore: bump the offlinedocs group in /offlinedocs with 6 updates

Bumps the offlinedocs group in /offlinedocs with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [fs-extra](https://github.com/jprichardson/node-fs-extra) | `11.1.1` | `11.2.0` |
| [react-markdown](https://github.com/remarkjs/react-markdown) | `8.0.3` | `9.0.1` |
| [rehype-raw](https://github.com/rehypejs/rehype-raw) | `6.1.1` | `7.0.0` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `18.18.1` | `18.19.2` |
| [eslint](https://github.com/eslint/eslint) | `8.53.0` | `8.55.0` |
| [typescript](https://github.com/Microsoft/TypeScript) | `5.1.6` | `5.3.2` |


Updates `fs-extra` from 11.1.1 to 11.2.0
- [Changelog](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jprichardson/node-fs-extra/compare/11.1.1...11.2.0)

Updates `react-markdown` from 8.0.3 to 9.0.1
- [Release notes](https://github.com/remarkjs/react-markdown/releases)
- [Changelog](https://github.com/remarkjs/react-markdown/blob/main/changelog.md)
- [Commits](https://github.com/remarkjs/react-markdown/compare/8.0.3...9.0.1)

Updates `rehype-raw` from 6.1.1 to 7.0.0
- [Release notes](https://github.com/rehypejs/rehype-raw/releases)
- [Commits](https://github.com/rehypejs/rehype-raw/compare/6.1.1...7.0.0)

Updates `@types/node` from 18.18.1 to 18.19.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `eslint` from 8.53.0 to 8.55.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.53.0...v8.55.0)

Updates `typescript` from 5.1.6 to 5.3.2
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.1.6...v5.3.2)

---
updated-dependencies:
- dependency-name: fs-extra
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: offlinedocs
- dependency-name: react-markdown
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: offlinedocs
- dependency-name: rehype-raw
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: offlinedocs
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: offlinedocs
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: offlinedocs
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: offlinedocs
...

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

* fix: install react-gfm v4 and update type signatures

* fix: update link-nesting for a11y/hydration issue

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Parkreiner <michaelsmith@coder.com>
2023-12-04 10:11:01 -05:00
dependabot[bot] 2443a9f861 ci: bump the github-actions group with 2 updates (#11018)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-04 16:57:44 +03:00
sharkymark 676e215a91 chore: path app IDEs (#11007) 2023-12-04 11:22:22 +00:00
Mathias Fredriksson 70cede8f7a test(agent): improve TestAgent_Dial tests (#11013)
Refs #11008
2023-12-04 13:11:30 +02:00
Muhammad Atif Ali b212bd4ac5 chore: deploy workspace proxies on fly.io (#10983)
Co-authored-by: Dean Sheather <dean@deansheather.com>
2023-12-04 12:12:22 +03:00
Spike Curtis dbadae5a9c Revert "chore(helm): gitignore and rm helm chart tarballs from vcs (#10951)" (#11009)
This reverts commit 7f62085a02.
2023-12-04 06:59:06 +00:00
Spike Curtis 0536b58b48 fix: parse username/workspace correctly on coder state push --build (#10974)
Fixes the same issue as #10884 but for state push
2023-12-04 09:58:35 +04:00
Szabolcs Fruhwald baf3bf6b9c feat: add workspace_id, owner_name to agent manifest (#10199)
Co-authored-by: Kyle Carberry <kyle@carberry.com>
Co-authored-by: Atif Ali <atif@coder.com>
2023-12-04 00:41:54 +03:00
Michael Smith 28eca2e53f fix: create centralized PaginationContainer component (#10967)
* chore: add Pagination component, add new test, and update other pagination tests

* fix: add back temp spacing for WorkspacesPageView

* chore: update AuditPage to use Pagination

* chore: update UsersPage to use Pagination

* refactor: move parts of Pagination into WorkspacesPageView

* fix: handle empty states for pagination labels better

* docs: rewrite comment for clarity

* refactor: rename components/properties for clarity

* fix: rename component files for clarity

* chore: add story for PaginationContainer

* chore: rename story for clarity

* fix: handle undefined case better

* fix: update imports for PaginationContainer mocks

* fix: update story values for clarity

* fix: update scroll logic to go to the bottom instead of the top

* fix: update mock setup for test

* fix: update stories

* fix: remove scrolling functionality

* fix: remove deprecated property

* refactor: rename prop

* fix: remove debounce flake
2023-12-02 17:37:59 -05:00
Dean Sheather d9a169556a chore: run deploy job on regular runner 2023-12-02 10:08:33 -08:00
Colin Adler 6b3c4c00a2 fix: UpdateWorkspaceDormantDeletingAt interval out of range (#11000) 2023-12-02 11:47:08 -06:00
Colin Adler 49ed66c7ad chore: remove ALTER TYPE .. ADD VALUE from migration 65 (#10998)
Follow up of Follow up of https://github.com/coder/coder/pull/10966
2023-12-02 11:40:23 -06:00
Colin Adler cbcf7561e5 chore: remove ALTER TYPE .. ADD VALUE from migration 46 (#10997)
Follow up of https://github.com/coder/coder/pull/10966
2023-12-02 11:38:12 -06:00
Colin Adler 427572199e chore: remove ALTER TYPE .. ADD VALUE from migration 18 (#10996)
Follow up of https://github.com/coder/coder/pull/10966
2023-12-02 11:35:25 -06:00
Dean Sheather c82e878b50 chore: disable legacy dogfood deploy (#10999) 2023-12-03 02:20:19 +10:00
Colin Adler 8e684c8195 feat: run all migrations in a transaction (#10966)
Updates coder/customers#365

This PR updates our migration framework to run all migrations in a single transaction. This is the same behavior we had in v1 and ensures that failed migrations don't bring the whole deployment down. If a migration fails now, it will automatically be rolled back to the previous version, allowing the deployment to continue functioning.
2023-12-01 16:11:10 -06:00
Garrett Delfosse 60d0aa6930 fix: handle 404 on unknown top level routes (#10964) 2023-12-01 12:35:44 -05:00
Bruno Quaresma 2aa79369a2 refactor(site): improve health check page sidebar (#10960) 2023-12-01 12:43:51 -03:00
Cian Johnston 432925df31 ci: make offlinedocs required (#10980) 2023-12-01 14:37:47 +00:00
Mathias Fredriksson 6fe84025aa chore(Makefile): exclude .terraform directories (#10988) 2023-12-01 15:13:51 +02:00
Marcin Tojek 13b89f79df feat: purge old provisioner daemons (#10949) 2023-12-01 12:43:05 +00:00
Dean Sheather 153abd5003 chore: fix build job pt.3 (#10986) 2023-12-01 12:25:06 +00:00
Dean Sheather 122cbaa134 chore: fix build job (#10984) 2023-12-01 12:08:10 +00:00
Dean Sheather 15875a76ae chore: add new deploy job for new dogfood (#10852) 2023-12-01 03:16:49 -08:00
Cian Johnston 9ad96288b2 fix(helm/provisioner): run helm dependency update (#10982) 2023-12-01 10:30:00 +00:00
Cian Johnston 7f62085a02 chore(helm): gitignore and rm helm chart tarballs from vcs (#10951) 2023-12-01 09:52:54 +00:00
Cian Johnston d49bcc93fe fix(docs): remove anchor links from headings in admin/healthcheck.md (#10975)
Relates to #8965

* Fixes offlinedocs that broke from change in feat(coderd/healthcheck): add access URL error codes and healthcheck doc #10915 by removing the offending anchor links from the page subheadings.
* Makes offlinedocs also conditional on changes to docs
2023-12-01 09:49:18 +00:00
Spike Curtis b267497c6d fix: parse username/workspace correctly on coder state pull --build (#10973)
fixes #10884
2023-12-01 13:03:49 +04:00
Spike Curtis 46d95cb0f0 fix: wait for dial goroutine to complete (#10959)
Fixes flake seen here: https://github.com/coder/coder/runs/19170327767

The goroutine that attempts to dial the socket didn't complete before the test did.  Here we add an explicit wait for it to complete in each run of the loop.
2023-12-01 11:37:32 +04:00
Spike Curtis 812fb95273 fix: prevent connIO from panicking in race between Close and Enqueue (#10948)
Spotted during a code read.  ConnIO unlocks the mutex before attempting to write to the response channel, which could allow another goroutine to call Close() and close the channel, causing a panic.

Fix is to hold the mutex.  This won't cause a deadlock because the `select{}` has a `default` case, so we won't block even if the receiver isn't keeping up.
2023-12-01 10:23:29 +04:00
Spike Curtis 612e67a53b feat: add cleanup of lost tailnet peers and tunnels to PGCoordinator (#10939)
Adds the "lost" peer cleanup queries to PGCoordinator, including tests.
2023-12-01 10:13:29 +04:00
dependabot[bot] d9ccd97d36 chore: bump @adobe/css-tools from 4.3.1 to 4.3.2 in /site (#10970)
Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.3.1 to 4.3.2.
- [Changelog](https://github.com/adobe/css-tools/blob/main/History.md)
- [Commits](https://github.com/adobe/css-tools/commits)

---
updated-dependencies:
- dependency-name: "@adobe/css-tools"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 09:09:33 +03:00
Spike Curtis 571d358e4b feat: add queries to clean lost connections in PGCoordinator (#10938)
Adds cleanup queries to clean out "lost" peer and tunnel state after 24 hours.  We leave this state in the database so that anything trying to connect to the peer can see that it was lost, but clean it up after 24 hours to ensure our table doesn't grow without bounds.
2023-12-01 10:02:30 +04:00
Spike Curtis 0cab6e7763 feat: support graceful disconnect in PGCoordinator (#10937)
Adds support for graceful disconnect to PGCoordinator.  When peers gracefully disconnect, they send a disconnect message.  This triggers the peer to be disconnected from all tunneled peers.

The Multi-Agent Client supports graceful disconnect, since it is in memory and we know that when it is closed, we really mean to disconnect.

The v1 agent and client Websocket connections do not support graceful disconnect, since the v1 protocol doesn't have this feature.  That means that if a v1 peer connects to a v2 peer, when the v1 peer's coordinator connection is closed, the v2 peer will
see it as "lost" since we don't know whether the v1 peer meant to disconnect, or it just lost connectivity to the coordinator.
2023-12-01 09:55:25 +04:00
Jon Ayers 967db2801b chore: refactor ResolveAutostart tests to use dbfake (#10603) 2023-11-30 19:33:04 -06:00
Jon Ayers 12a4b114de fix: fix TestWorkspaceAutobuild/InactiveTTLOK flake (#10965) 2023-11-30 18:29:41 -06:00
Michael Smith d016f93de8 feat: add usePaginatedQuery hook (#10803)
* wip: commit current progress on usePaginatedQuery

* chore: add cacheTime to users query

* chore: update cache logic for UsersPage usersQuery

* wip: commit progress on Pagination

* chore: add function overloads to prepareQuery

* wip: commit progress on usePaginatedQuery

* docs: add clarifying comment about implementation

* chore: remove optional prefetch property from query options

* chore: redefine queryKey

* refactor: consolidate how queryKey/queryFn are called

* refactor: clean up pagination code more

* fix: remove redundant properties

* refactor: clean up code

* wip: commit progress on usePaginatedQuery

* wip: commit current pagination progress

* docs: clean up comments for clarity

* wip: get type signatures compatible (breaks runtime logic slightly)

* refactor: clean up type definitions

* chore: add support for custom onInvalidPage functions

* refactor: clean up type definitions more for clarity reasons

* chore: delete Pagination component (separate PR)

* chore: remove cacheTime fixes (to be resolved in future PR)

* docs: add clarifying/intellisense comments for DX

* refactor: link users queries to same queryKey implementation

* docs: remove misleading comment

* docs: more comments

* chore: update onInvalidPage params for more flexibility

* fix: remove explicit any

* refactor: clean up type definitions

* refactor: rename query params for consistency

* refactor: clean up input validation for page changes

* refactor/fix: update hook to be aware of async data

* chore: add contravariance to dictionary

* refactor: increase type-safety of usePaginatedQuery

* docs: more comments

* chore: move usePaginatedQuery file

* fix: add back cacheTime

* chore: swap in usePaginatedQuery for users table

* chore: add goToFirstPage to usePaginatedQuery

* fix: make page redirects work properly

* refactor: clean up clamp logic

* chore: swap in usePaginatedQuery for Audits table

* refactor: move dependencies around

* fix: remove deprecated properties from hook

* refactor: clean up code more

* docs: add todo comment

* chore: update testing fixtures

* wip: commit current progress for tests

* fix: update useEffectEvent to sync via layout effects

* wip: commit more progress on tests

* wip: stub out all expected test cases

* wip: more test progress

* wip: more test progress

* wip: commit more test progress

* wip: AHHHHHHHH

* chore: finish two more test cases

* wip: add in all tests (still need to investigate prefetching

* refactor: clean up code slightly

* fix: remove math bugs when calculating pages

* fix: wrap up all testing and clean up cases

* docs: update comments for clarity

* fix: update error-handling for invalid page handling

* fix: apply suggestions
2023-11-30 17:44:03 -05:00
Jon Ayers 329aa45c16 fix: fix TestWorkspaceAutobuild/DormantNoAutostart flake (#10963) 2023-11-30 15:45:27 -06:00
Steven Masley 0a16bda786 chore: add external auth providers to oidctest (#10958)
* implement external auth in oidctest
* Refactor more external tests to new oidctest
2023-11-30 14:05:15 -06:00
Mathias Fredriksson 99151183bc feat(scaletest): replace bash with dd in ssh/rpty traffic and use pseudorandomness (#10821)
Fixes #10795
Refs #8556
2023-11-30 19:30:12 +02:00
Cian Johnston 433be7b16d chore(docs/admin/healthcheck): remove GHFM tips (#10954) 2023-11-30 16:33:41 +00:00
Cian Johnston 07895006d9 refactor(coderd/healthcheck): make Warnings an object with { Code, Message } (#10950)
- Adds health.Message { code string, mesasge string }
- Refactors existing warnings []string to be of type []health.Message instead
2023-11-30 14:49:50 +00:00
Cian Johnston 4f9292859d feat(coderd/healthcheck): add access URL error codes and healthcheck doc (#10915)
Relates to #8965

- Added error codes for separate code paths in health checks
- Prefixed errors and warnings with error code prefixes
- Added a docs page with details on each code, cause and solution

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-11-30 12:15:40 +00:00
dependabot[bot] 5b2f43619b chore: bump the react group in /site with 4 updates (#10869)
* chore: bump the react group in /site with 3 updates

Bumps the react group in /site with 3 updates: [react-helmet-async](https://github.com/staylor/react-helmet-async), [react-markdown](https://github.com/remarkjs/react-markdown) and [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom).


Updates `react-helmet-async` from 1.3.0 to 2.0.1
- [Release notes](https://github.com/staylor/react-helmet-async/releases)
- [Commits](https://github.com/staylor/react-helmet-async/commits)

Updates `react-markdown` from 8.0.7 to 9.0.1
- [Release notes](https://github.com/remarkjs/react-markdown/releases)
- [Changelog](https://github.com/remarkjs/react-markdown/blob/main/changelog.md)
- [Commits](https://github.com/remarkjs/react-markdown/compare/8.0.7...9.0.1)

Updates `react-router-dom` from 6.16.0 to 6.20.0
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.20.0/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-helmet-async
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: react
- dependency-name: react-markdown
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: react
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: react
...

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

* fix lint

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Atif Ali <atif@coder.com>
2023-11-29 23:11:59 +03:00
Garrett Delfosse d41f9f8b47 fix: do not allow selection of unsuccessful versions (#10941) 2023-11-29 13:01:17 -05:00
Bruno Quaresma 2e8ab2aeaf chore(site): enable react-query cache (#10943) 2023-11-29 17:53:11 +00:00
Bruno Quaresma e4d7b0b664 docs: update FE guide (#10942) 2023-11-29 17:27:36 +00:00
Marcin Tojek 2b574e2b2d feat: add dismissed property to the healthcheck section (#10940) 2023-11-29 16:37:40 +00:00
Kira Pilot d374becdeb fix: redirect to new url after template name update (#10926)
* fix: updating template name routes to correct URL

* added e2e test
2023-11-29 10:54:21 -05:00
Kira Pilot 88f4490ad6 fix: clear workspace name validation on field dirty (#10927) 2023-11-29 10:53:45 -05:00
Steven Masley cb6c0f3cbb chore: refactor oidc group and role sync to methods (#10918)
The 'userOIDC' method body was getting unwieldy.
I think there is a good way to redesign the flow, but
I do not want to undertake that at this time.
The easy win is just to move some LoC to other methods
and cleanup the main method.
2023-11-29 09:24:00 -06:00
Spike Curtis 2b71e38b31 feat: add status to tailnet mapping query (#10936)
Adds the `status` column to the mapping query so that we can add graceful disconnect logic around it
2023-11-29 16:53:01 +04:00
Mathias Fredriksson f431aa53d2 chore(go.mod): update github.com/coder/ssh (#10934) 2023-11-29 13:19:49 +02:00
Spike Curtis 2dc565d5de chore: remove New----Builder from dbfake function names (#10882)
Drop "New" and "Builder" from the function names, in favor of the top-level resource created.  This shortens tests and gives a nice syntax.  Since everything is a builder, the prefix and suffix don't add much value and just make things harder to read.

I've also chosen to leave `Do()` as the function to insert into the database.  Even though it's a builder pattern, I fear `.Build()` might be confusing with Workspace Builds.  One other idea is `Insert()` but if we later add dbfake functions that update, this might be inconsistent.
2023-11-29 11:06:04 +04:00
Jon Ayers 48d69c9e60 fix: update autostart context to include querying users (#10929) 2023-11-28 17:56:49 -06:00
Bruno Quaresma e9c12c30cf feat(site): refactor template version editor layout (#10912) 2023-11-28 16:42:31 -03:00
Garrett Delfosse afbda2235c fix: insert replica when removed by cleanup (#10917) 2023-11-28 14:15:09 -05:00
Spike Curtis 52901e1219 feat: implement HTMLDebug for PGCoord with v2 API (#10914)
Implements HTMLDebug for the PGCoordinator with the new v2 API and related DB tables.
2023-11-28 22:37:20 +04:00
Eric Paulsen 18c4a98865 fix: numerical validation grammer (#10924) 2023-11-28 10:14:53 -08:00
Marcin Tojek 19b6d194fc feat: manage health settings using Coder API (#10861) 2023-11-28 18:15:17 +01:00
Dean Sheather 452668c893 chore: avoid dbmock test errors in dbgen (#10923) 2023-11-28 17:04:25 +00:00
Spike Curtis 14bd489af6 feat: add queries for PGCoord HTMLDebug (#10913)
Adds queries for implementing HTMLDebug on the new PGCoordinator
2023-11-28 20:19:32 +04:00
Dean Sheather 3416f6dfb5 chore: update port-forwarding documentation (#10916) 2023-11-28 23:54:19 +10:00
Bruno Quaresma 6808daef0f chore(site): use variable font for Inter (#10903) 2023-11-27 21:35:29 +00:00
Garrett Delfosse 74c5261013 fix: add spacing for yes/no prompts (#10907) 2023-11-27 16:12:07 -05:00
Michael Smith 1f6e39c0b0 fix: hide groups in account page if not enabled (#10898) 2023-11-27 14:06:00 -05:00
Bruno Quaresma a4d74b8b44 chore(site): remove paperLight background value (#10857)
I noticed we have been overusing colors in the UI, so simplifying is better for the "look and feel" and maintaining the styles over time. 

![image](https://github.com/coder/coder/assets/3165839/f70c831d-eba8-4521-820a-6257ae0bedf1)

If you want to have a better sense of what it looks like, I recommend you go to the Chromatic snapshot.
2023-11-27 15:52:20 -03:00
dependabot[bot] c634a38bd7 ci: bump the github-actions group with 1 update (#10890)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-27 21:47:26 +03:00
Muhammad Atif Ali 4cb94d1347 chore: update dependabot to use single groups (#10870)
* chore: update dependabot.yaml to use single groups

This will hopefully reduce @dependabot spamming PRs.

* Update dependabot.yaml
2023-11-27 21:27:58 +03:00
Kira Pilot 54c3fc63d9 fix: docuemnt workspace filter query param correctly (#10894) 2023-11-27 12:57:24 -05:00
Steven Masley 20525c8b2e chore: add script to analyze which releases have migrations (#10823)
* chore: add script to analyze which releases have migrations
2023-11-27 10:53:32 -06:00
Steven Masley abb2c7656a chore: add claims to oauth link in db for debug (#10827)
* chore: add claims to oauth link in db for debug
2023-11-27 10:47:23 -06:00
Cian Johnston 0534f8f59b fix(provisionersdk): use mtime instead of atime for session cleanup (#10893)
See #10892

- Updates provisionersdk session cleanup to use mtime instead of atime.
- Also runs go mod tidy.
2023-11-27 16:21:59 +00:00
Dean Sheather f28df8e7b8 chore: update wgtunnel to avoid panic (#10877) 2023-11-28 02:19:40 +10:00
Cian Johnston 0babc3c555 fix(provisioner/terraform/cleanup): use mtime instead of atime (#10892)
- Updates plugin staleness check to check mtime instead of atime, as atime has been shown to be unreliable
- Updates existing unit test to use a real filesystem as Afero's in-memory FS doesn't support atimes at all
2023-11-27 15:19:41 +00:00
Bruno Quaresma 707d0e97d9 fix(site): fixsidebar styles (#10891) 2023-11-27 09:55:20 -03:00
Mathias Fredriksson f441ad66e1 fix(codersdk): keep workspace agent connection open after dial context (#10863) 2023-11-27 14:29:57 +02:00
Spike Curtis 3a0a4ddfcd chore: convert dbfake.ProvisionerJobResources to builder (#10881)
Convert to builder for consistency with rest of the package.  This will make it easier to use, and means we can drop "Builder" from function arguments since they are all builders in the package.
2023-11-27 14:46:31 +04:00
Spike Curtis 4548ad7cef chore: remove dbfake.Workspace (#10880)
Remove dbfake.Workspace and use builder instead.
2023-11-27 14:39:16 +04:00
Spike Curtis 78283a7fb9 chore: remove dbfake.WorkspaceWithAgent (#10879)
Replace dbfake.WorkspaceWithAgent() with the builder pattern and remove this function.
2023-11-27 14:30:15 +04:00
Spike Curtis 82d5130b07 chore: convert dbfake.Workspace and .WorkspaceWithAgent to a builder pattern (#10878)
Converts dbfake Workspace and WorkspaceWithAgent to builder pattern.
2023-11-27 14:16:31 +04:00
Cian Johnston b73397e08c fix(site): add workspace proxy section to health page (#10862)
* Adds workspace proxy section to health page
* Conditionally places workspace proxy warnings in errors or warnings based on calculated severity
* Adds some more stories we were missing for HealthPage
2023-11-27 09:26:02 +00:00
Spike Curtis 6c67add2d9 fix: detect and retry reverse port forward on used port (#10844)
Fixes #10799

The flake happens when we try to remote forward, but the port we've chosen is not free.  In the flaked example, it's actually the SSH listener that occupies the port we try to remote forward, leading to confusing reads (c.f. the linked issue).

This fix simplies the tests considerably by using the Go ssh client, rather than shelling out to OpenSSH.  This avoids using a pseudoterminal, avoids the need for starting any local OS listeners to communicate the forwarding (go SSH just returns in-process listeners), and avoids an OS listener to wire OpenSSH up to the agentConn.

With the simplied logic, we can immediately tell if a remote forward on a random port fails, so we can do this in a loop until success or timeout.

I've also simplified and fixed up the other forwarding tests. Since we set up forwarding in-process with Go ssh, we can remove a lot of the `require.Eventually` logic.
2023-11-27 09:42:45 +04:00
Dean Sheather d5ddcbdda0 chore: fix flake in templates_test.go (#10875) 2023-11-27 15:29:10 +10:00
lbi22 7029ccfbdf feat: add support for custom permissions in Helm chart rbac.yaml file (#10590)
Co-authored-by: Dean Sheather <dean@deansheather.com>
Co-authored-by: Atif Ali <atif@coder.com>
2023-11-27 14:12:46 +10:00
Ben Potter 3530d39740 docs: fix typo in additional-clusters.md (#10868) 2023-11-26 12:53:33 +00:00
Cian Johnston dd161b172e feat: allow auditors to read template insights (#10860)
- Adds a template_insights pseudo-resource
- Grants auditor and template admin roles read access on template_insights
- Updates existing RBAC checks to check for read template_insights, falling back to template update permissions where necessary
- Updates TemplateLayout to show Insights tab if can read template_insights or can update template
2023-11-24 17:21:32 +00:00
Mathias Fredriksson e73901cf56 fix(coderd): remove nil ptr deref in watchWorkspace (#10859)
Fixes #10849
2023-11-24 15:16:21 +00:00
Cian Johnston 411ce46442 feat(coderd/healthcheck): add health check for proxy (#10846)
Adds a health check for workspace proxies:
- Healthy iff all proxies are healthy and the same version,
- Warning if some proxies are unhealthy,
- Error if all proxies are unhealthy, or do not all have the same version.
2023-11-24 15:06:51 +00:00
Marcin Tojek b501046cf9 test: increase test coverage around health severity (#10858) 2023-11-24 15:42:17 +01:00
Mathias Fredriksson 61be4dfe5a fix: improve exit codes for agent/agentssh and cli/ssh (#10850) 2023-11-24 14:35:56 +02:00
Mathias Fredriksson dbdcad0d09 test(agent/agentssh): fix flake in signal test (#10855) 2023-11-24 13:47:40 +02:00
Marcin Tojek 34841cf2b7 fix: healthcheck warnings should be empty array (#10856) 2023-11-24 12:37:07 +01:00
Mathias Fredriksson 2c6e0f7d0a feat(agent/agentssh): handle session signals (#10842) 2023-11-23 19:55:36 +02:00
Marcin Tojek a7c27cad26 feat: add database support for dismissed healthchecks (#10845) 2023-11-23 16:18:12 +00:00
Cian Johnston f342d10c31 fix(enterprise/coderd/proxyhealth): properly defer healthCheckDuration observe (#10848) 2023-11-23 15:23:40 +00:00
Marcin Tojek 78df68348a feat: include health severity in reports (#10817) 2023-11-23 16:08:41 +01:00
sharkymark e311e9ec24 chore: correct disabling direct and STUN; add vs code remote required URLs (#10830)
* chore: correct disabling direct and STUN; add vs code remote required URLs

* chore: offline docs
2023-11-22 20:04:56 -06:00
Michael Smith 491e0e3abf fix: display explicit 'retry' button(s) when a workspace fails (#10720)
* refactor: remove workspace error enums

* fix: add in retry button for failed workspaces

* fix: make handleBuildRetry auto-detect debug permissions

* chore: consolidate retry messaging

* chore: update renderWorkspacePage to accept parameters

* chore: make workspace test helpers take explicit workspace parameter

* refactor: update how parameters for tests are defined

* fix: update old tests to be correctly parameterized
2023-11-22 16:03:09 -05:00
dependabot[bot] 65c726eb50 chore: bump eslint from 8.52.0 to 8.53.0 in /offlinedocs (#10686)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-22 21:35:05 +03:00
Colin Adler 7f39ff854e fix: skip autostart for suspended/dormant users (#10771) 2023-11-22 11:14:32 -06:00
Zubarev Alexander 614c17924c fix(docs): disable CODER_DERP_SERVER_STUN_ADDRESSES correctly (#10840) 2023-11-22 11:14:01 -06:00
Mathias Fredriksson 6ecba0fda7 fix(coderd): prevent logging error for query cancellation in watchWorkspaceAgentMetadata (#10843) 2023-11-22 15:32:31 +00:00
Bruno Quaresma d58239b9ec chore(site): ignore chromatic changes on syntax highlight (#10839) 2023-11-22 09:51:46 -03:00
Bruno Quaresma ddf5569b10 fix(site): fix tabs (#10838) 2023-11-22 09:33:02 -03:00
Mathias Fredriksson a20ec6659d fix(site): use correct default insights time for day interval (#10837) 2023-11-22 12:30:04 +00:00
Spike Curtis 89c13c2212 fix: enable FeatureHighAvailability if it is licensed (#10834)
fixes #10810

The tailnet coordinators don't depend on replicasync, so we can still enable HA coordinators even if the relay URL is unset.

The in-memory, non-HA coordinator probably has lower latency than the PG Coordinator, since we have to query the database, so enterprise customers might want to disable it for single-replica deployments, but this PR default-enables the HA coordinator.  We could add support later to disable it if anyone complains. Latency setting up connections matters, but I don't believe the coordinator contributes significantly at this point for reasonable postgres round-trip-time.
2023-11-22 14:46:55 +04:00
Marcin Tojek 8dd003ba5e fix: preserve order of node reports in healthcheck (#10835) 2023-11-22 11:15:11 +01:00
dependabot[bot] 60c01555b9 chore: bump react-icons from 4.11.0 to 4.12.0 in /offlinedocs (#10687)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-22 13:00:59 +03:00
Dean Sheather a9c0c01629 chore: fix flake in listening ports test (#10833) 2023-11-22 09:30:51 +00:00
Spike Curtis f20cc66c04 fix: give SSH stdio sessions a chance to close before closing netstack (#10815)
Man, graceful shutdown is hard.  Even after my changes, we were still hitting a graceful shutdown race: https://github.com/coder/coder/runs/18886842123

The problem was that while we attempt a graceful shutdown at the SSH layer by closing the session for writing, we were not giving it a chance to complete before continuing to tear down the stack of closers, including one that closes the netstack, and thus drop the TCP connection before it closes.
2023-11-22 13:11:21 +04:00
Spike Curtis b25e5dc90b chore: remove dbfake.WorkspaceBuild in favor of builder pattern (#10814)
I'd like to convert dbfake into a builder pattern to prevent a proliferation of XXXWithYYY methods.  This is one step of the way by removing the Non-builder function.
2023-11-22 13:04:58 +04:00
dependabot[bot] b73d9d788b chore: bump github.com/go-jose/go-jose/v3 from 3.0.0 to 3.0.1 (#10828)
Bumps [github.com/go-jose/go-jose/v3](https://github.com/go-jose/go-jose) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/v3/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-22 08:21:59 +03:00
Jon Ayers 8d1cfbce8f fix: update workspace cleanup flag names for template cmds (#10805) 2023-11-21 18:20:01 -06:00
Jon Ayers 51b58cfc98 fix: only update last_used_at when connection count > 0 (#10808) 2023-11-21 18:10:41 -06:00
Jon Ayers 782fe84c7c feat: disable start/restart if active version required (#10809) 2023-11-21 18:06:30 -06:00
Marcin Tojek 214123d476 test: skip flaky HealthyWithNodeDegraded (#10826) 2023-11-21 20:46:58 +01:00
Muhammad Atif Ali 1c2f9e3199 chore: refactoring to move the notes at top 2023-11-21 22:03:21 +03:00
Kayla Washburn 8cd8901db5 refactor: avoid @emotion/css when possible (#10807) 2023-11-21 11:29:43 -07:00
Kayla Washburn 26b5390f4b refactor: remove usage of styled and withStyles (#10806) 2023-11-21 10:43:01 -07:00
Jon Ayers ad3eb4bb75 Revert "docs: add documentation for template update policies (#10804)" (#10822)
This reverts commit e6dc9eeffc.
2023-11-21 17:10:08 +00:00
dependabot[bot] d0ac4cb4b1 chore: bump prettier from 3.0.0 to 3.1.0 in /site (#10695)
* chore: bump prettier from 3.0.0 to 3.1.0 in /site

Bumps [prettier](https://github.com/prettier/prettier) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.0.0...3.1.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

* prettier

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kira Pilot <kira.pilot23@gmail.com>
2023-11-21 11:48:40 -05:00
Kayla Washburn e51eeb67ce refactor: improve settings sidebar components (#10801) 2023-11-21 09:38:55 -07:00
dependabot[bot] 7fa70ce159 chore: bump github.com/aws/smithy-go from 1.16.0 to 1.17.0 (#10788)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 16:33:15 +03:00
dependabot[bot] 4590149810 chore: bump google.golang.org/api from 0.150.0 to 0.151.0 (#10787)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 16:32:49 +03:00
Spike Curtis 5d5b5aa074 chore: use dbfake for ssh tests rather than provisionerd (#10812)
Refactors SSH tests to skip provisionerd and instead use dbfake to insert workspaces and builds.  This should make tests faster and more reliable.

dbfake.WorkspaceBuild is refactored to use a "builder" pattern with "fluent" options, as the number of options and variants was starting to get out of hand.
2023-11-21 16:22:08 +04:00
Marcin Tojek 048dc0450f feat: ensure coder remains healthy with single degraded DERP server (#10813) 2023-11-21 12:58:25 +01:00
Cian Johnston abafc0863c feat(coderd): store workspace proxy version in the database (#10790)
Stores workspace proxy version in database upon registration.
2023-11-21 11:21:25 +00:00
Steven Masley 7060069034 fix: prevent change in defaults if user unsets in template edit (#10793)
* fix: template edit not change defaults if user unset
2023-11-20 18:14:30 -06:00
Jon Ayers e6dc9eeffc docs: add documentation for template update policies (#10804)
Co-authored-by: Ben Potter <ben@coder.com>
2023-11-20 16:30:24 -06:00
Kira Pilot ace188bfc2 fix: clarify language in orphan section of delete modal (#10764)
* fix: clarify language in orphan section of delete modal

* tinted title

* Update site/src/pages/WorkspacePage/WorkspaceDeleteDialog/WorkspaceDeleteDialog.tsx

Co-authored-by: Muhammad Atif Ali <atif@coder.com>

* prettier

---------

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-11-20 15:04:51 -05:00
Steven Masley 5229d7fd3a feat: implement deprecated flag for templates to prevent new workspaces (#10745)
* feat: implement deprecated flag for templates to prevent new workspaces
* Add deprecated filter to template fetching
* Add deprecated to template table
* Add deprecated notice to template page
* Add ui to deprecate a template
2023-11-20 19:16:18 +00:00
Marcin Tojek d8df87d5ae fix: insights metrics comparison (#10800)
* fix: insights metrics comparison

* links
2023-11-20 18:37:46 +01:00
Mathias Fredriksson 6b3f599438 fix(site): correctly interpret timezone based on offset in formatOffset (#10797)
Fixes #10784
2023-11-20 19:30:09 +02:00
Kayla Washburn 9b6433e3a7 chore: remove theme experiment (#10798)
Co-authored-by: Kyle Carberry <kyle@carberry.com>
2023-11-20 09:53:20 -07:00
Spike Curtis 92ef0baff3 fix: remove pty match for TestSSH/RemoteForward (#10789)
Fixes #10578
2023-11-20 20:50:09 +04:00
Michael Smith df4f34ac15 fix: prevent alt text from appearing if OIDC icon fail to load (#10792)
* fix: update alt text issue
2023-11-20 10:51:25 -05:00
Bruno Quaresma fbec79f35d refactor(site): refactor login screen (#10768) 2023-11-20 11:19:50 -03:00
Bruno Quaresma 2895c108c2 chore(site): remove Typography component (#10769)
* Remove Typography from NavbarView

* Remove Typography from EmptyState

* Remove Typography from Paywall

* Fix font size

* Remove Typography from CliAuthPage

* Remove Typography from Single SignOn

* Remove Typography from file dialog

* Remove from not found

* Remove from Section

* Remove from global snackbar

* Remove Typography component

* Add eslint role
2023-11-20 10:15:40 -03:00
Spike Curtis 5173bce5cc fix: stop redirecting DERP and replicasync http requests (#10752)
Fixes an issue where setting CODER_REDIRECT_TO_ACCESS_URL breaks use of multiple Coder server replicas for DERP traffic.
2023-11-20 14:46:59 +04:00
Spike Curtis 5c48cb4447 feat: modify PG Coordinator to work with new v2 Tailnet API (#10573)
re: #10528

Refactors PG Coordinator to work with the Tailnet v2 API, including wrappers for the existing v1 API.

The debug endpoint functions, but doesn't return sensible data, that will be in another stacked PR.
2023-11-20 14:31:04 +04:00
Muhammad Atif Ali a8c25180db fix(docs): fix a broken link (#10783) 2023-11-20 12:49:07 +03:00
JounQin 148eb90bda docs: migrate all deprecated CODER_ADDRESS to CODER_HTTP_ADDRESS (#10780)
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
2023-11-19 17:54:02 +00:00
JounQin 9b864ed700 docs: align CODER_HTTP_ADDRESS with document (#10779) 2023-11-19 15:38:39 +00:00
Ammar Bandukwala cfe35f54b4 feat(cli/agent): preserve old logs (#10776)
See https://github.com/coder/coder/pull/7815 for background.
2023-11-18 10:53:56 -06:00
Eric Paulsen 328a383f15 fix: set ignore_changes on EC2 example templates (#10773) 2023-11-18 01:07:27 -05:00
Colin Adler 3aef070959 fix: return non-null warning arrays in healthcheck (#10774) 2023-11-17 22:25:44 +00:00
Cian Johnston 2c3ebc50cb fix(site): handle null warnings in health page (#10775) 2023-11-17 22:10:13 +00:00
Ben Potter d19a762589 docs: add v2.4.1 changelog (#10770) 2023-11-17 14:46:07 -06:00
Steven Masley 0f17d7c144 chore: return context.Canceled when in Prepare for rbac (#10763)
Was returning a custom rego canceled error. This conforms with
how Authorize handles this error.
2023-11-17 20:28:59 +00:00
Kayla Washburn 875cae1fc9 chore: lint sink_test.go (#10765) 2023-11-17 09:45:24 -07:00
Steven Masley e448c10122 chore: add uuid's to ssh sessions for logging (#10721)
* chore: add uuid to ssh connection logs
2023-11-17 16:04:23 +00:00
Cian Johnston befb42b6fd feat(site): add refresh button on health page (#10719)
Adds a button on DeploymentHealth page to immediately re-run the healthcheck.

Co-authored-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>
2023-11-17 15:26:25 +00:00
Bruno Quaresma e6f11a383a refactor(site): add minor improvements to the schedule controls (#10756)
Demo:

https://github.com/coder/coder/assets/3165839/d6ea83c0-6390-42d9-bd48-3438fc8685db
2023-11-17 12:03:44 -03:00
Bruno Quaresma 20c2dda13f refactor(site): replace secondary by primary color (#10757) 2023-11-17 12:02:58 -03:00
Bruno Quaresma b508c325b1 refactor(site): add minor tweaks to the workspace delete dialog (#10758)
Before:
<img width="483" alt="Screenshot 2023-11-17 at 11 29 25" src="https://github.com/coder/coder/assets/3165839/28e07832-d816-48d3-a3d5-500227f2799e">

After:
<img width="491" alt="Screenshot 2023-11-17 at 11 29 30" src="https://github.com/coder/coder/assets/3165839/e01bc181-34af-4299-b86a-9081a5efd954">
2023-11-17 12:01:57 -03:00
Marcin Tojek 8999d5785a feat: do not fail DERP healthcheck if WebSocket is used (#10714) 2023-11-17 16:00:49 +01:00
Bruno Quaresma 24aa223399 refactor(site): adjust a few colors (#10750) 2023-11-17 09:27:07 -03:00
Bruno Quaresma 4121121797 fix(site): prevent overwriting of newest workspace data during optimistic updates (#10751) 2023-11-17 09:13:46 -03:00
Spike Curtis 71f87d054f fix: accept legacy redirect HTTP environment variables (#10748)
> Can someone help me understand the differences between these env variables:
>
>    CODER_REDIRECT_TO_ACCESS_URL
>    CODER_TLS_REDIRECT_HTTP_TO_HTTPS
>    CODER_TLS_REDIRECT_HTTP

Oh man, what a mess. It looks like `CODER_TLS_REDIRECT_HTTP ` appears in our config docs. Maybe that was the initial name for the environment variable?

At some point, both the flag and the environment variable were `--tls-redirect-http-to-https` and `CODER_TLS_REDIRECT_HTTP_TO_HTTPS`.  `CODER_TLS_REDIRECT_HTTP` did nothing.

However, then we introduced `CODER_REDIRECT_TO_ACCESS_URL`, we put in some deprecation code that was maybe fat-fingered such that we accept the environment variable `CODER_TLS_REDIRECT_HTTP` but the flag `--tls-redirect-http-to-https`.  Our docs still refer to `CODER_TLS_REDIRECT_HTTP` at https://coder.com/docs/v2/latest/admin/configure#address

So, I think what we gotta do is still accept `CODER_TLS_REDIRECT_HTTP` since it was working and in an example doc, but also fix the deprecation code to accept `CODER_TLS_REDIRECT_HTTP_TO_HTTPS` environment variable.
2023-11-17 15:09:29 +04:00
Marcin Tojek fc249fab1e skip TestCollectInsights (#10749) 2023-11-17 10:57:53 +01:00
Spike Curtis 3dd35e019b fix: close ssh sessions gracefully (#10732)
Re-enables TestSSH/RemoteForward_Unix_Signal and addresses the underlying race: we were not closing the remote forward on context expiry, only the session and connection.

However, there is still a more fundamental issue in that we don't have the ability to ensure that TCP sessions are properly terminated before tearing down the Tailnet conn.  This is due to the assumption in the sockets API, that the underlying IP interface is long 
lived compared with the TCP socket, and thus closing a socket returns immediately and does not wait for the TCP termination handshake --- that is handled async in the tcpip stack.  However, this assumption does not hold for us and tailnet, since on shutdown,
we also tear down the tailnet connection, and this can race with the TCP termination.

Closing the remote forward explicitly should prevent forward state from accumulating, since the Close() function waits for a reply from the remote SSH server.

I've also attempted to workaround the TCP/tailnet issue for `--stdio` by using `CloseWrite()` instead of `Close()`.  By closing the write side of the connection, half-close the TCP connection, and the server detects this and closes the other direction, which then
triggers our read loop to exit only after the server has had a chance to process the close.

TODO in a stacked PR is to implement this logic for `vscodessh` as well.
2023-11-17 12:43:20 +04:00
Bruno Quaresma ba955f44d0 fix(site): fix scroll when having many build options (#10744) 2023-11-16 22:13:59 +00:00
Bruno Quaresma 88c1ee6d52 chore(site): increase stop workspace timeout (#10742) 2023-11-16 18:27:51 -03:00
Kayla Washburn 111ac3de8a chore: switch to zinc for our gray palette (#10740) 2023-11-16 14:22:40 -07:00
Bruno Quaresma fefe02c2df fix(site): fix group name validation (#10739) 2023-11-16 18:16:24 -03:00
Kira Pilot 9f3a955ebf fix: show all experiments in deployments list if opted into (#10722) 2023-11-16 10:53:35 -05:00
Marcin Tojek 0e5eecd7da feat: add more logging around echo tar (#10731) 2023-11-16 16:52:04 +01:00
dependabot[bot] ced6ae01b7 chore: bump prettier from 3.0.0 to 3.1.0 in /offlinedocs (#10688)
Bumps [prettier](https://github.com/prettier/prettier) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.0.0...3.1.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-16 12:31:32 -03:00
Bruno Quaresma f47ecb54aa chore: disable trial activation on e2e tests (#10683) 2023-11-16 12:19:22 -03:00
Mathias Fredriksson 198b56c137 fix(coderd): fix memory leak in watchWorkspaceAgentMetadata (#10685)
Fixes #10550
2023-11-16 17:03:53 +02:00
Dean Sheather c130f8d6d0 chore: disable test on save in vscode (#10730) 2023-11-16 22:27:08 +10:00
Dean Sheather 10204ba829 chore: retry healthcheck in proxy region test (#10729) 2023-11-16 22:21:16 +10:00
Jon Ayers 9ac44aa74f fix: disable autoupdate workspace setting when template setting enabled (#10662) 2023-11-15 16:58:55 -06:00
Kayla Washburn 8ddc8b3447 site: new dark theme (#10331) 2023-11-15 14:39:26 -07:00
Cian Johnston bd17290ff4 chore(coderd/autobuild): address some logic errors in autostart tests (#10713) 2023-11-15 16:26:10 +00:00
Kira Pilot 38163edf2f feat: allow autostop to be specified in minutes and seconds (#10707)
* feat: allow autostop to be specified in minutes and seconds

* fix test
2023-11-15 11:01:26 -05:00
Cian Johnston 9d310388e5 feat(coderd): /debug/health: add parameter to force healthcheck (#10677) 2023-11-15 15:54:15 +00:00
Steven Masley 290180b104 feat!: bump workspace activity by 1 hour (#10704)
Marked as a breaking change as the previous activity bump was always the TTL duration of the workspace/template.

This change is more cost conservative, only bumping by 1 hour for workspace activity. To accommodate wrap around, eg bumping a workspace into the next autostart, the deadline is bumped by the TTL if the workspace crosses the autostart threshold.

This is a niche case that is likely caused by an idle terminal making a workspace survive through a night. The next morning, the workspace will get activity bumped the default TTL on the autostart, being similar to as if the workspace was autostarted again.

In practice, a good way to avoid this is to set a max_deadline of <24hrs to avoid wrap around entirely.
2023-11-15 09:42:27 -06:00
Cian Johnston 6085b92fae feat(site): add annotation to display values of type clibase.Duration correctly (#10667)
* Adds an annotation format_duration_ns to all deployment values of type clibase.Duration
* Adds a unit test that complains if you forget to add the above annotation to a clibase.Duration
* Modifies optionValue() to check for the presence of format_duration_ns when displaying an option.
2023-11-15 12:29:20 +00:00
Spike Curtis 34c9661f1b fix: disable flaky test TestSSH/RemoteForward_Unix_Signal (#10711) 2023-11-15 11:04:36 +00:00
Spike Curtis 1516c6636b feat: add SQL queries for v2 PG Coordinator (#10572)
re #10528

Adds SQL queries to support Tailnet v2 API in the PG Coordinator
2023-11-15 10:13:27 +04:00
dependabot[bot] a8ce099638 chore: bump @octokit/types from 12.1.1 to 12.3.0 in /site (#10693)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-15 01:02:53 +03:00
dependabot[bot] b568344fe1 chore: bump chromatic from 7.6.0 to 9.0.0 in /site (#10697)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-15 01:02:28 +03:00
dependabot[bot] 3ae438b968 chore: bump cronstrue from 2.41.0 to 2.43.0 in /site (#10698)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-15 01:01:53 +03:00
dependabot[bot] acda90236d chore: bump ts-proto from 1.163.0 to 1.164.0 in /site (#10699)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-15 01:01:07 +03:00
dependabot[bot] f623153438 chore: bump @testing-library/react from 14.0.0 to 14.1.0 in /site (#10700)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-15 01:00:46 +03:00
Ben Potter f3ffcba63b chore: clarify namespace requirement for kubernetes template (#10657) 2023-11-14 21:50:58 +00:00
Ben Potter 3091f8f70c chore: fix docs for max lifetime (#10706) 2023-11-14 21:08:06 +00:00
dependabot[bot] c14c1cce13 ci: bump the github-actions group with 1 update (#10694)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-14 20:15:52 +00:00
Colin Adler cb22df9bea chore: tidy go.mod (#10703) 2023-11-14 14:12:58 -06:00
Colin Adler fbfd192370 chore: update openssl in Dockerfile (#10701)
Includes a security fix for CVE-2023-5363 and CVE-2023-5678.
2023-11-14 13:40:30 -06:00
Spike Curtis 4894eda711 feat: capture cli logs in tests (#10669)
Adds a Logger to cli Invocation and standardizes CLI commands to use it.  clitest creates a test logger by default so that CLI command logs are captured in the test logs.

CLI commands that do their own log configuration are modified to add sinks to the existing logger, rather than create a new one.  This ensures we still capture logs in CLI tests.
2023-11-14 22:56:27 +04:00
Bruno Quaresma 90b6e86555 chore(site): remove xstate (#10659) 2023-11-14 18:34:38 +00:00
Kira Pilot ef70165a8a feat: add orphan option to workspace delete in UI (#10654)
* added workspace delete dialog

* added stories and tests

* PR review

* fix flake

* fixed stories
2023-11-14 11:32:05 -05:00
dependabot[bot] 4f08330297 chore: bump github.com/coder/retry from 1.4.0 to 1.5.1 (#10672)
Bumps [github.com/coder/retry](https://github.com/coder/retry) from 1.4.0 to 1.5.1.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/coder/retry/commit/f5ccc4d2d45135bf65c7ccc5e78942dd7df19c84"><code>f5ccc4d</code></a> Fix double-scaling bug</li>
<li><a href="https://github.com/coder/retry/commit/14c7c27e14e40827a36754dd2071b09249d426f8"><code>14c7c27</code></a> Add support for Jitter (<a href="https://redirect.github.com/coder/retry/issues/28">#28</a>)</li>
<li><a href="https://github.com/coder/retry/commit/12627b155ff59e5f62c15d262ba1ba06f17daa90"><code>12627b1</code></a> Update README to give a goto example</li>
<li><a href="https://github.com/coder/retry/commit/a8710231a1a7a7f884eb894aca0bee24c5caf21c"><code>a871023</code></a> Make minor format improvements to README</li>
<li>See full diff in <a href="https://github.com/coder/retry/compare/v1.4.0...v1.5.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/coder/retry&package-manager=go_modules&previous-version=1.4.0&new-version=1.5.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions


</details>
2023-11-14 10:00:07 -06:00
dependabot[bot] 4965f1853b chore: bump github.com/fergusstrange/embedded-postgres from 1.24.0 to 1.25.0 (#10674)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-14 12:51:00 +00:00
Spike Curtis dc4b1ef406 fix: lock log sink against concurrent write and close (#10668)
fixes #10663
2023-11-14 16:38:34 +04:00
dependabot[bot] 530be2f96a chore: bump github.com/valyala/fasthttp from 1.50.0 to 1.51.0 (#10671)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-14 12:35:10 +00:00
dependabot[bot] 1b20b3cfa8 chore: bump google.golang.org/api from 0.148.0 to 0.150.0 (#10673)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-14 12:28:21 +00:00
Colin Adler e0afee1b85 feat: add debug endpoint for single tailnet (#10485) 2023-11-13 17:14:12 -06:00
dependabot[bot] f4de2b64ec chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.56.1 to 1.57.0 (#10647)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-14 00:58:27 +03:00
dependabot[bot] 3f4791c9de ci: bump the github-actions group with 4 updates (#10649)
Bumps the github-actions group with 4 updates: [crate-ci/typos](https://github.com/crate-ci/typos), [actions/github-script](https://github.com/actions/github-script), [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action) and [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action).


Updates `crate-ci/typos` from 1.16.22 to 1.16.23
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.16.22...v1.16.23)

Updates `actions/github-script` from 5 to 6
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v5...v6)

Updates `DeterminateSystems/nix-installer-action` from 6 to 7
- [Release notes](https://github.com/determinatesystems/nix-installer-action/releases)
- [Commits](https://github.com/determinatesystems/nix-installer-action/compare/v6...v7)

Updates `aquasecurity/trivy-action` from 0.13.1 to 0.14.0
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](https://github.com/aquasecurity/trivy-action/compare/f78e9ecf42a1271402d4f484518b9313235990e1...2b6a709cf9c4025c5438138008beaddbb02086f0)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: DeterminateSystems/nix-installer-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 22:53:19 +03:00
dependabot[bot] 4a0ca8aa5b chore: bump github.com/go-playground/validator/v10 (#10646)
Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.15.1 to 10.16.0.
- [Release notes](https://github.com/go-playground/validator/releases)
- [Commits](https://github.com/go-playground/validator/compare/v10.15.1...v10.16.0)

---
updated-dependencies:
- dependency-name: github.com/go-playground/validator/v10
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 22:49:55 +03:00
dependabot[bot] 1fe5c969c7 chore: bump github.com/hashicorp/terraform-json (#10648)
Bumps [github.com/hashicorp/terraform-json](https://github.com/hashicorp/terraform-json) from 0.17.2-0.20230905102422-cd7b46b136bb to 0.18.0.
- [Release notes](https://github.com/hashicorp/terraform-json/releases)
- [Commits](https://github.com/hashicorp/terraform-json/commits/v0.18.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/terraform-json
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 22:48:42 +03:00
Jon Ayers 75ab16d19a fix: prevent db deadlock when workspaces go dormant (#10618) 2023-11-13 13:40:20 -06:00
dependabot[bot] 76e7a1d06b chore: bump the golang-x group with 4 updates (#10644)
Bumps the golang-x group with 4 updates: [golang.org/x/crypto](https://github.com/golang/crypto), [golang.org/x/net](https://github.com/golang/net), [golang.org/x/oauth2](https://github.com/golang/oauth2) and [golang.org/x/tools](https://github.com/golang/tools).


Updates `golang.org/x/crypto` from 0.14.0 to 0.15.0
- [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.15.0)

Updates `golang.org/x/net` from 0.17.0 to 0.18.0
- [Commits](https://github.com/golang/net/compare/v0.17.0...v0.18.0)

Updates `golang.org/x/oauth2` from 0.13.0 to 0.14.0
- [Commits](https://github.com/golang/oauth2/compare/v0.13.0...v0.14.0)

Updates `golang.org/x/tools` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-x
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-x
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-x
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-x
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 12:31:41 -06:00
Kayla Washburn 33761c9c7d refactor: add experimental NewTheme (#10613) 2023-11-13 10:09:44 -07:00
Kira Pilot 652097ed3a fix: update HealthcheckDatabaseReport mocks (#10655) 2023-11-13 11:28:20 -05:00
Marcin Tojek fbd34139b5 refactor(site): use generated Healthcheck API entities (#10650) 2023-11-13 15:58:57 +01:00
Cian Johnston b69c237b8a feat(coderd/healthcheck): allow configuring database hc threshold (#10623)
* feat(coderd/healthcheck): allow configuring database hc threshold
* feat(coderd): add database hc latency, plumb through
* feat(coderd): allow configuring healthcheck refresh interval
2023-11-13 14:14:43 +00:00
Michael Smith e4211ccb40 fix: add missing focus state styling to buttons and checkboxes (#10614)
* fix: add focus styling to checkboxes

* fix: add focus styling to icon buttons

* fix: add focus styling to switches

* fix: swap outlines for box-shadows for more styling control
2023-11-13 08:08:18 -05:00
Spike Curtis f400d8a0c5 fix: handle SIGHUP from OpenSSH (#10638)
Fixes an issue where remote forwards are not correctly torn down when using OpenSSH with `coder ssh --stdio`.  OpenSSH sends a disconnect signal, but then also sends SIGHUP to `coder`.  Previously, we just exited when we got SIGHUP, and this raced against properly disconnecting.

Fixes https://github.com/coder/customers/issues/327
2023-11-13 15:14:42 +04:00
Muhammad Atif Ali be0436afbe ci: bump terraform version to 1.5.7 to match embedded terraform version (#10630) 2023-11-13 10:06:36 +03:00
Muhammad Atif Ali 715bbd3edd ci: bump go to version 1.20.11 (#10631) 2023-11-13 10:06:26 +03:00
Anunaya Srivastava 5f0417d14e Fix nix-shell on macos (#10591)
strace is unavailable on macos. flake.nix is updated to handle this
scenario.
2023-11-11 12:06:26 +03:00
Cian Johnston a4f1319108 feat(cli): allow showing schedules for multiple workspaces (#10596)
* coder list: adds information about next start / stop to available columns (not default)
* coder schedule: show now essentially coder list with a different set of columns
* Updates cli schedule unit tests to use new dbfake

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-11-10 13:51:49 +00:00
Jon Ayers 177affbe4b feat: add frontend warning when autostart disabled due to automatic updates (#10508) 2023-11-09 17:01:12 -06:00
Eric Paulsen 9c5b631323 feat: add docs for Bitbucket Server external auth config (#10617) 2023-11-09 16:14:22 -05:00
Michael Smith 8290fee3f7 fix: remove accidental scrollbar from deployment banner (#10616)
* chore: clean up DeploymentBannerView markup

* fix: remove extra scrollbar

* refactor: remove needless calc call
2023-11-09 15:52:23 -05:00
Marcin Tojek 61fac2dcfc feat(cli): create workspace using parameters from existing workspace (#10604) 2023-11-09 19:22:47 +01:00
Muhammad Atif Ali 076db31486 ci: use actions/setup-go builtin cache (#10608) 2023-11-09 20:41:31 +03:00
Michael Smith ad3abe350f refactor: revamp pagination UI view logic (#10567)
* chore: revamp Page Utility tests

* refactor: simplify component design for PageButton

* chore: beef up isNonInitialPage and add tests

* docs: clean up comments

* chore: quick refactor for buildPagedList

* refactor: clean up math calculations for buildPagedList

* chore: rename PageButtons file

* chore: revamp how nav buttons are defined

* fix: remove test disabled state

* chore: clean up base nav button

* chore: rename props for clarity

* refactor: clean up logic for isNonInitialPage

* chore: add more tests and catch bugs

* docs: fix confusing typo in comments

* chore: add one more test case for pagination buttons

* refactor: update props definition for PaginationNavButton

* fix: remove possible state sync bugs
2023-11-09 09:10:14 -05:00
Cian Johnston 8a7f0e9eb9 refactor(cli): extract workspace list parameters (#10605)
Extracts the --search and --all parameters to a separate struct in cliui.
2023-11-09 12:16:43 +00:00
Mathias Fredriksson 473585de6c fix(scripts): forward all necessary ports for remote playwright (#10606) 2023-11-09 12:02:46 +00:00
Mathias Fredriksson e71c53d4d0 chore(site): add remote playwright support and script (#10445) 2023-11-09 13:26:26 +02:00
Marcin Tojek ed7e43b54c feat: expose parameter insights as Prometheus metrics (#10574) 2023-11-09 10:30:40 +01:00
Jon Ayers e23873ff8f feat: add endpoint for resolving autostart status (#10507) 2023-11-08 23:24:56 -06:00
Jon Ayers cf8ee78547 fix: disable autostart for flakey test (#10598) 2023-11-08 17:56:36 -06:00
Bruno Quaresma 645c4bd612 fix(site): fix daylight savings date range issue (#10595)
Close https://github.com/coder/coder/issues/10575
2023-11-08 16:49:09 -03:00
Bruno Quaresma a328d20bcb chore(site): remove workspace schedule banner service (#10588)
Related to https://github.com/coder/coder/issues/9943
2023-11-08 16:48:54 -03:00
Kyle Carberry 2cf2904515 fix: improve language of latest build error (#10593) 2023-11-08 18:38:46 +00:00
Steven Masley 63a4f5f4a7 fix: case insensitive magic label (#10592) 2023-11-08 11:17:14 -06:00
Steven Masley aded7b1513 feat: implement bitbucket-server external auth defaults (#10520)
* feat: implement bitbucket-server external auth defaults

Bitbucket cloud != Bitbucket server
Add reasonable defaults for server

* change "bitbucket" to "bitbucket-cloud"
2023-11-08 11:05:51 -06:00
Bruno Quaresma 71153e2317 chore(site): remove workspace schedule machine (#10583)
Related to https://github.com/coder/coder/issues/9943
2023-11-08 13:46:29 -03:00
Cian Johnston 26740cf00d chore(scripts/rules.go): broaden scope of testingWithOwnerUser linter (#10548)
* Updated testingWithOwnerUser ruleguard rule to detect:
  a) Passing client from coderdenttest.New() to clitest.SetupConfig() similar to what already exists for AGPL code
  b) Usage of any method of the owner client from coderdenttest.New() - all usages of the owner client must be justified with a `//nolint:gocritic` comment.
* Fixed resulting linter complaints.
* Added new coderdtest helpers CreateGroup and UpdateTemplateMeta.
* Modified check_enterprise_import.sh to ignore scripts/rules.go.
2023-11-08 14:54:48 +00:00
Michael Smith 057b43a935 fix: remove stray 0 when no data is in users table (#10584) 2023-11-08 09:06:14 -05:00
Bruno Quaresma f418983f23 chore(site): make chromatic ignore changes inside of the code editor (#10586) 2023-11-08 11:01:28 -03:00
Bruno Quaresma de196b89b6 chore(site): revert remark-gfm upgrade (#10580) 2023-11-08 08:23:09 -05:00
Bruno Quaresma 7f26111c01 feat(site): add stop and start batch actions (#10565) 2023-11-08 09:29:22 -03:00
Bruno Quaresma 861ae1a23a fix(site): fix bottom bar height (#10579) 2023-11-08 12:21:20 +00:00
Ammar Bandukwala 4f3925d0b3 ci: close likely-no issues automatically (#10569) 2023-11-08 04:54:44 +00:00
Kira Pilot 4316c1c862 fix: display all metadata items alongside daily_cost (#10554)
* resolves #10411

* Update site/src/components/Resources/ResourceCard.test.tsx
2023-11-07 13:04:10 -05:00
Kayla Washburn 9e4558ae3a feat: parse resource metadata values as markdown (#10521) 2023-11-07 10:34:24 -07:00
Mathias Fredriksson 43a867441a feat(cli): add template filter support to exp scaletest cleanup and traffic (#10558) 2023-11-07 16:41:55 +00:00
Kayla Washburn 1dd3eb603b fix: hide promote/archive buttons for template versions from users without permission (#10555) 2023-11-07 09:33:14 -07:00
Marcin Tojek 0a550815e9 feat: expose app insights as Prometheus metrics (#10346) 2023-11-07 17:14:59 +01:00
Cian Johnston 8441c36dfb fix(site/src/api): getDeploymentDAUs: truncate tz_offset to whole number (#10563) 2023-11-07 16:00:00 +00:00
Bruno Quaresma 651d14ea68 fix(site): fix agent log error (#10557) 2023-11-07 10:37:09 -05:00
Steven Masley 64398def48 feat: add configurable cipher suites for tls listening (#10505)
* feat: add configurable cipher suites for tls listening
* tls.VersionName is go 1.21, copy the function
2023-11-07 14:55:39 +00:00
Mathias Fredriksson e36503afd2 test(codersdk/agentsdk): fix context cancel flush test (#10560)
This change tests that the patch request is cancelled instead of hoping
that there's no race between context cancellations leading to patch
never being called.
2023-11-07 16:47:23 +02:00
Michael Smith b0aa91bf27 fix: disable pagination nav buttons correctly (#10561)
* fix: update button disabling logic
2023-11-07 09:36:26 -05:00
Michael Smith f5c4826e4c feat: add list of user's groups to Accounts page (#10522)
* chore: add query for a user's groups

* chore: integrate user groups into UI

* refactor: split UI card into separate component

* chore: enforce alt text for AvatarCard

* chore: add proper alt text support for Avatar

* fix: update props for Avatar call sites

* finish AccountPage changes

* wip: commit progress on AvatarCard

* fix: add better UI error handling

* fix: update theme setup for AvatarCard

* fix: update styling for AccountPage

* fix: make error message conditional

* chore: update styling for AvatarCard

* chore: finish AvatarCard

* fix: add maxWidth support to AvatarCard

* chore: update how no max width is defined

* chore: add AvatarCard stories

* fix: remove incorrect semantics for AvatarCard

* docs: add comment about flexbox behavior

* docs: add clarifying text about prop

* fix: fix grammar for singular groups

* refactor: split off AccountUserGroups and add story

* fix: differentiate mock groups more
2023-11-07 08:36:53 -05:00
Michael Smith 8c3828b531 fix: stop SSHKeysPage from flaking (#10553)
* refactor: reorganize SSHKeysPage

* refactor: update render behavior for GlobalSnackbar

* fix: remove redundant error handling

* docs: Clean up wording on docs

* fix: remove temp error handling tests

* fix: remove local error alert

* fix: remove error logging hacks
2023-11-07 08:31:06 -05:00
dependabot[bot] b83a8ce76d chore: bump github.com/aws/smithy-go from 1.15.0 to 1.16.0 (#10543)
Bumps [github.com/aws/smithy-go](https://github.com/aws/smithy-go) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/aws/smithy-go/releases)
- [Changelog](https://github.com/aws/smithy-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/smithy-go/compare/v1.15.0...v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/aws/smithy-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-07 11:32:47 +00:00
Cian Johnston 4208c30d32 fix(coderd/rbac): allow user admin all perms on ResourceUserData (#10556) 2023-11-07 08:54:12 +00:00
Dean Sheather f84485d2c4 chore: add timezone to quiet hours display message in UI (#10538) 2023-11-07 08:36:11 +00:00
Spike Curtis c87deb868b fix: upgrade tailscale to fix STUN probes on dual stack (#10535)
Fixes STUN probe issues on dual stack systems by incorporating https://github.com/coder/tailscale/pull/43
2023-11-07 08:48:27 +04:00
Bruno Quaresma 14925e71a7 refactor(site): add version back to workspace header (#10552) 2023-11-06 13:46:16 -05:00
Bruno Quaresma a9797fa391 refactor(site): improve templates empty state (#10518) 2023-11-06 12:24:45 -05:00
dependabot[bot] e976f50415 ci: bump the github-actions group with 2 updates (#10537)
Bumps the github-actions group with 2 updates: [crate-ci/typos](https://github.com/crate-ci/typos) and [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action).


Updates `crate-ci/typos` from 1.16.21 to 1.16.22
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.16.21...v1.16.22)

Updates `aquasecurity/trivy-action` from 0.13.0 to 0.13.1
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](https://github.com/aquasecurity/trivy-action/compare/b77b85c0254bba6789e787844f0585cde1e56320...f78e9ecf42a1271402d4f484518b9313235990e1)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 11:20:25 -06:00
dependabot[bot] ee15adda4b chore: bump ts-proto from 1.162.2 to 1.163.0 in /site (#10541)
Bumps [ts-proto](https://github.com/stephenh/ts-proto) from 1.162.2 to 1.163.0.
- [Release notes](https://github.com/stephenh/ts-proto/releases)
- [Changelog](https://github.com/stephenh/ts-proto/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stephenh/ts-proto/compare/v1.162.2...v1.163.0)

---
updated-dependencies:
- dependency-name: ts-proto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 11:20:11 -06:00
dependabot[bot] a5c409dfee chore: bump github.com/gohugoio/hugo from 0.119.0 to 0.120.3 (#10544)
Bumps [github.com/gohugoio/hugo](https://github.com/gohugoio/hugo) from 0.119.0 to 0.120.3.
- [Release notes](https://github.com/gohugoio/hugo/releases)
- [Changelog](https://github.com/gohugoio/hugo/blob/master/hugoreleaser.toml)
- [Commits](https://github.com/gohugoio/hugo/compare/v0.119.0...v0.120.3)

---
updated-dependencies:
- dependency-name: github.com/gohugoio/hugo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 11:20:00 -06:00
Kyle Carberry 7162dc7e14 fix: use DefaultTransport in exchangeWithClientSecret if nil (#10551) 2023-11-06 16:55:00 +00:00
Kayla Washburn ca6e6213bf chore: use px values instead of theme.spacing and theme.shape.borderRadius (#10519) 2023-11-06 09:43:06 -07:00
dependabot[bot] 0cb875cba5 chore: bump remark-gfm from 3.0.1 to 4.0.0 in /site (#10540)
Bumps [remark-gfm](https://github.com/remarkjs/remark-gfm) from 3.0.1 to 4.0.0.
- [Release notes](https://github.com/remarkjs/remark-gfm/releases)
- [Commits](https://github.com/remarkjs/remark-gfm/compare/3.0.1...4.0.0)

---
updated-dependencies:
- dependency-name: remark-gfm
  dependency-type: direct:production
  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>
2023-11-06 11:32:45 -05:00
dependabot[bot] 04dd663680 chore: bump github.com/fatih/color from 1.15.0 to 1.16.0 (#10546)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 18:06:02 +03:00
Patrick McKee ddaf913088 feat: expose prometheus port in helm chart (#10448)
Co-authored-by: Dean Sheather <dean@deansheather.com>
2023-11-06 14:47:28 +00:00
dependabot[bot] 44bb958114 chore: bump the golang-x group with 4 updates (#10542)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 17:41:35 +03:00
Cian Johnston 4277ca02e5 feat(cli): prompt for misspelled parameter names (#10350)
* feat(cli): add cliutil/levenshtein package
* feat(cli): attempt to catch misspelled parameter names
2023-11-06 13:44:39 +00:00
Dean Sheather bb5acb0332 fix: allow users to use quiet hours endpoint (#10547) 2023-11-06 13:16:50 +00:00
Dean Sheather 95e5419626 chore: fail server startup on invalid DERP map (#10536) 2023-11-06 23:04:07 +10:00
Bruno Quaresma 5b9e26a13f refactor(site): handle edge cases for non-admin users with no workspaces and templates (#10517) 2023-11-06 09:34:45 -03:00
Muhammad Atif Ali 55fb6b663a chore: pin devcontainer.json to pre-nix image (#10417)
fixes #10416
this is a workaround, and it is tagged to an old version of an image. 
While testing, it seems like `--privileged` is no longer required.
2023-11-06 15:01:47 +03:00
dependabot[bot] 06d91bee34 chore: bump @playwright/test from 1.38.0 to 1.39.0 in /site (#10458)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 13:43:12 +03:00
Cian Johnston 26c3c1226e chore(coderd): add MockAuditor.Contains test helper (#10421)
* Adds a Contains() method on MockAuditor to help with asserting the presence of an audit log with specific fields.
* Updates existing usages of verifyAuditWorkspaceCreated to use the new helper
* Updates test referenced in PR#10396.
2023-11-06 09:17:07 +00:00
Bruno Quaresma e36b606498 fix(site): fix user dropdown width (#10523) 2023-11-04 12:05:19 -03:00
Michael Smith 744c73394a feat: allow users to duplicate workspaces by parameters (#10362)
* chore: add queries for workspace build info

* refactor: clean up logic for CreateWorkspacePage to support multiple modes

* chore: add custom workspace duplication hook

* chore: integrate mode into CreateWorkspacePageView

* fix: add mode to CreateWorkspacePageView stories

* refactor: extract workspace duplication outside CreateWorkspacePage file

* chore: integrate useWorkspaceDuplication into WorkspaceActions

* chore: delete unnecessary function

* refactor: swap useReducer for useState

* fix: swap warning alert for info alert

* refactor: move info alert message

* refactor: simplify UI logic for mode alerts

* fix: prevent dismissed Alerts from affecting layouts

* fix: remove unnecessary prop binding

* docs: reword comment for clarity

* chore: update msw build params to return multiple params

* chore: rename duplicationReady to isDuplicationReady

* chore: expose root component for testing/re-rendering

* chore: get tests in place (still have act warnings)

* refactor: move stuff around for clarity

* chore: finish tests

* chore: revamp tests
2023-11-03 18:23:09 -04:00
Kyle Carberry 23f02651f9 chore: migrate CLI tests to use dbfake (#10500) 2023-11-03 12:22:32 -05:00
dependabot[bot] 6588494abd chore: bump ts-proto from 1.159.1 to 1.162.2 in /site (#10462)
Bumps [ts-proto](https://github.com/stephenh/ts-proto) from 1.159.1 to 1.162.2.
- [Release notes](https://github.com/stephenh/ts-proto/releases)
- [Changelog](https://github.com/stephenh/ts-proto/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stephenh/ts-proto/compare/v1.159.1...v1.162.2)

---
updated-dependencies:
- dependency-name: ts-proto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-03 13:20:36 -04:00
dependabot[bot] 84dc001f7e chore: bump cronstrue from 2.32.0 to 2.41.0 in /site (#10463)
Bumps [cronstrue](https://github.com/bradymholt/cronstrue) from 2.32.0 to 2.41.0.
- [Release notes](https://github.com/bradymholt/cronstrue/releases)
- [Changelog](https://github.com/bradymholt/cRonstrue/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bradymholt/cronstrue/compare/v2.32.0...v2.41.0)

---
updated-dependencies:
- dependency-name: cronstrue
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-03 13:20:32 -04:00
dependabot[bot] 311d1dc576 chore: bump @octokit/types from 12.0.0 to 12.1.1 in /site (#10466)
Bumps [@octokit/types](https://github.com/octokit/types.ts) from 12.0.0 to 12.1.1.
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v12.0.0...v12.1.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-03 13:20:26 -04:00
dependabot[bot] b86e2e4cd4 chore: bump monaco-editor from 0.43.0 to 0.44.0 in /site (#10467)
Bumps [monaco-editor](https://github.com/microsoft/monaco-editor) from 0.43.0 to 0.44.0.
- [Changelog](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/monaco-editor/compare/v0.43.0...v0.44.0)

---
updated-dependencies:
- dependency-name: monaco-editor
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-03 13:20:18 -04:00
Bruno Quaresma 7d63dc2b02 refactor(site): add minor design improvements on the setup page (#10511) 2023-11-03 12:53:11 -04:00
Kyle Carberry bb4ce87242 fix: add support for custom auth header with client secret (#10513)
This fixes OAuth2 with JFrog Artifactory.
2023-11-03 16:26:30 +00:00
Kyle Carberry 21dc93c8a3 feat: add log-dir flag to vscodessh for debuggability (#10514) 2023-11-03 16:21:31 +00:00
dependabot[bot] 08844d03fb chore: bump vite from 4.4.2 to 4.5.0 in /site (#10459)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.4.2 to 4.5.0.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.0/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-03 10:09:22 -04:00
Bruno Quaresma ca353cb81c refactor(site): improve first workspace creation time (#10510)
One tiny improvement to make the onboarding faster. When a user has no workspace, show the existent templates with direct links to the workspace creation instead of asking them to see all templates, select one, and after, click on "Create workspace". 

Before:
<img width="1351" alt="Screenshot 2023-11-03 at 10 11 32" src="https://github.com/coder/coder/assets/3165839/46050f16-0196-477a-90e2-a0f475c8b707">

After:
<img width="1360" alt="Screenshot 2023-11-03 at 10 11 43" src="https://github.com/coder/coder/assets/3165839/5bef3d50-b192-49b5-8bdf-dec9654f529f">
2023-11-03 11:03:21 -03:00
Bruno Quaresma c9aeea6f64 chore(site): remove template version editor xservice (#10490)
Close https://github.com/coder/coder/issues/9942
2023-11-02 21:42:33 -03:00
Bruno Quaresma 03045bd47a fix(site): fix dialog loading buttons displaying text over the spinner (#10501) 2023-11-02 21:34:18 -03:00
Bruno Quaresma 01ceb84a22 fix(site): fix health tooltip on deployment bar (#10502)
Fix https://github.com/coder/coder/issues/10489
2023-11-02 21:32:24 -03:00
Bruno Quaresma 716b86b380 refactor(site): make minor design tweaks and fix issues on more options menus (#10493)
- Fix menus not closing when clicking and navigating to a lazy loaded page
- Minor design tweaks
- Make all "More options" menus consistent

Before:

<img width="243" alt="Screenshot 2023-11-02 at 10 21 02" src="https://github.com/coder/coder/assets/3165839/4d4eee7f-60d9-4c55-9559-468760715fe7">
<img width="246" alt="Screenshot 2023-11-02 at 10 18 03" src="https://github.com/coder/coder/assets/3165839/a834263a-f950-4f02-b3c7-c631928c0421">
<img width="251" alt="Screenshot 2023-11-02 at 10 07 40" src="https://github.com/coder/coder/assets/3165839/b2135281-1ffe-422b-a054-0c175f0dc2ad">

Now:

<img width="279" alt="Screenshot 2023-11-02 at 10 21 07" src="https://github.com/coder/coder/assets/3165839/a36b4025-3df0-4bd1-8071-7f1127caa2e2">
<img width="257" alt="Screenshot 2023-11-02 at 10 18 08" src="https://github.com/coder/coder/assets/3165839/57f737d4-fa32-4657-b59d-cf26029f8a69">
<img width="236" alt="Screenshot 2023-11-02 at 10 07 48" src="https://github.com/coder/coder/assets/3165839/a45a7f7d-f492-4498-a1f9-d86f7815d119">
2023-11-02 21:32:04 -03:00
Jon Ayers 2dce4151ba feat: add cli support for workspace automatic updates (#10438) 2023-11-02 14:41:34 -05:00
Bruno Quaresma e756baa0c4 refactor(site): simplify proxy menu (#10496) 2023-11-02 15:39:46 -04:00
Bruno Quaresma ae20df4229 refactor(site): remove version and last built from workspace header (#10495) 2023-11-02 16:26:41 -03:00
Bruno Quaresma d2b8a93638 fix(site): fix favicon theme (#10497) 2023-11-02 18:51:39 +00:00
Kayla Washburn 921b6eb4ee chore: use emotion for styling (pt. 9) (#10474) 2023-11-02 17:51:23 +00:00
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
Colin Adler ac9c16864c chore: update audit log api docs (#10486) 2023-11-02 16:12:38 +00:00
Bruno Quaresma e756a95759 refactor(site): minor improvements on users page popovers (#10492) 2023-11-02 13:39:52 +00:00
dependabot[bot] b8449d5894 chore: bump axios from 1.5.0 to 1.6.0 in /site (#10460)
Bumps [axios](https://github.com/axios/axios) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-02 08:50:18 -04:00
dependabot[bot] 725cda9463 chore: bump next from 13.5.3 to 14.0.1 in /offlinedocs (#10469)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Atif Ali <atif@coder.com>
2023-11-02 09:29:56 +00:00
dependabot[bot] af1c74d62d chore: bump eslint-config-next from 13.5.3 to 14.0.1 in /offlinedocs (#10470)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-02 11:58:50 +03:00
Steven Masley 0c993ea329 feat: add observability configuration values to deployment page (#10471)
* feat: add observability configuration values to deployment page

- Moved audit logging to this page
- Logging, prometheus, tracing, debug, and pprof settings
2023-11-01 15:56:02 -05:00
dependabot[bot] 5c49ce0194 chore: bump eslint from 8.50.0 to 8.52.0 in /offlinedocs (#10468)
Bumps [eslint](https://github.com/eslint/eslint) from 8.50.0 to 8.52.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.50.0...v8.52.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-01 23:48:52 +03:00
dependabot[bot] b5405dc424 chore: bump chromatic from 7.2.0 to 7.6.0 in /site (#10464)
Bumps [chromatic](https://github.com/chromaui/chromatic-cli) from 7.2.0 to 7.6.0.
- [Release notes](https://github.com/chromaui/chromatic-cli/releases)
- [Changelog](https://github.com/chromaui/chromatic-cli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chromaui/chromatic-cli/compare/v7.2.0...v7.6.0)

---
updated-dependencies:
- dependency-name: chromatic
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-01 23:13:13 +03:00
Kayla Washburn 7f70a23844 chore: use emotion for styling (pt. 8) (#10447) 2023-11-01 12:43:42 -06:00
dependabot[bot] b3e6a461ed chore: bump the storybook group in /site with 7 updates (#10456)
Bumps the storybook group in /site with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [@storybook/addon-actions](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/actions) | `7.4.0` | `7.5.2` |
| [@storybook/addon-essentials](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/essentials) | `7.4.0` | `7.5.2` |
| [@storybook/addon-links](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/links) | `7.4.0` | `7.5.2` |
| [@storybook/addon-mdx-gfm](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/gfm) | `7.4.0` | `7.5.2` |
| [@storybook/react](https://github.com/storybookjs/storybook/tree/HEAD/code/renderers/react) | `7.4.0` | `7.5.2` |
| [@storybook/react-vite](https://github.com/storybookjs/storybook/tree/HEAD/code/frameworks/react-vite) | `7.4.0` | `7.5.2` |
| [storybook](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/cli) | `7.4.0` | `7.5.2` |


Updates `@storybook/addon-actions` from 7.4.0 to 7.5.2
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.5.2/code/addons/actions)

Updates `@storybook/addon-essentials` from 7.4.0 to 7.5.2
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.5.2/code/addons/essentials)

Updates `@storybook/addon-links` from 7.4.0 to 7.5.2
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.5.2/code/addons/links)

Updates `@storybook/addon-mdx-gfm` from 7.4.0 to 7.5.2
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.5.2/code/addons/gfm)

Updates `@storybook/react` from 7.4.0 to 7.5.2
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.5.2/code/renderers/react)

Updates `@storybook/react-vite` from 7.4.0 to 7.5.2
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.5.2/code/frameworks/react-vite)

Updates `storybook` from 7.4.0 to 7.5.2
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.5.2/code/lib/cli)

---
updated-dependencies:
- dependency-name: "@storybook/addon-actions"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: "@storybook/addon-essentials"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: "@storybook/addon-links"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: "@storybook/addon-mdx-gfm"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: "@storybook/react"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: "@storybook/react-vite"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: storybook
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-01 20:19:19 +03:00
Kayla Washburn 5284d974ef chore: use emotion for styling (pt. 7) (#10431) 2023-11-01 09:28:26 -06:00
dependabot[bot] ec7d7595ff chore: bump @monaco-editor/react from 4.5.0 to 4.6.0 in /site (#10465)
Bumps [@monaco-editor/react](https://github.com/suren-atoyan/monaco-react) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/suren-atoyan/monaco-react/releases)
- [Changelog](https://github.com/suren-atoyan/monaco-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/suren-atoyan/monaco-react/compare/v4.5.0...v4.6.0)

---
updated-dependencies:
- dependency-name: "@monaco-editor/react"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-01 10:28:04 -04:00
dependabot[bot] 59c7c340a3 chore: bump the eslint group in /site with 7 updates (#10457)
Bumps the eslint group in /site with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [eslint-plugin-testing-library](https://github.com/testing-library/eslint-plugin-testing-library) | `6.0.1` | `6.1.0` |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `6.7.0` | `6.9.1` |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `6.7.0` | `6.9.1` |
| [eslint](https://github.com/eslint/eslint) | `8.50.0` | `8.52.0` |
| [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) | `2.28.0` | `2.29.0` |
| [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) | `27.4.0` | `27.6.0` |
| [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) | `48.0.0` | `49.0.0` |


Updates `eslint-plugin-testing-library` from 6.0.1 to 6.1.0
- [Release notes](https://github.com/testing-library/eslint-plugin-testing-library/releases)
- [Changelog](https://github.com/testing-library/eslint-plugin-testing-library/blob/main/.releaserc.json)
- [Commits](https://github.com/testing-library/eslint-plugin-testing-library/compare/v6.0.1...v6.1.0)

Updates `@typescript-eslint/eslint-plugin` from 6.7.0 to 6.9.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.9.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.7.0 to 6.9.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.9.1/packages/parser)

Updates `eslint` from 8.50.0 to 8.52.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.50.0...v8.52.0)

Updates `eslint-plugin-import` from 2.28.0 to 2.29.0
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.28.0...v2.29.0)

Updates `eslint-plugin-jest` from 27.4.0 to 27.6.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/v27.4.0...v27.6.0)

Updates `eslint-plugin-unicorn` from 48.0.0 to 49.0.0
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v48.0.0...v49.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-testing-library
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: eslint
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-01 10:26:56 -04:00
Spike Curtis cac29e0b4d feat: add tables for PGCoordinator v2 (#10442)
Adds tables for a simplified PG Coordinator that only considers Peers and Tunnels, rather than agent/client distinctions we have today.
2023-11-01 16:30:09 +04:00
Spike Curtis 95ce697e3a fix: schedule autobuild directly on TestExecutorAutostopTemplateDisabled (#10453)
Fixes flake seen here: https://github.com/coder/coder/actions/runs/6716682414/job/18253279654

The test used a cron schedule to compute autobuild ticks, with ticks every hour on the hour.  The default TTL was set to an hour.  Usually, the next tick is less than one hour in the future, unless the test runs at :00 past the hour, which it did in my flake'd
run.  But, given that this is an autostop test, the cron schedule is irrelevant (such schedules are used for auto_start_).  So, I've removed it from the test and compute the build ticks directly.

Also, the test originally had the workspace TTL set to longer than the default template TTL, and then tested that no build happened when the tick was prior to both. This seems odd to me, as we want to demonstrate the the executor disregards the workspace TTL.
So, I changed the test to set the workspace TTL shorter, and then send in a tick between the two, verify that we don't autostop, then a tick after the template TTL and verify that we do.
2023-11-01 15:16:20 +04: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
Spike Curtis 6882e8e524 feat: add conversions from tailnet to proto (#10441)
Adds conversions from existing tailnet types to protobuf
2023-11-01 10:54:00 +04:00
Jon Ayers f4026edd71 feat: add frontend support for enabling automatic workspace updates (#10375) 2023-10-31 17:06:36 -05:00
Spike Curtis 3200b85d87 Revert "chore: bump go.uber.org/goleak from 1.2.1 to 1.3.0 (#10398)" (#10444)
This reverts commit 8fe3dcf18a.
2023-10-31 12:53:29 +00:00
Spike Curtis 8d5a13d768 fix: update tailscale to fixed STUN probe version (#10439) 2023-10-31 10:21:19 +00:00
Spike Curtis a7c671ca07 feat: add workspace agent APIVersion (#10419)
Fixes #10339
2023-10-31 10:08:43 +04:00
dependabot[bot] 90573a6e99 chore: bump github.com/open-policy-agent/opa from 0.57.0 to 0.58.0 (#10424)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 21:08:41 +00:00
dependabot[bot] 0bf156cde3 chore: bump github.com/google/uuid from 1.3.1 to 1.4.0 (#10422)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 20:12:53 +00:00
dependabot[bot] eaf9176bc5 chore: bump github.com/docker/docker from 23.0.5+incompatible to 24.0.7+incompatible (#10427)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 15:07:46 -05:00
Ben Potter e491217a12 docs: add v2.3.3 changelog (#10435) 2023-10-30 15:06:11 -05:00
Steven Masley 9d2b805fb7 fix: prevent infinite redirect oauth auth flow (#10430)
* fix: prevent infinite redirect oauth auth flow
2023-10-30 14:45:06 -05:00
Kyle Carberry 7fc1a65b14 fix: add new aws regions to instance identity (#10434)
Fixes #10433
2023-10-30 19:44:29 +00:00
Kayla Washburn fdf035cd06 chore: remove fly template (#10429) 2023-10-30 13:16:43 -06:00
dependabot[bot] fc1d823cae chore: bump github.com/go-logr/logr from 1.2.4 to 1.3.0 (#10423)
Bumps [github.com/go-logr/logr](https://github.com/go-logr/logr) from 1.2.4 to 1.3.0.
- [Release notes](https://github.com/go-logr/logr/releases)
- [Changelog](https://github.com/go-logr/logr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-logr/logr/compare/v1.2.4...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/go-logr/logr
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 21:36:01 +03:00
dependabot[bot] 8fe3dcf18a chore: bump go.uber.org/goleak from 1.2.1 to 1.3.0 (#10398)
Bumps [go.uber.org/goleak](https://github.com/uber-go/goleak) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/uber-go/goleak/releases)
- [Changelog](https://github.com/uber-go/goleak/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber-go/goleak/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: go.uber.org/goleak
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 21:35:40 +03:00
Kyle Carberry 5abfe5afd0 chore: rename dbfake to dbmem (#10432) 2023-10-30 17:42:20 +00:00
Spike Curtis 7a8da08124 feat: add api_version column to workspace_agents (#10418)
Adds api_version to workspace_agents table

Part of #10399
2023-10-30 21:30:49 +04:00
dependabot[bot] 6b7858c516 ci: bump the github-actions group with 2 updates (#10420)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 11:25:37 +00:00
Mathias Fredriksson 9d3785def8 test(cli/cliui): make agent tests more robust (#10415)
Fixes #10408
2023-10-30 13:20:10 +02:00
Spike Curtis 2a6fd90140 feat: add tailnet and agent API definitions (#10324)
Adds API definitions and packages for Tailnet and Agent APIs (API version 2.0)
2023-10-30 12:14:45 +04:00
Spike Curtis c2e3648484 fix: disable tests broken by daylight savings (#10414) 2023-10-30 06:44:30 +00:00
dependabot[bot] 3b50530a63 chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.55.0 to 1.56.1 (#10403)
Bumps gopkg.in/DataDog/dd-trace-go.v1 from 1.55.0 to 1.56.1.

---
updated-dependencies:
- dependency-name: gopkg.in/DataDog/dd-trace-go.v1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-27 22:41:33 +03:00
Mathias Fredriksson 7fecd39e23 fix(agent/agentscripts): display informative error for ErrWaitDelay (#10407)
Fixes #10400
2023-10-27 19:07:26 +03:00
Muhammad Atif Ali 99fda4a8e2 docs: replace gituth with externalauth (#10409) 2023-10-27 10:53:56 -04:00
Muhammad Atif Ali 51aa32cfcf chore: limit history to the last 30 runs/days for PR deploy and cleanup workflows (#10406) 2023-10-27 11:15:21 +00:00
Muhammad Atif Ali 6ae8bfed94 chore(examples): fix a small typo (#10404) 2023-10-26 09:42:46 +00:00
dependabot[bot] 35e7d7854a chore: bump google.golang.org/grpc from 1.58.2 to 1.59.0 (#10381)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-26 11:36:50 +03:00
dependabot[bot] edcbd4f394 chore: bump github.com/coreos/go-oidc/v3 from 3.6.0 to 3.7.0 (#10397)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-26 11:36:10 +03:00
dependabot[bot] ea578ceabb chore: bump github.com/prometheus/common from 0.44.0 to 0.45.0 (#10399)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-26 11:35:47 +03:00
Mathias Fredriksson 0ddd54d34b fix(coderd/provisionerdserver): avoid error log during shutdown (#10402) 2023-10-25 18:31:28 +03:00
Josh Vawdrey fdc9097d6c feat(provisioner): expose template version to provisioner (#10306) 2023-10-25 14:44:08 +03:00
dependabot[bot] e7fd2cb1a6 chore: bump github.com/djherbis/times from 1.5.0 to 1.6.0 (#10380)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 23:03:08 +03:00
dependabot[bot] 670ee4d54f chore: bump google.golang.org/api from 0.147.0 to 0.148.0 (#10383)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 22:58:41 +03:00
dependabot[bot] 39fbf74c7d ci: bump the github-actions group with 1 update (#10379)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 22:14:48 +03:00
Mathias Fredriksson eac155aec2 test(cli): fix TestServer flake due to DNS lookup (#10390) 2023-10-24 22:12:03 +03:00
Michael Smith 7732ac475a refactor: update logic for all metadata query factories (#10356)
* refactor: simplify metadata patterns

* fix: add return type to me factory

* fix: make sure query key for me is always defined at type level
2023-10-24 08:42:38 -04:00
Josh Vawdrey 6b2aee4133 feat(cli): make the dotfiles repository directory configurable (#10377) 2023-10-24 12:00:04 +03:00
Devarshi Shimpi d8592bf09a fix(README.md): update installation link (#10275) 2023-10-24 11:36:38 +03:00
Asher 4af8446f48 fix: initialize terminal with correct size (#10369)
* Fit once during creation

This does not fix any bugs (that I know of) but we only need to fit once
when the terminal is created, not every time we reconnect.  Granted,
currently we do not support reconnecting without refreshing anyway so it
does not really matter, but this just seems more correct.

Plus now we will not have to pass the fit addon around.

* Pass size when connecting web socket URL

I think this will solve an issue where screen does does not correctly
handle an immediate resize.  It seems to ignore the resize, but even if
you send it again nothing changes, seemingly thinking it is already at
that size?

* Use new struct for decoding reconnecting pty requests

Decoding a JSON message does not touch omitted (or null) fields so once
a message with a resize comes in, every single message from that point
will cause a resize.

I am not sure if this is an actual problem in practice but at the very
least it seems unintentional.
2023-10-23 23:42:39 -04:00
Mathias Fredriksson 1286904de8 test(agent): improve TestAgent_Session_TTY_MOTD_Update (#10385) 2023-10-23 17:32:28 +00:00
Mathias Fredriksson 09f7b8e88c fix(agent/agentscripts): track cron run and wait for cron stop (#10388)
Fixes #10289
2023-10-23 17:08:52 +00:00
Mathias Fredriksson 1a2aea3a6b fix(agent): prevent metadata from being discarded if report is slow (#10386) 2023-10-23 17:02:54 +00:00
Mathias Fredriksson 6683ad989a test(coderd): fix TestWorkspaceBuild flake (#10387)
Fixes #10335
2023-10-23 19:45:54 +03:00
Mathias Fredriksson 8f1b4fb061 test(agent): fix service banner trim test flake (#10384) 2023-10-23 18:06:59 +03:00
Ben Potter a7243b3f3b docs: add v2.3.2 changelog (#10371) 2023-10-20 21:26:43 +00:00
Jon Ayers 1372bf82f5 chore: revert "chore: remove workspace_actions experiment (#10030)" (#10363) 2023-10-20 13:21:53 -05:00
Asher 57c9d88703 chore(site): remove terminal xservice (#10234)
* Remove terminalXService

This is a prelude to the change I actually want to make, which is to
send the size of the terminal on the web socket URL after we do a fit.
I have found xstate so confusing that it was easier to just rewrite it.

* Fix hanging tests

I am not really sure what ws.connected is doing but it seems to somehow
block updates.  Something to do with `act()` maybe?

Basically, the useEffect creating the terminal never updates once the
config query finishes, so the web socket is never created, and the test
hangs forever.

It might have been working before only because the web socket was
created using xstate rather than useEffect and once it connected it
would unblock and React could update again but this is just a guess.

* Ignore other config changes

The terminal only cares about the renderer specifically, no need to
recreate the terminal if something else changes.

* Break out port forward URL open to util

Felt like this could be broken out to reduce the component size.  Also
trying to figure out why it is causing the terminal to create multiple
times.

* Prevent handleWebLink change from recreating terminal

Depending on the timing, handleWebLink was causing the terminal to get
recreated.  We only need to create the terminal once unless the render
type changes.

Recreating the terminal was also recreating the web socket pointlessly.
2023-10-20 10:18:17 -08:00
Muhammad Atif Ali 5ebb702e00 chore: add OIDC provider logos (#10365)
* chore: add OIDC provider logos

* Add files via upload

* fmt
2023-10-20 19:30:05 +03:00
Eric Paulsen 9dbc913798 fix: additional cluster SA, role names (#10366) 2023-10-20 11:44:16 -04:00
Kira Pilot ed5567ba28 fix: show dormant and suspended users in groups (#10333)
* fix: show dormant and suspended users in groups

* added status column
2023-10-20 11:36:00 -04:00
Bruno Quaresma ac322724b0 chore(site): replace custom LoadingButton from the one in MUI (#10351) 2023-10-20 09:57:27 -03:00
Bruno Quaresma 3d9bfdd5dc chore(site): remove update check service (#10355) 2023-10-20 09:41:34 -03:00
Bruno Quaresma 1ba5169109 chore(site): remove search users and groups xservice (#10353) 2023-10-20 09:33:07 -03: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
Kira Pilot 9c9319f81e fix: resolve User is not unauthenticated error seen on logout (#10349)
* fix: do not cache getAuthenticatedUser call

* use initialQuery, add back meta tag for initial load of users

* lift initialUserData
2023-10-19 14:50:53 -04:00
Michael Smith ab2904a676 feat: add user groups column to users table (#10284)
* refactor: extract UserRoleCell into separate component

* wip: add placeholder Groups column

* fix: remove redundant css styles

* refactor: update EditRolesButton to use Sets to detect selections

* wip: commit progress for updated roles column

* wip: commit current role pill progress

* fix: update state sync logic

* chore: add groupsByUserId query options factory

* fix: update return value of select function

* chore: drill groups data down to cell component

* wip: commit current cell progress

* fix: remove redundant classes

* wip: commit current styling progress

* fix: update line height for CTA

* fix: update spacing

* chore: add tooltip for Groups column header

* fix: remove tsbuild file

* refactor: consolidate tooltip components

* fix: update font size defaults inside theme

* fix: expand hoverable/clickable area of groups cell

* fix: remove possible undefined cases from HelpTooltip

* chore: add popover functionality to groups

* wip: commit progress on groups tooltip

* fix: remove zero-height group name visual bug

* feat: get basic version of user group tooltips done

* perf: move sort order callback outside loop

* fix: update spacing for tooltip

* feat: make popovers entirely hover-based

* fix: disable scroll locking for popover

* docs: add comments explaining some pitfalls with Popover component

* refactor: simplify userRoleCell implementation

* feat: complete main feature

* fix: prevent scroll lock for role tooltips

* fix: change import to type import

* refactor: simplify how groups are clustered

* refactor: update UserRoleCell to use Popover

* refactor: remove unnecessary fragment

* chore: add id/aria support for Popover

* refactor: update UserGroupsCell to use Popover

* chore: redo visual design for UserGroupsCell

* fix: shrink UserGroupsCell text

* fix: update UsersTable test to include groups info
2023-10-19 14:31:48 -04:00
Bruno Quaresma 557adab224 chore(site): remove template ACL XService (#10332) 2023-10-19 14:59:08 -03:00
dependabot[bot] 21f87313bd chore: bump github.com/aws/smithy-go from 1.14.2 to 1.15.0 (#10282)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-19 16:08:56 +03:00
Muhammad Atif Ali 42c21d400f fix(docs): update external-auth docs to use coder_external_auth (#10347) 2023-10-19 12:30:48 +00:00
Bruno Quaresma f677c4470b chore(site): add custom popover component (#10319) 2023-10-19 09:13:21 -03:00
Bruno Quaresma b8c7b56fda fix(site): fix tabs in the template layout (#10334) 2023-10-19 09:12:41 -03: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
Colin Adler 504cedf15a feat: add telemetry for external provisioners (#10322) 2023-10-18 14:20:30 -05:00
Mathias Fredriksson 9b73020f11 ci(.github): set DataDog upload timeout (#10328) 2023-10-18 20:07:52 +03:00
Bruno Quaresma c93fe8ddbe chore(site): remove template version machine (#10315) 2023-10-18 09:18:03 -03:00
Muhammad Atif Ali fe05fd1e6e docs: update vscode web docs (#10327) 2023-10-18 12:13:44 +00:00
Kayla Washburn 2b5e02f5b2 refactor: improve e2e test reporting (#10304) 2023-10-17 16:11:42 -06:00
Muhammad Atif Ali ab456276dc docs: add v2.3.1 changelog (#10313)
* add v2.3.1 changelog

* fmt

* explain

* simplify

* update

* simplify

* cleanup

* refresh

* update

* cleanup and fmt

* Update v2.3.1.md

cleanup

* add new commits

---------

Co-authored-by: Ben <me@bpmct.net>
2023-10-17 21:45:38 +00:00
Eric Paulsen 09d995c8dc fix: set K8s deployment strategy to Recreate (#10321) 2023-10-17 21:06:35 +00:00
Kayla Washburn 619df23ad1 chore: fix linting issues and generated files (#10317) 2023-10-17 14:41:35 -06:00
Muhammad Atif Ali 492da15890 chore: delete filebrowser.db (#10320) 2023-10-17 18:59:35 +00:00
Kira Pilot 1656249e07 feat: add all safe experiments to the deployment page (#10276)
* added new option table type for experiments

* added tests

* fixed go tests

* added go test for new param

* removing query change

* clearing ExperimentsAll

* dont mutate ExperimentsAll

* added new route for safe experiments

* added new route for safe experiments

* added test for new route

* PR feedback

* altered design

* alias children
2023-10-17 14:49:19 -04:00
Bruno Quaresma 35f9e2ef7f refactor(site): refactor create workspace button (#10303) 2023-10-17 13:31:51 -03:00
Michael Smith 0f2d4fdb6d fix: prevent metadata queries from short-circuiting (#10312)
* fix: prevent metadata queries from short-circuiting

* fix: use correct type definitions
2023-10-17 10:20:56 -06:00
Mathias Fredriksson 8f39ec5cc3 fix(scaletest/templates): fix bugs and improve debugging (#10316) 2023-10-17 15:18:49 +00:00
Kayla Washburn 2f4ca0f566 chore: use emotion for styling (pt. 6) (#10298) 2023-10-17 09:14:13 -06:00
Muhammad Atif Ali a49e6b88f9 docs: reorganize template docs (#10297)
* docs: rework our "templates" section

* wikistuff

* fix formatting

* add diagram

* reorganize some things

* docs: improve workspaces and templates doc (#9139)

* Reorg, updated/new screenshots, consistent terminology

* First pass

* Another pass

* Added integration section

* New outline for template pages, small updates

* Revised outline for templates, added tutorial

* First pass at tutorial

* Some feedback from Ben.

* Update docs/workspaces.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/workspaces.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/workspaces.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Fixed typos

* Expanded tutorial

I have read the CLA Document and I hereby sign the CLA

* New screenshots, improved tutorial, revised anatomy

* Improved tutorial. Anatomy is now a guided tour.

* First pass at guided tour

* Updated authentication info

* Reorganized the guided tour

* Edited more template pages

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tutorial.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Revised devcontainers and docker-in-workspaces

* Edited and added screenshots

* Prepared first draft, except docs/templates/open-in-coder.md

* Fix typo

* remove legacy parameters and migration guide

* Use coder templates create

* Added screenshot for workspace template variables

* Made it prettier

* Fixed minor typos and markdown problems

* edits to repairing workspaces

* fix broken links in product

* Added troubleshooting, minor corrections.

* fix terminal links

* fmt

---------

Co-authored-by: Muhammad Atif Ali <matifali@live.com>
Co-authored-by: Ben Potter <me@bpmct.net>
Co-authored-by: Atif Ali <atif@coder.com>

* make fmt

* fix merge conflict

* make fmt

* make gen

* update

* lint

* Discard changes to coderd/database/queries.sql.go

* Discard changes to cli/templates.go

* Discard changes to cli/templateversionarchive.go

* Discard changes to cli/templateversions.go

* Update docker-in-workspaces.md

* replace ```sh with ```shell

* open-in-coder

* fmt

* mention coder_metadata in icons.md

* resource_metadata

* use shell

* modules.md

* mention coder registry module

* workspace.md

* resource_metadata

* remove duplication

* address comments

* cleanup

* fmt

* fix broken links

* fix numbering

* mention module registry

* add example

* demote heading

* remove top level entry from manifest

* fmt

---------

Co-authored-by: Ben <me@bpmct.net>
Co-authored-by: Marc Paquette <22124737+marcpaq@users.noreply.github.com>
2023-10-17 14:47:12 +00:00
dependabot[bot] b5e5b39de2 chore: bump @babel/traverse from 7.22.8 to 7.23.2 in /offlinedocs (#10294)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-16 23:39:04 +03:00
dependabot[bot] 2acf195b13 chore: bump @babel/traverse from 7.22.11 to 7.23.2 in /site (#10295)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-16 23:38:51 +03:00
Kayla Washburn eaea918a59 chore: use emotion for styling (pt. 5) (#10261) 2023-10-16 12:41:15 -06:00
Bruno Quaresma 4240200b5d fix(site): fix state used to check if creating was loading (#10296) 2023-10-16 15:53:50 +00:00
Mathias Fredriksson 43f26dfec5 feat(scaletest/templates): run all scenarios even on failure (#10290)
We now also end all failed phases and add the `error` tag in Grafana.
2023-10-16 18:18:05 +03:00
Ben Potter 9a0aac88e0 chore: fix broken links in docs (#10291)
https://github.com/coder/coder/actions/runs/6531396781/job/17732557812
2023-10-16 14:29:53 +00:00
Steven Masley 6ebe9b0402 feat: add UI for autostart workspace days (#10263)
* feat: add ui for selecting auto start days
2023-10-16 09:29:42 -05:00
Steven Masley 5a90228c60 feat: fix 404 on the first app loads when unauthenticated (#10262)
* feat: fix 404 on the first app loads when unauthenticated
* Update site/src/pages/LoginPage/LoginPage.tsx
2023-10-16 09:29:25 -05:00
Mathias Fredriksson 8ffe0e22b6 feat(scaletest/templates): gather pod logs at the end of a scale test (#10288) 2023-10-16 13:50:04 +00:00
Bruno Quaresma 8efa1239e7 fix(site): do not return next page if the current size is lower than the limit (#10287) 2023-10-16 13:39:48 +00:00
Mathias Fredriksson 3c49290dd7 feat(scaletest/templates): add comment parameter (#10285) 2023-10-16 13:28:23 +00:00
Cian Johnston 6875faf238 fix(coderd/provisionerdserver): pass through api ctx to provisionerdserver (#10259)
Passes through coderd API ctx to provisionerd server so we can cancel workspace updates when API is shutting down.
2023-10-16 13:50:07 +01:00
Bruno Quaresma 01792f064e fix(site): display empty component when workspace has no parameters (#10286) 2023-10-16 09:49:53 -03:00
Bruno Quaresma f64b9cab90 feat(site): decrease the number of statuses in the workspaces filter (#10283) 2023-10-16 12:46:06 +00:00
Mathias Fredriksson 493e2bd2ac feat(scaletest/templates): add repo branch parameter (#10279) 2023-10-16 12:25:32 +00: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
Cian Johnston 1be24dcb5c feat(helm/provisioner): add extraTemplates (#10256)
Adds support for extraTemplates to the coder-provisioner chart to bring it in line with the coder chart.
2023-10-16 12:17:05 +01:00
Stephen Kirby 2029543eba chore(site): clarify autostop description (#10260)
* updated autostop description based on customer request

* edited for specificity

* make fmt
2023-10-13 12:24:37 -05: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
Ammar Bandukwala 98b6c8bcb0 chore(coderd): report full license in telemetry (#10258)
Will aid in cross-referencing deployments to sales accounts.
2023-10-13 11:43:06 -05:00
Kayla Washburn cbc0c39792 fix: display health alert in DeploymentBannerView (#10193) 2023-10-13 10:39:20 -06:00
Muhammad Atif Ali def980b973 chore(docs): fix syntax highlighting (#10247)
Due to some reason, our docs are not rendering syntax highlighting when the code block type is 'terraform'. Changing the type to `hcl` fixes this.
2023-10-13 18:50:24 +03:00
Mathias Fredriksson 76c65b1e1b fix(agent): send metadata in batches (#10225)
Fixes #9782

---

I recommend reviewing with ignore whitespace.
2023-10-13 17:48:25 +03:00
Mathias Fredriksson 4857d4bd55 feat(codersdk/agentsdk): use new agent metadata batch endpoint (#10224)
Part of #9782
2023-10-13 17:32:28 +03:00
Mathias Fredriksson 7eeba15d16 feat(coderd): add support for sending batched agent metadata (#10223)
Part of #9782
2023-10-13 16:37:55 +03:00
dependabot[bot] 1b1ab97c24 chore: bump github.com/google/go-cmp from 0.5.9 to 0.6.0 (#10248)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-13 13:27:22 +00:00
dependabot[bot] 13036dd088 chore: bump google.golang.org/api from 0.145.0 to 0.147.0 (#10249)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-13 16:17:35 +03:00
dependabot[bot] ab7dd24d97 ci: bump the github-actions group with 2 updates (#10250)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-13 16:17:21 +03:00
Cian Johnston d56f49f619 fix(coderd): make activitybump aware of default template ttl (#10253)
The refactored ActivityBump query did not take into account the
template-level TTL, resulting in potentially incorrect bump
amounts for workspaces that have both a user-defined and template-
defined TTL that differ.

This change is ported over from PR#10035 to reduce the overall
size of that PR.

Also includes a drive-by unit test in autobuild for checking template autostop/TTL.

Co-authored-by: Dean Sheather <dean@deansheather.com>
2023-10-13 13:53:02 +01:00
Marcin Tojek 2a4ac2a53c feat: expose user seat limits as Prometheus metrics (#10169) 2023-10-13 08:10:16 +00:00
Eric Paulsen 570f963aea clarify external auth regex (#10243)
* docs: clarify external auth regex

* cleanup
2023-10-13 04:27:12 +00:00
Kayla Washburn 5fc9ff29d1 docs: mention /icons in the template documentation (#10230)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-10-12 15:32:23 -06:00
Steven Masley 88605b9d01 chore: add display name to member role (#10239)
* chore: add display name to member role
* Do not let member role be assignable
* Ignore org member role for assignability atm
2023-10-12 10:52:32 -05:00
Cian Johnston e5198a25a6 feat(scaletest): annotate scaletest pod when scaletest is in progress (#10235)
This PR modifies the scaletest-runner template to add a pod annotation to the scaletest runner pod.

The annotation key is set to com.coder.scaletest.phase and the annotation value is one of preparing, running, or complete.

This will allow checking if a scaletest is in progress, and preventing any operations that would interrupt a running scaletest.

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-10-12 14:36:15 +01:00
Mathias Fredriksson 782c22a293 test(coderd/database/dbtestutil): allow access to *sql.DB (#10238) 2023-10-12 15:07:16 +03:00
Mathias Fredriksson 7df40b85f2 chore(coderd/coderdtest): use testing.TB for use in benchmarks (#10237) 2023-10-12 15:03:16 +03: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
Muhammad Atif Ali 3adf86b608 chore(dogfood): use coder_extrenal_auth over deprecated coder_git_auth (#10208)
@kylecarbs does this need any changes on the Coder server?
For example adopting to the new `CODER_EXTERNAL_AUTH_X` variables?
2023-10-12 10:30:00 +03:00
dependabot[bot] 5f0457f160 chore: bump golang.org/x/net from 0.16.0 to 0.17.0 (#10232)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.16.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-11 21:43:59 -05:00
Michael Smith 9bf3b35bbf fix: update create workspace button to recognize template names+display names (#10233)
* fix: only used 'unnamed' as a last resort for templates

* fix: update filter logic to read from name field
2023-10-12 00:23:45 +00:00
Kayla Washburn 6ef1beec13 chore: recrop some icons for more consistent sizing (#10229) 2023-10-11 15:59:47 -06:00
Asher a9077812e2 fix: use UTF-8 encoding with screen (#10190)
This will make characters like ❯ and ⇣ work, for example.
2023-10-11 13:25:04 -08:00
Asher a67a5a8105 Prevent terminal being created twice (#10200)
I missed this in code review.
2023-10-11 12:47:32 -08:00
Bruno Quaresma 301c045aad chore(site): remove create workspace xservice (#10217)
* Move xstate transitions to provider

* Centrlize auth logic in the provider

* Remove actor

* Remove auth xservice

* Add loader while AuthProvider is loading

* Simplify and fix a few computed states

* Add a few replaces

* Fix logout

* Remove unused import

* Fix RequireAuth test

* Fix wait loader

* Fix tests

* Remove unecessary type

* Rename workspace queries module

* Remove auto create from workspace xservice

* Move external auth into its own hook

* Remove permissions fetching from templateByName query

* Remove form load from service

* Remove create workspace service entirely

* refactor: update workspace automation to use useEffectEvent

---------

Co-authored-by: Parkreiner <michaelsmith@coder.com>
Co-authored-by: Michael Smith <throwawayclover@gmail.com>
2023-10-11 20:42:25 +00:00
Bruno Quaresma 5be4b12378 chore(site): refactor AuthProvider to not use authXService (#10184)
* Move xstate transitions to provider

* Centrlize auth logic in the provider

* Remove actor

* Remove auth xservice

* Add loader while AuthProvider is loading

* Simplify and fix a few computed states

* Add a few replaces

* Fix logout

* Remove unused import

* Fix RequireAuth test

* Fix wait loader

* Fix tests

* Wrap signout with callback
2023-10-11 16:13:32 -04:00
Kira Pilot 7c6687813d fix(site): ensure empty string error shows default message (#10196)
* fix(site): ensure empty string error shows default message

* added test

* added logging

* asserting axios message

* cleanup and add test
2023-10-11 13:54:58 -04:00
Cian Johnston 59ae69b7f2 chore(enterprise/cli): fix test flake in TestServerDBCrypt (#10222)
* increase randomness in names generated by server dbcrypt

* more randomness

* close PTYs when we are done with them
2023-10-11 17:38:20 +01:00
Ben Potter 04e67836a5 docs: add v2.3.0 changelog (#10221)
* docs: add v2.3.0 changelog

* mention archive version
2023-10-11 11:05:53 -05:00
Cian Johnston 98a076fb46 chore(pty/ptytest): add sync.Once to close (#10220) 2023-10-11 16:47:02 +01:00
Steven Masley ac623b4717 feat: implement basic archive ui to make archiving failed versions easy (#10182)
* feat: implement basic archive ui to make archiving failed versions easy.
2023-10-11 15:06:10 +00: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
Bruno Quaresma edbd51955c chore(site): fix inconsistent fetching results on tests (#10215) 2023-10-11 11:17:56 -03:00
Colin Adler 43fa4349d6 chore: move single_tailnet experiment to * (#10188) 2023-10-11 08:50:45 -05:00
Mathias Fredriksson a2cd6640f3 fix(codersdk/agentsdk): improve ctx cancel in agent logs flush, fix test (#10214)
Fixes #9719
Related #9865
2023-10-11 12:42:30 +00: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 ed8092c83d fix(scaletest/createworkspaces): address race condition between agent closer and cleanup (#10210) 2023-10-11 12:10:51 +01: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
Cian Johnston dc117051e6 chore(docs): update admin/scale.md (#10168) 2023-10-11 09:40:43 +01:00
Muhammad Atif Ali fafecbd9b3 fix(dogfood): fix slackme module source (#10207)
This was pinned to the branch ref and is no more needed after the branch has been merged.
2023-10-11 08:29:25 +00:00
Spike Curtis 3c43216e99 fix: remove Parallel() call after timeout context (#10203)
Fixes test flake seen here: https://github.com/coder/coder/runs/17562370632

It's inherently flaky to create a context with a timeout and then later call `t.Parallel()` since it causes the test to wait until all non-parallel tests have completed before resuming execution.  By the time execution has resumed, the context may 
have expired.  The amount of time before resuming is dependent on machine resources and number of test cases, which are inherently variable.
2023-10-11 11:39:15 +04:00
Jon Ayers 4452a1484d fix: fix log spam related to skipping custom nice scores (#10206) 2023-10-11 02:32:50 -05:00
Spike Curtis 7c71053eab fix: stop leaking User into API handlers unless authorized
Fixes an issue where we extracted the `{user}` parameter from the URL and added it to the API Handler context regardless of whether the caller had permission to read the User.
2023-10-11 09:41:14 +04:00
Spike Curtis fbabb43cbb fix: ignore spurious node updates while waiting for errors (#10175)
fixes #9921
2023-10-11 09:22:20 +04:00
Kyle Carberry b0d2828f9e fix: append external auth env vars (#10201) 2023-10-11 05:17:08 +00:00
Jon Ayers ec9b480ac0 fix: use is-dormant instead of dormant_at (#10191) 2023-10-10 19:00:09 -05:00
Kyle Carberry 652e1a7d43 feat: add slackme module to dogfood (#10198) 2023-10-10 22:46:47 +00:00
Dean Sheather e7d9b8d858 feat: allow prefixes at the beginning of subdomain app hostnames (#10150) 2023-10-10 20:02:39 +00:00
Dean Sheather f48bc33e00 chore: remove cron schedule from quiet hours schedule page (#10187) 2023-10-10 19:55:28 +00: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 7e6b549170 chore: upgrade Terraform to 1.5.7 (#10186) 2023-10-10 12:46:59 -05:00
Colin Adler 21e0d540dc chore: upgrade Go to 1.20.10
https://groups.google.com/g/golang-announce/c/iNNxDTCjZvo/m/UDd7VKQuAAAJ?utm_medium=email&utm_source=footer
2023-10-10 12:23:54 -05:00
Kayla Washburn 7ea58eac18 chore: use emotion for styling (pt. 4) (#10149) 2023-10-10 10:46:45 -06:00
Colin Adler 00589d6422 chore: fix lint failures 2023-10-10 11:26:53 -05:00
Steven Masley 69d13f1676 chore: add archive column to template versions (#10178)
* chore: add archive column to template versions
2023-10-10 10:52:42 -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 2506415def chore(scaletest/templates/scaletest-runner): fix dashboard command invocation, autoscale provisioners (#10177)
add --retries on kubectl cp
remove --count parameter to scaletest dashboard
scale provisioners up and down

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-10-10 15:33:55 +01:00
Spike Curtis db8592fa93 chore: refactor workspace conversion to accept ownerName (#10171)
Refactors workspace conversion to accept the ownerName, rather than a slice of users, since all it does is search the slice for the owner and use the username.

This is in preparation for a fix to `postWorkspacesByOrganization()` that will remove the need to pass the user object.

Also avoids panicing if the required user is not in the slice, since `findUser` could return nil in the old code, which would then get dereferenced for the username.
2023-10-10 16:55:28 +04:00
Bruno Quaresma 19400d6794 fix(site): fix week range for insights (#10173) 2023-10-10 09:33:46 -03:00
Spike Curtis b780bff429 chore: drop unused redirectToLoginOnMe parameter (#10164)
The parameter seems to be vestigial from an earlier use of the middleware, but is always set to `false` in the code.
2023-10-10 16:13:00 +04:00
Michael Smith 5ae6cda89f feat: add warning message when trying to delete active template (#10142)
* refactor: clean up TemplatePageHeader

* chore: add react query configs for workspace lists

* feat: add delete-intercept functionality

* refactor: improve readability

* refactor: rename entities for readability/accuracy

* refactor: clean up variable names again

* refactor: remove redudant function calls

* fix: update logic check for safe deletions

* fix: update workspaces query logic

* fix: update call site for workspaces key
2023-10-10 08:04:54 -04:00
Spike Curtis 78b9201b31 chore: move AsSystemRestricted to caller (#10163)
Moves escalation to SystemRestricted out of the function that queries the database for the User. This is in prepartion for a refactor such that we don't need SystemRestricted in `ExtractUserParam` middleware.
2023-10-10 15:57:51 +04:00
Spike Curtis 8a47262faf fix: ignore logged errors in TestWorkspaceAgent/Timeout
fixes #10167

Annoyingly, there isn't a good way to stop the publish from being sent on shutdown, and subscribing to them in the test is too fragile because empty messages are sent in a bunch of places, so we can't reliably tell it's regarding timeouts.
2023-10-10 15:45:47 +04:00
Spike Curtis a0485c00ac chore: refactor ExtractUserParam to call function
Refactors `ExtractUserParam` to separate the part that actually obtains the user from the database and the part that sets it on the middleware context.  This is in preparation for further refactor that removes `ExtractUserParam` middleware from 
`organizations/{organization}/members/{user}` paths.
2023-10-10 15:00:53 +04: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
dependabot[bot] 017d7e9dad chore: bump github.com/prometheus/client_model to 0.5.0 (#10129)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-10 12:33:32 +03:00
Spike Curtis 211718f95a fix: fix MaliciousTar test case (#10158)
fixes #9895

Problem was that provisionerd tries to acquire the next job, and races with shutdown, triggering the assert in the handler.  Switches this test case to use the more robust handler.
2023-10-10 13:24:43 +04:00
Marcin Tojek f36fba2486 fix: revert: use CRC32 to shorten app subdomain
This reverts commit 0e28397c82.
2023-10-10 18:12:46 +10:00
Spike Curtis b039dc6989 fix: correct escaping in test regex (#10138)
Fixes regex escaping.  Spotted during a code read.
2023-10-10 08:42:39 +04:00
Kyle Carberry 9c098b218f feat: allow external auth providers to expose extra metadata (#10157) 2023-10-09 23:02:16 -05:00
Kyle Carberry 3eb9a43190 fix: use query to get external-auth by id (#10156) 2023-10-09 22:25:50 -05:00
Kyle Carberry a61f8ee45c fix: apply default ExtraTokenKeys to oauth (#10155) 2023-10-09 22:11:05 -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 20438ae6c2 chore: run go mod tidy 2023-10-09 15:10:46 -05:00
Kayla Washburn 42fb6cab12 chore: add icons for popular programming languages (#10141) 2023-10-09 13:52:06 -06:00
dependabot[bot] cb3b617ee9 ci: bump the github-actions group with 2 updates (#10131)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 22:39:40 +03:00
dependabot[bot] af63909134 chore: bump google.golang.org/api from 0.143.0 to 0.145.0 (#10130)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 22:39:29 +03:00
dependabot[bot] 583d44e60e chore: bump the golang-x group with 6 updates (#10128)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 22:39:13 +03:00
Kayla Washburn 1cdc62b332 chore: reorganize storybook (#10144) 2023-10-09 13:26:38 -06:00
Kyle Carberry 54648b90ca fix: properly trim spaces so multi-line shebang executes (#10146) 2023-10-09 19:19:57 +00:00
Colin Adler 3bbfcc593e feat: add request_id to HTTP trace spans (#10145) 2023-10-09 14:05:10 -05:00
Muhammad Atif Ali 2881b8b252 chore: add vault icon (#10125) 2023-10-09 18:25:07 +00:00
Spike Curtis b9c7bc4d3c fix: check for nil pointer in AwaitWorkspaceAgents
CompletedAt is a pointer and can be nil, need to check before calling IsZero() on it

c.f. https://github.com/coder/coder/runs/17534657301
2023-10-09 22:12:28 +04:00
Bruno Quaresma 584a2e87c9 chore(site): remove create template xservice (#10112) 2023-10-09 14:10:48 -03:00
Spike Curtis 54fd350913 feat: improve logging for speedtest connections
part of #7963

improve connection logging for speedtest connections
2023-10-09 20:48:28 +04: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
Spike Curtis 17e889af16 feat: improve logging for reconnectingPTY connections
part of #7963

improves connection logging on reconnectingPTY
2023-10-09 20:35:50 +04:00
Kyle Carberry b402f2a816 feat: add shebang support to scripts (#10134)
This enables much greater portability!
2023-10-09 10:57:57 -05:00
Kayla Washburn 17869ecb74 feat: select icons from emoji picker (#10119) 2023-10-09 09:50:24 -06:00
Kayla Washburn bda68b143a feat: add /icons page (#10093) 2023-10-09 09:49:26 -06:00
Spike Curtis 236e84c4d6 feat: add logging for forwarded TCP connections
part of #7963

log TCP connections as they are forwarded by gVisor
2023-10-09 19:41:26 +04:00
Kira Pilot 791144ddfd feat(site): disable rich parameters when using open in coder (#10114)
* feat(site): disable rich parameters when using open in coder

* updated docs

* chore(site): increase refetch interval for deployment health

* Revert "chore(site): increase refetch interval for deployment health"

This reverts commit 8e642be3fb.
2023-10-09 09:47:22 -04:00
Cian Johnston 5673aca408 feat(cli): add --parameter flag to exp scaletest command (#10132) 2023-10-09 14:08:24 +01:00
Marcin Tojek c6cf719f6c feat: show user limit on active users chart (#10101) 2023-10-09 13:38:41 +02:00
Michael Smith 38bb854c8b fix: update ErrorDialog logic and tests (#10111)
* fix: make error text less naggy

* fix: make input colors sync with confirmation text state

* fix: more color sync fixes

* fix: remove flaky warning messages in test

* fix: remove needless braces

* refactor: clean up code

* refactor: clean up code more
2023-10-06 19:40:37 -04:00
Kayla Washburn ae113179b3 chore: alias react-query (#10118) 2023-10-06 17:15:03 -06:00
Kira Pilot da47ac87db chore(site): increase refetch interval for deployment health (#10117) 2023-10-06 16:26:46 -04:00
Colin Adler 19dbf19177 fix(coder): properly check for missing organization membership
Fixes a possible panic introduced in https://github.com/coder/coder/pull/9781.
2023-10-06 14:57:21 -05:00
Kayla Washburn 71ad5909f2 chore: add icons.json file (#10085) 2023-10-06 13:46:37 -06:00
Colin Adler 36f3151b71 fix(enterprise/tailnet): properly detect legacy agents (#10083) 2023-10-06 16:49:26 +00:00
Colin Adler 03a7d2f70b chore: fix servertailnet test flake (#10110)
https://github.com/coder/coder/actions/runs/6424100765/job/17444018788?pr=10083#step:5:771
2023-10-06 11:31:53 -05:00
Kyle Carberry 2d2bea79a7 fix: convert the new dashboard theme to be an experiment (#10108) 2023-10-06 09:46:52 -05:00
Kyle Carberry 69b65693c9 fix: make the dark mode a bit less dark (#10107)
We got feedback from our Discord that it was a bit too dark,
so this brightens it up a little!
2023-10-06 14:09:21 +00:00
Kyle Carberry 23425d36a1 fix: invert the favicon on dark mode (#10097) 2023-10-06 07:55:11 -05: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 d24d2d2c8d fix: use proper react hook for favicon theme (#10094)
I was using `useState` before, which didn't re-render on load.
2023-10-05 18:23:56 -05:00
Bruno Quaresma 127f65c98b fix(site): fix logo width on sign in (#10091) 2023-10-05 17:44:53 -05:00
Kyle Carberry 4ad080c3b9 fix: apply the same border for button groups (#10092) 2023-10-05 17:44:45 -05:00
Kyle Carberry 14c8824c83 fix: use proper state in system theme (#10090) 2023-10-05 17:32:52 -05:00
Kyle Carberry fa0a597530 fix: add build status favicons based on system theme (#10089) 2023-10-05 22:23:11 +00:00
Kyle Carberry f270d9d351 feat: make the dashboard darker (#10084)
* feat: make the dashboard darker

Coder is a the internal software development platform. It is not
designed to be opinionated on colors, but it should look great.

Focusing on neutrality for our default dashboard theme is great
for our ICP. Some organizations may lean towards colors more or
less, and that shouldn't influence their decision when exploring
Coder.

* Make it a lil more dark

* Improve button outline

* Lower the red brightness

* Improve the divider contrast
2023-10-05 16:46:38 -05:00
Bruno Quaresma 04e7748a9b feat(site): load previous builds (#10076) 2023-10-05 18:30:11 -03:00
Kyle Carberry 1eb21d247b feat: adjust favicon based on system color-scheme (#10087)
This will still default to light-theme, but support showing
a white favicon when the system-theme is dark.
2023-10-05 16:11:15 -05:00
Bruno Quaresma a5f8300c76 refactor(site): do not block the screen when disconnected (#10057)
Close https://github.com/coder/coder/issues/9858

Demo:
https://github.com/coder/coder/assets/3165839/d6d4d2d7-487a-4739-86c9-042242d9820f
2023-10-05 18:06:26 -03:00
Michael Smith 2d6c4fe90a feat(site): add WorkspacesButton component (#10011)
* chore: Add OverflowY component

* chore: Add PopoverContainer component

* chore: Add SearchBox

* feat: add WorkspacesButton

* chore: Install MUI utils package

* chore: integrate WorkspacesButton

* chore: reorganize files

* fix: resolve hover state visual glitch

* chore: Add story for OverflowY

* fix: remove dynamic name from OverflowY story

* chore: update stories again

* fix: remove all references to icons (for now)

* refactor: move flex shrink to be OverflowY concern

* fix: remove needless render key

* fix: make sure popover closes before navigation

* refactor: clean up WorkspacesButton to use more native MUI

* fix: update integration into rest of view

* fix: remove JS security concern

* refactor: parameterize button language

* revert: undo sql/go file change

* fix: remove permissions dependency

* fix: simplify button prop types

* fix: lift data dependencies to page component

* refactor: clean up props

* fix: update dependencies again for Storybook
2023-10-05 20:46:42 +00: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
Kayla Washburn 3c87c4df1b feat: show descriptions for parameter options (#10068) 2023-10-05 13:14:28 -06:00
Jon Ayers b32d79ef0b fix: fix failed workspaces continuously auto-deleting (#10069)
- Fixes an issue where workspaces that are eligible for auto-deletion
  are retried every tick (1 minute) even if the previous deletion
  transition failed.

  The updated logic only attempts to delete workspaces that previously
  failed once a day (24 hours since last attempt).
2023-10-05 14:11:39 -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
Kyle Carberry 888b97fd86 chore: use JobStatus computed from the db (#10079)
Fixes `main`
2023-10-05 18:25:06 +00:00
Kayla Washburn 246dae0e1a chore: use emotion for styling (pt. 3) (#10026) 2023-10-05 10:49:44 -06:00
Kayla Washburn f001a57614 fix: only allow promoting successful template versions (#9998) 2023-10-05 10:49:25 -06:00
Mathias Fredriksson 48ee80a559 fix(cli): prevent sqlDB leaks in ConnectToPostgres (#10072) 2023-10-05 17:57:48 +03:00
Mathias Fredriksson 5d5a7da67f fix(scaletest): output error and trace instead of {} for json output (#10075) 2023-10-05 13:31:54 +00:00
Marcin Tojek ab9276bd08 feat: modify workspace_agent_stats index (#10073) 2023-10-05 14:49:08 +02:00
Colin Adler 30440915bc chore: add mod replace wireguard-go to fix race condition (#10071)
Fixes https://github.com/coder/coder/issues/10045
2023-10-04 23:47:01 -05:00
Steven Masley 5021e23105 chore: compute job status as column (#10024)
* chore: provisioner job status as column
* use provisioner job status for workspace searching
2023-10-04 20:57:46 -05:00
Colin Adler d5040441aa fix(site): change utils/delay import path (#10065) 2023-10-04 17:15:20 -05:00
Kyle Carberry df8e10cc4c chore: increase ForceCancelInterval for test flakes (#10066)
See https://github.com/coder/coder/actions/runs/6411239320/job/17406394658
2023-10-04 21:16:39 +00:00
Kyle Carberry bca7416069 fix: add --version flag to the root to support migrating customers (#10063) 2023-10-04 15:37:15 -05:00
Jon Ayers 1cd4405caf fix: change alpha badge color to violet (#10029)
- Makes it less scary.
2023-10-04 15:20:13 -05:00
Bruno Quaresma 03c377b754 fix(site): fix users page for template admins (#10060)
Fix https://github.com/coder/coder/issues/10053
2023-10-04 17:05:49 -03:00
Bruno Quaresma a8ed88b22e fix(site): fix chart label depending on interval (#10059)
Close https://github.com/coder/coder/issues/10056
2023-10-04 17:05:29 -03:00
Eric Paulsen 1076d16456 docs: update offline tf provider config (#10062) 2023-10-04 15:40:09 -04: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
Kyle Carberry 252ec14556 fix: update the validation url for github enterprise (#10061)
This was wrong... not sure why.
2023-10-04 18:49:40 +00:00
Kyle Carberry 7f9b4ad9a8 fix: allow auditors to query deployment stats and insights (#10058)
This is a customer request.
2023-10-04 18:37:25 +00:00
Bruno Quaresma 516b88dc25 fix(site): disable auto fields when they are disabled in the template settings (#10022)
- Disable form inputs 
- Add disable badge + tooltip with more info

<img width="1679" alt="Screen Shot 2023-10-03 at 14 20 26" src="https://github.com/coder/coder/assets/3165839/7555eb77-19d9-4a13-965e-6d40c3b852dd">

Fix https://github.com/coder/coder/issues/9820
2023-10-04 15:00:09 -03:00
Ben Potter 46551e619d docs: add v2.2.1 changelog (#10055)
* fix external auth link

* chore v2.2.1 changelog
2023-10-04 17:02:14 +00:00
Kyle Carberry 64692f0b69 chore: update docs for external-auth (#10046) 2023-10-04 11:38:41 -05:00
Kyle Carberry defef4671c fix: silence bash deprecation warning on macOS runners (#10051)
See https://github.com/coder/coder/actions/runs/6407839577/job/17395535790?pr=10050
2023-10-04 15:36:27 +00:00
Cian Johnston 2c2e98cc39 fix(coderd): fetch workspace agent scripts and log sources using system auth ctx (#10043)
* add failing unit test
* fetch log sources and agent scripts using system auth ctx
2023-10-04 15:50:51 +01:00
Kyle Carberry 8e44dce5b3 chore: fix external-auth.mp4 docs video (#10048) 2023-10-04 14:39:13 +00:00
Bruno Quaresma 6651aff57b feat(site): add user activity on template insights (#10013)
Close https://github.com/coder/coder/issues/9497


https://github.com/coder/coder/assets/3165839/941e268c-6c06-47ae-b57d-665e01e804b0
2023-10-04 11:37:47 -03:00
Kyle Carberry b468415a81 chore: revert docs for git-auth until release (#10044) 2023-10-04 14:33:28 +00:00
Bruno Quaresma 5e0cb372b4 fix(site): fix orphan values on insights (#10036) 2023-10-04 10:16:59 -03:00
Cian Johnston 2405bbe1b9 fix(coderd/database/dbtestutil): fix typo in pgDump (#10033) 2023-10-04 13:21:45 +01:00
Michael Smith c7218b40c9 docs: update frontend contribution docs (#10028)
* docs: update frontend contribution docs

* fix: update docs formatting
2023-10-04 08:11:07 -04:00
Colin Adler 4ab52766d2 feat: add --net-admin option to install script (#9953) 2023-10-03 23:01:46 +00:00
Colin Adler 39846d69d3 feat: modify agent install script to give CAP_NET_ADMIN if available (#9908) 2023-10-03 17:34:29 -05:00
timquinlan 2a19b46ab7 update to gateway offline install docs, 2 typos, 2 command additions (#10027) 2023-10-03 17:58:26 -04:00
dependabot[bot] 6322e13046 chore: bump postcss from 8.4.27 to 8.4.31 in /site (#10019)
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.27...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-04 00:28:54 +03:00
Bruno Quaresma efdbb6f9e6 fix(site): remove 48 week option (#10025) 2023-10-03 18:25:03 -03:00
Kayla Washburn e6aeee2ba2 feat: warn users when renaming workspaces (#10023) 2023-10-03 15:04:34 -06:00
dependabot[bot] 4df5c1ddec chore: bump the alpine image from 3.18.3 to 3.18.4 in Dockerfile.base (#9993)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 14:09:50 -05:00
Bruno Quaresma bdb9954f87 feat(site): add support for weekly data on template insights (#9997)
Close https://github.com/coder/coder/issues/9495
2023-10-03 15:14:11 -03:00
Bruno Quaresma e7042e601c fix(site): fix navbar hover (#10021) 2023-10-03 14:10:51 -03:00
Kayla Washburn c194119689 chore: rename AwaitTemplateVersionJobCompleted and AwaitWorkspaceBuildJobCompleted (#10003) 2023-10-03 11:02:56 -06:00
Kayla Washburn 4b97ac269b chore: refactor Pill styles (#10004) 2023-10-03 10:47:28 -06:00
Kyle Carberry 5e3bf275da chore: check for valid regex in git auth configs (#10020) 2023-10-03 16:45:07 +00:00
Ammar Bandukwala 70a4e56c01 ci: switch to M1 runners
ci: switch to M1 runners
    
 Per
    https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/,
    we should see large performance improvements.
2023-10-03 10:54:20 -05:00
Kyle Carberry f16eb1331f chore: update multiple git providers docs (#10017)
* chore: update multiple git providers docs

* Improve var name

* Fix fmt
2023-10-03 15:27:02 +00:00
Kyle Carberry eeab33b1c3 fix: do not require client_secret for external auth providers (#10016)
Device-based auth does not need a client secret.
2023-10-03 14:29:34 +00: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
Marcin Tojek f62f45a303 feat!: add sections parameter to template insights (#10010) 2023-10-03 15:44:50 +02:00
Marcin Tojek cb60409a8c feat: add index to workspace_agent_stats (#10009) 2023-10-03 11:13:44 +00:00
dependabot[bot] cc2772c646 chore: bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#9989)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 13:12:06 +03:00
Cian Johnston e55c25e037 chore: enable exhaustruct linter for database param structs (#9995) 2023-10-03 09:23:45 +01:00
Muhammad Atif Ali 352ec7bc4f chore(dogfood): rename project_directory to folder (#10008) 2023-10-03 07:11:58 +00:00
Monika Pawluczuk 4966ef02cf feat(cli): add reverse tunnelling SSH support for unix sockets (#9976) 2023-10-03 16:39:39 +10:00
Muhammad Atif Ali 465546eefd chore(dogfood): open vscode desktop in coder repo directory (#9999) 2023-10-03 08:55:25 +03:00
Eric Paulsen 3980dbd029 docs: add support to enterprise features (#10005) 2023-10-02 21:25:05 -05:00
Bruno Quaresma 9e1e365b32 chore(site): remove user search service (#9939) 2023-10-02 15:24:28 -03:00
Bruno Quaresma 42e25740eb chore(site): remove users and pagination services (#9932) 2023-10-02 15:10:51 -03:00
Kayla Washburn 885b2502ed chore: replace <ChooseOne> with alternatives when appropriate (#9907) 2023-10-02 10:51:35 -06:00
Kayla Washburn 148fa819ae chore: use emotion for styling (pt. 2) (#9951) 2023-10-02 10:48:11 -06:00
dependabot[bot] fabcc41a6b chore: bump @types/node from 18.17.0 to 18.18.1 in /offlinedocs (#9971)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.17.0 to 18.18.1.
- [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-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 10:06:59 -05:00
dependabot[bot] 6452008e32 chore: bump github.com/sqlc-dev/pqtype from 0.2.0 to 0.3.0 (#9991)
Bumps [github.com/sqlc-dev/pqtype](https://github.com/sqlc-dev/pqtype) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/sqlc-dev/pqtype/releases)
- [Commits](https://github.com/sqlc-dev/pqtype/compare/v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: github.com/sqlc-dev/pqtype
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 10:06:50 -05:00
dependabot[bot] f694204773 chore: bump @types/node from 18.17.0 to 18.18.1 in /site (#9967)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.17.0 to 18.18.1.
- [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-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 10:38:26 -04:00
dependabot[bot] 0a54506940 chore: bump the otel group with 3 updates (#9988)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 14:27:21 +00:00
dependabot[bot] f802fba89e chore: bump github.com/open-policy-agent/opa from 0.56.0 to 0.57.0 (#9992)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 14:15:58 +00:00
dependabot[bot] 89c2938b20 chore: bump google.golang.org/api from 0.142.0 to 0.143.0 (#9990)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 17:02:51 +03:00
dependabot[bot] 06411b8b17 ci: bump the github-actions group with 2 updates (#9994)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 17:02:41 +03:00
Marcin Tojek 57909e0c72 site(e2e): wait for empty workspaces (#9987) 2023-10-02 11:53:44 +00:00
Mathias Fredriksson 4b0565c895 feat(scaletest): add service banner status for runner (#9945) 2023-10-02 14:37:38 +03:00
Mathias Fredriksson e6d2ddb54b feat(scaletest): add apps to scaletest template (#9944) 2023-10-02 14:37:16 +03:00
Muhammad Atif Ali 1a07ee0b16 chore(site): make name bold in delete dialog
This makes the name bold in delete dialog and makes it readable.
<img width="439" alt="Screenshot 2023-09-24 at 03 30 55" src="https://github.com/coder/coder/assets/10648092/b97e634b-c7c8-4300-b78c-8091b3f2c9f0">

Edit: Tests are passed. thanks @aslilac
2023-10-02 13:57:21 +03: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
Muhammad Atif Ali 1906cc4806 Revert "chore: bump remark-gfm from 3.0.1 to 4.0.0 in /site (#9965)" (#9981)
This reverts commit 81a046e0a9.
2023-10-02 09:56:35 +02:00
dependabot[bot] 81a046e0a9 chore: bump remark-gfm from 3.0.1 to 4.0.0 in /site (#9965)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 10:31:56 +03:00
dependabot[bot] 247eeab3c8 chore: bump next from 13.4.12 to 13.5.3 in /offlinedocs (#9972)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 09:22:15 +03:00
dependabot[bot] 52b16f0622 chore: bump the eslint group in /site with 1 update
Bumps the eslint group in /site with 1 update: [eslint](https://github.com/eslint/eslint).

<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/eslint/eslint/releases">eslint's releases</a>.</em></p>
<blockquote>
<h2>v8.50.0</h2>
<h2>Features</h2>
<ul>
<li><a href="https://github.com/eslint/eslint/commit/27d5a9e57ad347982a68fcd0e75eafee42d344f0"><code>27d5a9e</code></a> feat: add suggestions to array-callback-return (<a href="https://redirect.github.com/eslint/eslint/issues/17590">#17590</a>) (Tanuj Kanti)</li>
<li><a href="https://github.com/eslint/eslint/commit/f9082ff3f3956a0a5a7d7659de63640a21c4de0f"><code>f9082ff</code></a> feat: flat-rule-tester make sure default config always matches (<a href="https://redirect.github.com/eslint/eslint/issues/17585">#17585</a>) (fnx)</li>
<li><a href="https://github.com/eslint/eslint/commit/83914adbfd5fce7d11b33d095ba6d6a39be0dbbc"><code>83914ad</code></a> feat: Implement SourceCode#applyInlineConfig() (<a href="https://redirect.github.com/eslint/eslint/issues/17351">#17351</a>) (Nicholas C. Zakas)</li>
<li><a href="https://github.com/eslint/eslint/commit/22a558228ff98f478fa308c9ecde361acc4caf20"><code>22a5582</code></a> feat: add rule <code>no-object-constructor</code>, deprecate <code>no-new-object</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17576">#17576</a>) (Francesco Trotta)</li>
<li><a href="https://github.com/eslint/eslint/commit/85a3d9e967b19cb4a0189746499d81ef2f93e14e"><code>85a3d9e</code></a> feat: allowVoid option in array-callback-return (<a href="https://redirect.github.com/eslint/eslint/issues/17564">#17564</a>) (Tanuj Kanti)</li>
</ul>
<h2>Bug Fixes</h2>
<ul>
<li><a href="https://github.com/eslint/eslint/commit/cc4d26b5a59d510f2c878e973fd245e8eff27c2a"><code>cc4d26b</code></a> fix: Ensure deprecated context.parserServices warns (<a href="https://redirect.github.com/eslint/eslint/issues/17593">#17593</a>) (Nicholas C. Zakas)</li>
<li><a href="https://github.com/eslint/eslint/commit/1ea4cfb585dcb52ac3cb1522a32f25cfe507121b"><code>1ea4cfb</code></a> fix: Ensure all RuleTester tests all deprecated context methods (<a href="https://redirect.github.com/eslint/eslint/issues/17587">#17587</a>) (Nicholas C. Zakas)</li>
<li><a href="https://github.com/eslint/eslint/commit/aa1b657a9febcd03e9298c03ae2888762795e322"><code>aa1b657</code></a> fix: wrong suggestion and message in <code>no-misleading-character-class</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17571">#17571</a>) (Yosuke Ota)</li>
</ul>
<h2>Documentation</h2>
<ul>
<li><a href="https://github.com/eslint/eslint/commit/180053759c6cf05a326c710353b4717fbf289ee0"><code>1800537</code></a> docs: Fix and standardize JSX code examples (<a href="https://redirect.github.com/eslint/eslint/issues/17591">#17591</a>) (Francesco Trotta)</li>
<li><a href="https://github.com/eslint/eslint/commit/48a44a73ac456739bdee348bbaf1840d2b1e4830"><code>48a44a7</code></a> docs: Add correct/incorrect tags to <code>prefer-arrow-callback</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17589">#17589</a>) (Francesco Trotta)</li>
<li><a href="https://github.com/eslint/eslint/commit/20893d48b9012f2b61bbbfeac8bee70d68d90e5e"><code>20893d4</code></a> docs: fix incorrect tag's place (<a href="https://redirect.github.com/eslint/eslint/issues/17575">#17575</a>) (Tanuj Kanti)</li>
<li><a href="https://github.com/eslint/eslint/commit/bd7a71fd6b7efb0445393304e2d48c5c06d46a45"><code>bd7a71f</code></a> docs: Update README (GitHub Actions Bot)</li>
</ul>
<h2>Chores</h2>
<ul>
<li><a href="https://github.com/eslint/eslint/commit/f8a8a2d6b45c82f94a574623759b6e3d2af193f3"><code>f8a8a2d</code></a> chore: upgrade <code>@​eslint/js</code><a href="https://github.com/8"><code>@​8</code></a>.50.0 (<a href="https://redirect.github.com/eslint/eslint/issues/17599">#17599</a>) (Milos Djermanovic)</li>
<li><a href="https://github.com/eslint/eslint/commit/38ada6df8f4a0313b7d0739b28f0af6b4897b8ce"><code>38ada6d</code></a> chore: package.json update for <code>@​eslint/js</code> release (ESLint Jenkins)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/eslint/eslint/blob/main/CHANGELOG.md">eslint's changelog</a>.</em></p>
<blockquote>
<p>v8.50.0 - September 22, 2023</p>
<ul>
<li><a href="https://github.com/eslint/eslint/commit/f8a8a2d6b45c82f94a574623759b6e3d2af193f3"><code>f8a8a2d</code></a> chore: upgrade <code>@​eslint/js</code><a href="https://github.com/8"><code>@​8</code></a>.50.0 (<a href="https://redirect.github.com/eslint/eslint/issues/17599">#17599</a>) (Milos Djermanovic)</li>
<li><a href="https://github.com/eslint/eslint/commit/38ada6df8f4a0313b7d0739b28f0af6b4897b8ce"><code>38ada6d</code></a> chore: package.json update for <code>@​eslint/js</code> release (ESLint Jenkins)</li>
<li><a href="https://github.com/eslint/eslint/commit/27d5a9e57ad347982a68fcd0e75eafee42d344f0"><code>27d5a9e</code></a> feat: add suggestions to array-callback-return (<a href="https://redirect.github.com/eslint/eslint/issues/17590">#17590</a>) (Tanuj Kanti)</li>
<li><a href="https://github.com/eslint/eslint/commit/f9082ff3f3956a0a5a7d7659de63640a21c4de0f"><code>f9082ff</code></a> feat: flat-rule-tester make sure default config always matches (<a href="https://redirect.github.com/eslint/eslint/issues/17585">#17585</a>) (fnx)</li>
<li><a href="https://github.com/eslint/eslint/commit/83914adbfd5fce7d11b33d095ba6d6a39be0dbbc"><code>83914ad</code></a> feat: Implement SourceCode#applyInlineConfig() (<a href="https://redirect.github.com/eslint/eslint/issues/17351">#17351</a>) (Nicholas C. Zakas)</li>
<li><a href="https://github.com/eslint/eslint/commit/cc4d26b5a59d510f2c878e973fd245e8eff27c2a"><code>cc4d26b</code></a> fix: Ensure deprecated context.parserServices warns (<a href="https://redirect.github.com/eslint/eslint/issues/17593">#17593</a>) (Nicholas C. Zakas)</li>
<li><a href="https://github.com/eslint/eslint/commit/1ea4cfb585dcb52ac3cb1522a32f25cfe507121b"><code>1ea4cfb</code></a> fix: Ensure all RuleTester tests all deprecated context methods (<a href="https://redirect.github.com/eslint/eslint/issues/17587">#17587</a>) (Nicholas C. Zakas)</li>
<li><a href="https://github.com/eslint/eslint/commit/180053759c6cf05a326c710353b4717fbf289ee0"><code>1800537</code></a> docs: Fix and standardize JSX code examples (<a href="https://redirect.github.com/eslint/eslint/issues/17591">#17591</a>) (Francesco Trotta)</li>
<li><a href="https://github.com/eslint/eslint/commit/22a558228ff98f478fa308c9ecde361acc4caf20"><code>22a5582</code></a> feat: add rule <code>no-object-constructor</code>, deprecate <code>no-new-object</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17576">#17576</a>) (Francesco Trotta)</li>
<li><a href="https://github.com/eslint/eslint/commit/48a44a73ac456739bdee348bbaf1840d2b1e4830"><code>48a44a7</code></a> docs: Add correct/incorrect tags to <code>prefer-arrow-callback</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17589">#17589</a>) (Francesco Trotta)</li>
<li><a href="https://github.com/eslint/eslint/commit/aa1b657a9febcd03e9298c03ae2888762795e322"><code>aa1b657</code></a> fix: wrong suggestion and message in <code>no-misleading-character-class</code> (<a href="https://redirect.github.com/eslint/eslint/issues/17571">#17571</a>) (Yosuke Ota)</li>
<li><a href="https://github.com/eslint/eslint/commit/20893d48b9012f2b61bbbfeac8bee70d68d90e5e"><code>20893d4</code></a> docs: fix incorrect tag's place (<a href="https://redirect.github.com/eslint/eslint/issues/17575">#17575</a>) (Tanuj Kanti)</li>
<li><a href="https://github.com/eslint/eslint/commit/85a3d9e967b19cb4a0189746499d81ef2f93e14e"><code>85a3d9e</code></a> feat: allowVoid option in array-callback-return (<a href="https://redirect.github.com/eslint/eslint/issues/17564">#17564</a>) (Tanuj Kanti)</li>
<li><a href="https://github.com/eslint/eslint/commit/bd7a71fd6b7efb0445393304e2d48c5c06d46a45"><code>bd7a71f</code></a> docs: Update README (GitHub Actions Bot)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/eslint/eslint/commit/299bfae1254f22bd4b3bccd897d6355f63e0d3b6"><code>299bfae</code></a> 8.50.0</li>
<li><a href="https://github.com/eslint/eslint/commit/212687c36a9e2682b84f5de2b683b025182d9777"><code>212687c</code></a> Build: changelog update for 8.50.0</li>
<li><a href="https://github.com/eslint/eslint/commit/f8a8a2d6b45c82f94a574623759b6e3d2af193f3"><code>f8a8a2d</code></a> chore: upgrade <code>@​eslint/js</code><a href="https://github.com/8"><code>@​8</code></a>.50.0 (<a href="https://redirect.github.com/eslint/eslint/issues/17599">#17599</a>)</li>
<li><a href="https://github.com/eslint/eslint/commit/38ada6df8f4a0313b7d0739b28f0af6b4897b8ce"><code>38ada6d</code></a> chore: package.json update for <code>@​eslint/js</code> release</li>
<li><a href="https://github.com/eslint/eslint/commit/27d5a9e57ad347982a68fcd0e75eafee42d344f0"><code>27d5a9e</code></a> feat: add suggestions to array-callback-return (<a href="https://redirect.github.com/eslint/eslint/issues/17590">#17590</a>)</li>
<li><a href="https://github.com/eslint/eslint/commit/f9082ff3f3956a0a5a7d7659de63640a21c4de0f"><code>f9082ff</code></a> feat: flat-rule-tester make sure default config always matches (<a href="https://redirect.github.com/eslint/eslint/issues/17585">#17585</a>)</li>
<li><a href="https://github.com/eslint/eslint/commit/83914adbfd5fce7d11b33d095ba6d6a39be0dbbc"><code>83914ad</code></a> feat: Implement SourceCode#applyInlineConfig() (<a href="https://redirect.github.com/eslint/eslint/issues/17351">#17351</a>)</li>
<li><a href="https://github.com/eslint/eslint/commit/cc4d26b5a59d510f2c878e973fd245e8eff27c2a"><code>cc4d26b</code></a> fix: Ensure deprecated context.parserServices warns (<a href="https://redirect.github.com/eslint/eslint/issues/17593">#17593</a>)</li>
<li><a href="https://github.com/eslint/eslint/commit/1ea4cfb585dcb52ac3cb1522a32f25cfe507121b"><code>1ea4cfb</code></a> fix: Ensure all RuleTester tests all deprecated context methods (<a href="https://redirect.github.com/eslint/eslint/issues/17587">#17587</a>)</li>
<li><a href="https://github.com/eslint/eslint/commit/180053759c6cf05a326c710353b4717fbf289ee0"><code>1800537</code></a> docs: Fix and standardize JSX code examples (<a href="https://redirect.github.com/eslint/eslint/issues/17591">#17591</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/eslint/eslint/compare/v8.49.0...v8.50.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint&package-manager=npm_and_yarn&previous-version=8.49.0&new-version=8.50.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions


</details>
2023-10-02 08:53:55 +03:00
dependabot[bot] 8af28717a3 chore: bump eslint from 8.49.0 to 8.50.0 in /offlinedocs (#9970)
Bumps [eslint](https://github.com/eslint/eslint) from 8.49.0 to 8.50.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.49.0...v8.50.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 05:46:22 +00:00
dependabot[bot] d650cf9b8c chore: bump eslint-config-next from 13.4.10 to 13.5.3 in /offlinedocs (#9973)
Bumps [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next) from 13.4.10 to 13.5.3.
- [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/commits/v13.5.3/packages/eslint-config-next)

---
updated-dependencies:
- dependency-name: eslint-config-next
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 08:42:11 +03:00
dependabot[bot] cac677b4ba chore: bump @octokit/types from 11.1.0 to 12.0.0 in /site (#9963)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-01 11:50:36 +00:00
dependabot[bot] 3dc478ad6b chore: bump ts-proto from 1.158.0 to 1.159.1 in /site (#9964)
Bumps [ts-proto](https://github.com/stephenh/ts-proto) from 1.158.0 to 1.159.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/stephenh/ts-proto/releases">ts-proto's releases</a>.</em></p>
<blockquote>
<h2>v1.159.1</h2>
<h2><a href="https://github.com/stephenh/ts-proto/compare/v1.159.0...v1.159.1">1.159.1</a> (2023-09-30)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Use a Map when map keys are boolean. (<a href="https://redirect.github.com/stephenh/ts-proto/issues/933">#933</a>) (<a href="https://github.com/stephenh/ts-proto/commit/c1253a3761405d7a2ffe4d15f4c3ffb364697a02">c1253a3</a>), closes <a href="https://redirect.github.com/stephenh/ts-proto/issues/926">#926</a></li>
</ul>
<h2>v1.159.0</h2>
<h1><a href="https://github.com/stephenh/ts-proto/compare/v1.158.1...v1.159.0">1.159.0</a> (2023-09-30)</h1>
<h3>Features</h3>
<ul>
<li>Add globalThisPolyfill, defaults false. (<a href="https://redirect.github.com/stephenh/ts-proto/issues/931">#931</a>) (<a href="https://github.com/stephenh/ts-proto/commit/085fa21603a74544af192f404289c2e62ecfd8f6">085fa21</a>)</li>
</ul>
<h2>v1.158.1</h2>
<h2><a href="https://github.com/stephenh/ts-proto/compare/v1.158.0...v1.158.1">1.158.1</a> (2023-09-30)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Use globalThis for Array/String/Boolean (<a href="https://redirect.github.com/stephenh/ts-proto/issues/930">#930</a>) (<a href="https://github.com/stephenh/ts-proto/commit/9a252c3d4cf988496f6de17cc378dbb09a1baf92">9a252c3</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/stephenh/ts-proto/blob/main/CHANGELOG.md">ts-proto's changelog</a>.</em></p>
<blockquote>
<h2><a href="https://github.com/stephenh/ts-proto/compare/v1.159.0...v1.159.1">1.159.1</a> (2023-09-30)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Use a Map when map keys are boolean. (<a href="https://redirect.github.com/stephenh/ts-proto/issues/933">#933</a>) (<a href="https://github.com/stephenh/ts-proto/commit/c1253a3761405d7a2ffe4d15f4c3ffb364697a02">c1253a3</a>), closes <a href="https://redirect.github.com/stephenh/ts-proto/issues/926">#926</a></li>
</ul>
<h1><a href="https://github.com/stephenh/ts-proto/compare/v1.158.1...v1.159.0">1.159.0</a> (2023-09-30)</h1>
<h3>Features</h3>
<ul>
<li>Add globalThisPolyfill, defaults false. (<a href="https://redirect.github.com/stephenh/ts-proto/issues/931">#931</a>) (<a href="https://github.com/stephenh/ts-proto/commit/085fa21603a74544af192f404289c2e62ecfd8f6">085fa21</a>)</li>
</ul>
<h2><a href="https://github.com/stephenh/ts-proto/compare/v1.158.0...v1.158.1">1.158.1</a> (2023-09-30)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Use globalThis for Array/String/Boolean (<a href="https://redirect.github.com/stephenh/ts-proto/issues/930">#930</a>) (<a href="https://github.com/stephenh/ts-proto/commit/9a252c3d4cf988496f6de17cc378dbb09a1baf92">9a252c3</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/stephenh/ts-proto/commit/09e9fa2594431785253a2fc15e66d85e721003e9"><code>09e9fa2</code></a> chore(release): 1.159.1 [skip ci]</li>
<li><a href="https://github.com/stephenh/ts-proto/commit/c1253a3761405d7a2ffe4d15f4c3ffb364697a02"><code>c1253a3</code></a> fix: Use a Map when map keys are boolean. (<a href="https://redirect.github.com/stephenh/ts-proto/issues/933">#933</a>)</li>
<li><a href="https://github.com/stephenh/ts-proto/commit/ccf54be52d181c341ff310c68665a65fef3ed86d"><code>ccf54be</code></a> chore(release): 1.159.0 [skip ci]</li>
<li><a href="https://github.com/stephenh/ts-proto/commit/085fa21603a74544af192f404289c2e62ecfd8f6"><code>085fa21</code></a> feat: Add globalThisPolyfill, defaults false. (<a href="https://redirect.github.com/stephenh/ts-proto/issues/931">#931</a>)</li>
<li><a href="https://github.com/stephenh/ts-proto/commit/6f856376b103284e2694d3bb7d4471c6b43429f9"><code>6f85637</code></a> chore(release): 1.158.1 [skip ci]</li>
<li><a href="https://github.com/stephenh/ts-proto/commit/9a252c3d4cf988496f6de17cc378dbb09a1baf92"><code>9a252c3</code></a> fix: Use globalThis for Array/String/Boolean (<a href="https://redirect.github.com/stephenh/ts-proto/issues/930">#930</a>)</li>
<li>See full diff in <a href="https://github.com/stephenh/ts-proto/compare/v1.158.0...v1.159.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ts-proto&package-manager=npm_and_yarn&previous-version=1.158.0&new-version=1.159.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions


</details>
2023-10-01 14:49:04 +03:00
dependabot[bot] b035c4d88a chore: bump chromatic from 7.1.0 to 7.2.0 in /site (#9966)
Bumps [chromatic](https://github.com/chromaui/chromatic-cli) from 7.1.0 to 7.2.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/5366e6b8a73f606cdf48bec69176c090bdaf58c4"><code>5366e6b</code></a> 7.2.0</li>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/0749afb68e1da025de47af3204e6ea5062c9c571"><code>0749afb</code></a> Step package.json back</li>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/788d8e96f72a95fc69f831fbceab862fd404a6ce"><code>788d8e9</code></a> Merge pull request <a href="https://redirect.github.com/chromaui/chromatic-cli/issues/819">#819</a> from chromaui/tom/drop-loggly</li>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/0967fa81cc4358e3709e4468c5599e1797922c58"><code>0967fa8</code></a> 7.2.1-canary.0</li>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/2f9484e733bd09300de76707d24815e08adbaca7"><code>2f9484e</code></a> No longer log to loggly</li>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/6f614e64036e02bbb0cec3d9252718de7277acb0"><code>6f614e6</code></a> 7.2.0-next.1</li>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/10bc2a32a1db2e5039e117e233f3aba3c6cfe51b"><code>10bc2a3</code></a> 7.2.0-next.0</li>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/a0b14d8c45f8fc2c50cbb7b944bcddee3a9cf294"><code>a0b14d8</code></a> Merge pull request <a href="https://redirect.github.com/chromaui/chromatic-cli/issues/814">#814</a> from chromaui/tom/ap-3623-add-cli-support-for-a-chrom...</li>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/a8acc0e8d33180a35846feb8c314d0fe0edfae97"><code>a8acc0e</code></a> Trying <code>xlarge</code></li>
<li><a href="https://github.com/chromaui/chromatic-cli/commit/5af4e277207621d0b379bc272a60972cf1c29eeb"><code>5af4e27</code></a> Try medium resource class</li>
<li>Additional commits viewable in <a href="https://github.com/chromaui/chromatic-cli/compare/v7.1.0...v7.2.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=chromatic&package-manager=npm_and_yarn&previous-version=7.1.0&new-version=7.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions


</details>
2023-10-01 14:42:35 +03:00
dependabot[bot] 3d71173e74 chore: bump yup from 1.2.0 to 1.3.2 in /site (#9968)
Bumps [yup](https://github.com/jquense/yup) from 1.2.0 to 1.3.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/jquense/yup/blob/master/CHANGELOG.md">yup's changelog</a>.</em></p>
<blockquote>
<h2><a href="https://github.com/jquense/yup/compare/v1.3.1...v1.3.2">1.3.2</a> (2023-09-29)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>pick and omit with excluded edges (<a href="https://github.com/jquense/yup/commit/6956ee788369dff00e5ecadb506726af3598a87e">6956ee7</a>), closes <a href="https://redirect.github.com/jquense/yup/issues/2097">#2097</a></li>
</ul>
<h2><a href="https://github.com/jquense/yup/compare/v1.3.0...v1.3.1">1.3.1</a> (2023-09-26)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>ValidationError extends Error (<a href="https://github.com/jquense/yup/commit/bc5121b92d8e16baf8fe9b83f0247a4e90e169b8">bc5121b</a>)</li>
</ul>
<h1><a href="https://github.com/jquense/yup/compare/v1.2.0...v1.3.0">1.3.0</a> (2023-09-23)</h1>
<h3>Bug Fixes</h3>
<ul>
<li>add tuple to locale object (<a href="https://redirect.github.com/jquense/yup/issues/2100">#2100</a>) (<a href="https://github.com/jquense/yup/commit/809b55a9c16e0cd567f4eced9b9ab02ad8b0bffa">809b55a</a>)</li>
<li>performance improvement (<a href="https://redirect.github.com/jquense/yup/issues/2043">#2043</a>) (<a href="https://redirect.github.com/jquense/yup/issues/2044">#2044</a>) (<a href="https://github.com/jquense/yup/commit/ee1b7317b0a9fc0e16a7d33064c3e5584bd7f2d5">ee1b731</a>)</li>
</ul>
<h3>Features</h3>
<ul>
<li>Allow schema metadata to be strongly typed (<a href="https://redirect.github.com/jquense/yup/issues/2021">#2021</a>) (<a href="https://github.com/jquense/yup/commit/e593f8f72e7195cf0ac48fa8e1cd82d95c1e6bb5">e593f8f</a>)</li>
</ul>
<h3>Reverts</h3>
<ul>
<li>Revert &quot;fix: performance improvement (<a href="https://redirect.github.com/jquense/yup/issues/2043">#2043</a>) (<a href="https://redirect.github.com/jquense/yup/issues/2044">#2044</a>)&quot; (<a href="https://redirect.github.com/jquense/yup/issues/2071">#2071</a>) (<a href="https://github.com/jquense/yup/commit/b940eef48eb7456622ae384d0ffa7363d4fbad25">b940eef</a>), closes <a href="https://redirect.github.com/jquense/yup/issues/2043">#2043</a> <a href="https://redirect.github.com/jquense/yup/issues/2044">#2044</a> <a href="https://redirect.github.com/jquense/yup/issues/2071">#2071</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/jquense/yup/commit/a58f02d2f6164c46a9757a818eebac582f7a441c"><code>a58f02d</code></a> Publish v1.3.2</li>
<li><a href="https://github.com/jquense/yup/commit/2f2c0aa9be6258b763f95e7de076c2dcfbe0cae3"><code>2f2c0aa</code></a> fix type</li>
<li><a href="https://github.com/jquense/yup/commit/020901fcf3cfb12a38afd90e4fe56e2e37c312a1"><code>020901f</code></a> Allow parent resolve before describe. (<a href="https://redirect.github.com/jquense/yup/issues/2051">#2051</a>)</li>
<li><a href="https://github.com/jquense/yup/commit/6956ee788369dff00e5ecadb506726af3598a87e"><code>6956ee7</code></a> fix: pick and omit with excluded edges</li>
<li><a href="https://github.com/jquense/yup/commit/e15297bb747552e4742bbaa2ecb95aad1c37f918"><code>e15297b</code></a> Publish v1.3.1</li>
<li><a href="https://github.com/jquense/yup/commit/bc5121b92d8e16baf8fe9b83f0247a4e90e169b8"><code>bc5121b</code></a> fix: ValidationError extends Error</li>
<li><a href="https://github.com/jquense/yup/commit/9c1208c0685a5a7571ef74c39a08d248100f793f"><code>9c1208c</code></a> Publish v1.3.0</li>
<li><a href="https://github.com/jquense/yup/commit/809b55a9c16e0cd567f4eced9b9ab02ad8b0bffa"><code>809b55a</code></a> fix: add tuple to locale object (<a href="https://redirect.github.com/jquense/yup/issues/2100">#2100</a>)</li>
<li><a href="https://github.com/jquense/yup/commit/13ce359c20be195794f22f16a64d633bc28db7f5"><code>13ce359</code></a> Update README.md (<a href="https://redirect.github.com/jquense/yup/issues/2101">#2101</a>)</li>
<li><a href="https://github.com/jquense/yup/commit/1ee9b21c994b4293f3ab338119dc17ab2f4e284c"><code>1ee9b21</code></a> Export Lazy and Reference types (<a href="https://redirect.github.com/jquense/yup/issues/2093">#2093</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/jquense/yup/compare/v1.2.0...v1.3.2">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=yup&package-manager=npm_and_yarn&previous-version=1.2.0&new-version=1.3.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions


</details>
2023-10-01 14:41:38 +03:00
dependabot[bot] 5b18007311 chore: bump @vitejs/plugin-react from 4.0.1 to 4.1.0 in /site (#9969)
Bumps [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) from 4.0.1 to 4.1.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/vitejs/vite-plugin-react/releases"><code>@​vitejs/plugin-react</code>'s releases</a>.</em></p>
<blockquote>
<h2>v4.1.0</h2>
<ul>
<li>Add <code>@types/babel__cores</code> to dependencies (fix <a href="https://redirect.github.com/vitejs/vite-plugin-react/issues/211">#211</a>)</li>
<li>Improve build perf when not using Babel plugins by lazy loading <code>@babel/core</code> <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/212">#212</a></li>
<li>Better invalidation message when an export is added &amp; fix HMR for export of nullish values <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/215">#215</a></li>
<li>Include non-dev jsx runtime in optimizeDeps &amp; support HMR for JS files using the non dev runtime <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/224">#224</a></li>
<li>The build output now contains a <code>index.d.cts</code> file so you don't get types errors when setting <code>moduleResolution</code> to <code>node16</code> or <code>nodenext</code> in your tsconfig (we recommend using <code>bundler</code> which is more close to how Vite works)</li>
</ul>
<h2>v4.0.4</h2>
<ul>
<li>Fix <a href="https://github.com/vitejs/vite-plugin-react/discussions/198">#198</a>: Enable Babel if presets list is not empty</li>
</ul>
<h2>v4.0.3</h2>
<ul>
<li>Revert <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/108">#108</a>: Remove throw when refresh runtime is loaded twice to enable usage in micro frontend apps. This was added to help fix setup usage, and this is not worth an annoying warning for others or a config parameter.</li>
</ul>
<h2>v4.0.2</h2>
<ul>
<li>Fix fast-refresh for files that are transformed into jsx (<a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/188">#188</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md"><code>@​vitejs/plugin-react</code>'s changelog</a>.</em></p>
<blockquote>
<h2>4.1.0 (2023-09-24)</h2>
<ul>
<li>Add <code>@types/babel__cores</code> to dependencies (fix <a href="https://redirect.github.com/vitejs/vite-plugin-react/issues/211">#211</a>)</li>
<li>Improve build perf when not using Babel plugins by lazy loading <code>@babel/core</code> <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/212">#212</a></li>
<li>Better invalidation message when an export is added &amp; fix HMR for export of nullish values <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/215">#215</a></li>
<li>Include non-dev jsx runtime in optimizeDeps &amp; support HMR for JS files using the non dev runtime <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/224">#224</a></li>
<li>The build output now contains a <code>index.d.cts</code> file so you don't get types errors when setting <code>moduleResolution</code> to <code>node16</code> or <code>nodenext</code> in your tsconfig (we recommend using <code>bundler</code> which is more close to how Vite works)</li>
</ul>
<h2>4.0.4 (2023-07-31)</h2>
<ul>
<li>Fix <a href="https://github.com/vitejs/vite-plugin-react/discussions/198">#198</a>: Enable Babel if presets list is not empty</li>
</ul>
<h2>4.0.3 (2023-07-10)</h2>
<ul>
<li>Revert <a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/108">#108</a>: Remove throw when refresh runtime is loaded twice to enable usage in micro frontend apps. This was added to help fix setup usage, and this is not worth an annoying warning for others or a config parameter.</li>
</ul>
<h2>4.0.2 (2023-07-06)</h2>
<ul>
<li>Fix fast-refresh for files that are transformed into jsx (<a href="https://redirect.github.com/vitejs/vite-plugin-react/pull/188">#188</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/bf1453edac2d21f7fc06680aa66d178082b770df"><code>bf1453e</code></a> release: plugin-react@4.1.0</li>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/25fe88a02d3a718b81a3b1290ff4e46bfab427f9"><code>25fe88a</code></a> feat: add support for non-dev jsx runtime (<a href="https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react/issues/224">#224</a>)</li>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/272c338a7c2927d6e673901bc52f25791d466a98"><code>272c338</code></a> fix(deps): update all non-major dependencies (<a href="https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react/issues/206">#206</a>)</li>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/286360281992c425bf75cb0a18846f65fcdc5ef3"><code>2863602</code></a> fix: better invalidation message when an export is added &amp; fix HMR for export...</li>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/ccd25ddf1fe9d70d9486e8f07da95bcf3fd0b5d6"><code>ccd25dd</code></a> perf: lazy load <code>@babel/core</code> (<a href="https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react/issues/212">#212</a>)</li>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/8413a1835e78a9d923bcc5a5723cb1e903c8fc0f"><code>8413a18</code></a> fix: add <code>@types/babel__cores</code> to dependencies (fix <a href="https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react/issues/211">#211</a>)</li>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/90328ce92ecfdc9797aa58af67e46f9872b29118"><code>90328ce</code></a> release: plugin-react@4.0.4</li>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/9f9e2f66d699c47e8bf7b88175fdd55908a2bf35"><code>9f9e2f6</code></a> fix(deps): update all non-major dependencies (<a href="https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react/issues/199">#199</a>)</li>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/6e2e0a406e8478002dc0ab4a5104d370d4afc7b3"><code>6e2e0a4</code></a> fix <a href="https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react/issues/198">#198</a>: enable Babel if presets list is not empty</li>
<li><a href="https://github.com/vitejs/vite-plugin-react/commit/cbdf19f8f973fe78495336ca14247ddfc276f998"><code>cbdf19f</code></a> release: plugin-react@4.0.3</li>
<li>Additional commits viewable in <a href="https://github.com/vitejs/vite-plugin-react/commits/v4.1.0/packages/plugin-react">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@vitejs/plugin-react&package-manager=npm_and_yarn&previous-version=4.0.1&new-version=4.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions


</details>
2023-10-01 14:41:02 +03: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
Muhammad Atif Ali 16a2d4d733 chore(dogfood): use coder modules in dogfood (#9890)
updates dogfood to use coder modules

---

<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>

> # TL;DR
> This pull request removes the `dotfiles_url` and `jetbrains_ide` parameters, and the related code from the `main.tf` file. It also adds several new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`. The `startup_script` has been updated to remove the installation and launch of `filebrowser` and the `dotfiles` related code. 
> 
> # What changed
> - Removed `dotfiles_url` and `jetbrains_ide` parameters.
> - Removed related code for `dotfiles_url` and `jetbrains_ide`.
> - Added new modules for `dotfiles`, `git-clone`, `personalize`, `code-server`, `jetbrains_gateway`, `vscode`, and `filebrowser`.
> - Updated `startup_script` to remove the installation and launch of `filebrowser` and the `dotfiles` related code.
> 
> # How to test
> 1. Go to https://dev.coder.com/templates/coder/versions/dazzling_hugle0 and create a new workspace or change your dogfood workspace version to `dazzling_hugle0` .
> 2. Verify that the new modules are working as expected.
> 
> # Why make this change
> The `dotfiles_url` and `jetbrains_ide` parameters and related code were removed to simplify the configuration and make it easier to manage. The new modules were added to provide additional functionality and improve the overall user experience. The `startup_script` was updated to reflect these changes.
</details>
2023-09-30 22:22:14 +03:00
Kyle Carberry c1cd93da30 chore: update helm golden files (#9959) 2023-09-30 18:36:34 +00:00
Ammar Bandukwala 3d21872230 chore: set sessionAffinity to None in helm chart (#9918) 2023-09-30 12:33:20 -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
Stephen Kirby fa297e1096 feat(site): add white coder icon (#9955)
* Added a white coder svg

* renamed svg

* rename icon
2023-09-29 15:25:44 -05:00
Mathias Fredriksson e6cb2c5a8e chore(go.mod): update cdr.dev/slog to include additional stackdriver field (#9938) 2023-09-29 20:22:37 +00:00
Eric Paulsen 710b170adf site(fix): add space characters to group display name (#9950) 2023-09-29 15:25:59 -04: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
Kayla Washburn 2b5428e95f refactor: start using emotion for styling (#9909) 2023-09-29 13:08:17 -06:00
Colin Adler 4da1223a80 fix: pass OnSubscribe to HA MultiAgent (#9947)
Fixes https://github.com/coder/coder/issues/9929
2023-09-29 13:37:17 -05:00
Kayla Washburn 61154a6bb5 chore: update datadog (#9925) 2023-09-29 12:06:24 -06: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 87ebe6c2c2 test: fix flaky TestPostWorkspacesByOrganization/Create (#9931) 2023-09-29 13:06:21 +00:00
Marcin Tojek c0705ec40e fix: flaky TestCreateValidateRichParameters/ValidateString (#9928) 2023-09-29 12:54:51 +02:00
Marcin Tojek 2dd49cc0a7 fix(site): double input box for logo url (#9926) 2023-09-29 07:27:47 +00:00
Steven Masley beac36027f chore: generate any interface as Deployment Option in TypeScript (#9917)
* chore: handle interfaces as "any" in typescript

Use generated Deployment Option
2023-09-28 16:14:28 -05:00
Colin Adler 885041a65b revert: downgrade alpine to v3.18.3 (#9916) 2023-09-28 20:27:47 +00:00
Steven Masley 8cff6237ba chore: show yaml option in deployment page (#9912) 2023-09-28 15:10:06 -05:00
Colin Adler 92c0237899 chore: upgrade alpine to v3.18.4 2023-09-28 19:47:48 +00:00
Colin Adler ed8ae2f123 chore: upgrade go to 1.20.8 2023-09-28 14:17:15 -05:00
Steven Masley 9e845213f5 chore: include organization id in workspace build audit log (#9905)
* chore: include organization id in workspace build audit log
* rename 'BuildAudit' to 'WorkspaceBuildAudit'
2023-09-28 11:29:12 -05:00
Marcin Tojek 305556f655 feat(site): use custom application name (#9902) 2023-09-28 18:23:27 +02:00
Kayla Washburn 0f946669c1 chore: simplify imports (#9896) 2023-09-28 09:21:36 -06:00
Marcin Tojek dae528f5e7 feat: expose application name and logo url via meta properties (#9900) 2023-09-28 10:50:40 +02:00
Steven Masley 2d1b35390e chore: relax wsproxy version checking (#9796) 2023-09-27 19:34:55 +00:00
Michael Smith dcad8fdc2f fix: add checks for preventing HSL colors from entering React state (#9893)
* fix: remove hsl color from initial form state

* chore: add extra color helpers

* chore: add extra runtime validation for colors

* chore: clean up comments for clarity

* chore: add tests for colors
2023-09-27 19:27:11 +00:00
Ben Potter 20a681af8d chore: add v2.2.0 changelog (#9889)
* chore: add v2.2.0 changelog

* add actual changelog
2023-09-27 17:38:43 +00:00
Kayla Washburn 066b25f710 chore: remove Maybe (#9880) 2023-09-27 10:45:12 -06:00
Cian Johnston 72e8f88af3 feat(scaletest/terraform): add cert-manager, otel, and TLS (#9894) 2023-09-27 17:41:07 +01: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
Kyle Carberry de6d0b9a1a fix: only specify vscode proxy uri if app subdomains enabled (#9891)
Otherwise this generates an invalid URI that breaks code-server!
2023-09-27 15:13:47 +00:00
Marcin Tojek cb5f8df4c2 feat: expose application name via Appearance API (#9886) 2023-09-27 17:02:18 +02:00
Mathias Fredriksson 68738771b9 feat(scaletest): create automated pprof dumps during scaletest (#9887) 2023-09-27 15:58:43 +03:00
Cian Johnston fad02081fc fix: avoid logging env in unit tests (#9885) 2023-09-27 13:34:40 +01:00
Mathias Fredriksson d8515f02af feat(scaletest): add grafana annotations and slack reporting (#9852)
Fixes #9575
Fixes #9576
2023-09-27 11:44:11 +00:00
Mathias Fredriksson 4e442040f7 feat(coderd/httpmw): log start timestamp for http requests (#9776) 2023-09-27 14:39:22 +03:00
Spike Curtis c67db6efb0 fix: wait for bash prompt before commands (#9882)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-27 12:26:24 +04:00
Cian Johnston 399b428149 chore(scaletest): update scaletest terraform to match big.cdr.dev (#9860)
- Removes usage of null_resources as no longer required
- Updates terraform in both infra/ and k8s/ to match
- Updates provisionerd deployment to use helm chart
2023-09-27 09:02:35 +01:00
Kyle Carberry 726a4dadf2 feat: allow magic string to generate session token for external apps (#9878)
* fix: make non-http external app links open in the current window

* Allow magic string to be replaced with a session token for external apps

* Improve readibility
2023-09-26 16:04:24 -05:00
Kira Pilot 75366ec6b5 more renames (#9876) 2023-09-26 14:45:29 -04:00
Kayla Washburn 6f0e2a7968 refactor: poll for git auth updates when creating a workspace (#9804) 2023-09-26 11:39:07 -06:00
Marcin Tojek 4c3b579f58 feat: expose insights into user activity (#9807) 2023-09-26 18:42:16 +02:00
Cian Johnston 1f4335733c fix(coderd/workspaceapps/apptest): bump sleep in testReconnectingPTY to reduce test flakes (#9875) 2023-09-26 14:58:18 +01:00
Bruno Quaresma b0b9d32a2a chore(site): remove dead code (#9830) 2023-09-26 10:05:24 -03: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
Cian Johnston 96c5076c69 fix(coderd): remove troublesome test case (#9874) 2023-09-26 11:33:21 +01:00
Kyle Carberry c4718fd747 fix: remove pinned version for dogfood (#9872) 2023-09-26 02:23:42 +00:00
Muhammad Atif Ali 04c85c3833 chore: add icons (#9871) 2023-09-26 00:46:07 +00:00
Kyle Carberry f7c89082d2 chore: swap dogfood to use modules (#9870) 2023-09-25 19:41:45 -05:00
Kyle Carberry 442fb105c9 chore: add git svg icon (#9869) 2023-09-26 00:15:55 +00:00
Kyle Carberry 20bfe6e9e5 fix: allow expansion from log_path for coder_script (#9868) 2023-09-25 23:45:55 +00:00
Colin Adler 89292264be feat(coderd): add simple healthcheck formatting option (#9864) 2023-09-25 22:55:50 +00:00
Kyle Carberry 6e6b808143 fix: add case for logs without a source (#9866)
This is to support legacy logs!
2023-09-25 22:19:51 +00:00
Kyle Carberry d3220c5db9 fix: resolve flake in log sender by checking context (#9865)
See: https://github.com/coder/coder/actions/runs/6305051172/job/17117693579
2023-09-25 22:19:27 +00: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
Kayla Washburn dac1375880 feat: add &hellip; to actions that require confirmation (#9862) 2023-09-25 15:25:02 -06:00
Kayla Washburn ff3fc0971c feat: create a workspace from any template version (#9861) 2023-09-25 14:54:19 -06:00
Ammar Bandukwala 4adbf24a08 docs: fix typo (#9859) 2023-09-25 19:52:53 +00:00
Steven Masley b6c5e94ffa fix: consider all 'devel' builds as 'dev' builds (#9794)
* fix: all 'devel' builds should be considered 'dev' builds.

If CI needs to be distinguished from a dev build, we should add
a different pre-release tag for those builds.

* change CI version checking to be more strict
2023-09-25 13:59:49 -05:00
Kayla Washburn 47d3161b0b fix: give more room to lonely resource metadata items (#9832) 2023-09-25 09:40:51 -06:00
Michael Smith 3757005e82 feat: add middle click support for workspace rows (#9834)
* chore: add generic ref support for useClickable

* chore: update useClickable call sites to use type parameter

* chore: update useClickableTableRow implementation

* chore: update other components using useClickableTableRow

* feat: add middle-click and cmd-click support for rows

* refactor: rename variable for clarity

* docs: add comment for clarity

* chore: add more click logic and comments

* refactor: clean up useClickableTableRow

* docs: rewrite comments for clarity

* fix: update TimelineEntry to accept forwarded ref

* fix: fix keyboard event logic to respond to spaces properly
2023-09-25 11:32:33 -04:00
Marcin Tojek 415818035c test(site): e2e: use IPv4 address for web server (#9843) 2023-09-25 14:44:15 +02:00
Cian Johnston 4622ea2c10 chore: remove filebrowser.db (#9854)
* rm and gitignore filebrowser.db
2023-09-25 12:41:27 +00:00
Bruno Quaresma cb545bcc30 chore(site): move a few pages to lazy load (#9831) 2023-09-25 09:38:24 -03:00
Muhammad Atif Ali 63ea12e74c chore: remove terraform provider versions for pr-deployment template (#9853) 2023-09-25 12:33:01 +00:00
dependabot[bot] 7da3180036 chore: bump github.com/spf13/afero from 1.9.5 to 1.10.0 (#9850)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 15:32:21 +03:00
dependabot[bot] 9d5af5b483 chore: bump github.com/coder/terraform-provider-coder from 0.11.1 to 0.12.0 (#9849)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 15:23:19 +03:00
dependabot[bot] e649b7cefe chore: bump google.golang.org/api from 0.141.0 to 0.142.0 (#9848)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 15:22:54 +03:00
dependabot[bot] 5c1ee6990e chore: bump github.com/gohugoio/hugo from 0.118.2 to 0.119.0 (#9847)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 15:22:43 +03:00
dependabot[bot] 9358b3bd84 ci: bump the github-actions group with 2 updates (#9846)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 15:22:19 +03:00
Muhammad Atif Ali 26e0d7580c chore: avoid pushing .terraform.lock.hcl while creating the template (#9851) 2023-09-25 15:13:32 +03:00
Cian Johnston 382843dc5f chore(docs): add notice re enabling encryption (#9844) 2023-09-25 11:07:38 +01:00
Bruno Quaresma 85ab9c2d48 chore(site): replace agent log service (#9814) 2023-09-22 16:13:25 -03:00
Bruno Quaresma 7bb0061804 chore(site): remove workspace build machine (#9813) 2023-09-22 16:12:25 -03:00
Muhammad Atif Ali df0c597843 docs: update VS Code Web docs (#9811)
* docs: update VS Code Web docs

* add back folder
2023-09-22 18:49:20 +00:00
Colin Adler cc009fe121 ci: increase timeout for template build jobs (#9829) 2023-09-22 13:13:50 -05:00
Ammar Bandukwala 733171a93b revert: "ci: cache datadog-ci (#9702)" (#9828)
Original commit changeset: b104e0ec0c
2023-09-22 17:31:25 +00:00
Michael Smith c201fc2538 revert: remove localStorage sync for search params (#9827) 2023-09-22 12:43:08 -04:00
Bruno Quaresma f6ee08d100 chore(site): replace create user machine by react-query (#9810) 2023-09-22 13:28:56 -03:00
Jon Ayers 9216725698 chore: add alpha badges to workspace cleanup fields (#9802) 2023-09-22 10:41:17 -05:00
Cian Johnston 8d8402da00 fix(coderd/database): avoid clobbering workspace build state (#9826)
Fixes #9823.

- Decomposes UpdateWorkspaceBuildByID into UpdateWorkspaceBuildProvisionerStateByID and UpdateWorkspaceBuildDeadlineByID.
- Replaces existing invocations of UpdateWorkspaceBuildByID with the newer queries where applicable.
- Modifies GetActiveWorkspaceBuildsByTemplateID to not return incomplete workspace builds.
2023-09-22 16:22:07 +01:00
Cian Johnston a1f3a6b606 refactor(scaletest/terraform): break up infra creation and k8s resource provisioning (#9824)
Breaks up scaletest/terraform into {infra, k8s}.
2023-09-22 15:55:47 +01:00
Michael Smith 84999cb33d feat: add empty state for SSO auth methods (#9818)
* fix: remove needless undefined checks

* refactor: clean up button markup

* refactor: restrict access to full auth in oidc functions

* feat: add empty SSO state
2023-09-22 09:38:49 -04:00
Spike Curtis e9077f3bd2 fix: use AlwaysEnable for licenses with all features (#9808)
* fix: use AlwaysEnable for licenses with all features

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

* use dbtime.Now() intead of time.Now()

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-22 05:02:28 +00:00
Dean Sheather 94a0612cd2 chore: update tailscale (#9817) 2023-09-22 07:21:38 +10:00
Colin Adler c900b5f8df feat: add single tailnet support to pgcoord (#9351) 2023-09-21 14:30:48 -05:00
Colin Adler fbad06f406 chore: bump wgtunnel (#9805) 2023-09-21 13:33:13 -05:00
Michael Smith 91a04c0132 chore: enhance tests for TemplateSchedulePage (#9801)
* chore: Add benchmark logs to test

* chore: Remove benchmark logic

* chore: add hard cutoff for waitFor calls

* refactor: clean up waitFor cut-off logic

* chore: add assertion that submit button is not disabled

* chore: Remove disabled check at the start of the test

* fix: extend cutoff for waitFor config
2023-09-21 14:25:26 -04:00
Muhammad Atif Ali 201a6c0c79 chore: remove extra condition from pr-deploy.yaml (#9788) 2023-09-21 17:58:46 +03:00
Bruno Quaresma 801c6c994b chore(site): replace setup machine by react-query (#9809) 2023-09-21 11:21:49 -03: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
Michael Smith b742661abd feat: make workspace search bar remember text (#9759)
* minor: Add useEffectEvent polyfill

* chore: update filter to have better callback support

* docs: Clean up comments

* fix: add localStorage to useWorkspacesFilter

* refactor: Centralize stable useSearchParams

* refactor: clean up filter to be fully pure on mount

* chore: add tests for useEffectEvent

* wip: commit progress for searchbar fix

* chore: clean up WorkspacesPage

* fix: add logic for syncing queries with search params

* chore: Rename initialValue to fallbackFilter

* chore: Remove todo comment

* refactor: update code to use useEffectEvent

* docs: clean up comments for clarity

* fix: update url check to use regex
2023-09-20 16:44:19 -04:00
Bruno Quaresma 92a90eb9ae test(site): fix terminal page test flakiness (#9798) 2023-09-20 15:19:27 -03:00
Bruno Quaresma 1cd0bea86e chore: make workspace batch actions enabled by default (#9797) 2023-09-20 14:10:01 -03:00
Eric Paulsen fae8a470df fix(cli): display pasted session token (#9710) 2023-09-20 12:41:59 -04:00
Steven Masley f89b68056d chore: add debug information to wsproxy errors (#9683)
* chore: add debug information to wsproxy errors
* Use codersdk.ReadBodyAsError
2023-09-20 10:05:14 -05:00
Cian Johnston ae1896f2dc chore(docs): replace numbering with bullets in admin/encryption.md (#9792) 2023-09-20 15:15:39 +01:00
Marcin Tojek 8e012e4e1a test(site): workaround for reattached xterm-rows (#9790) 2023-09-20 14:25:30 +02:00
Steven Masley a18bf73131 chore: display warnings on app share failure (#9783)
* chore: add warnings to app share failure
Warnings only appear if the app is misconfigured to the deployment
2023-09-19 21:54:51 +00:00
Kayla Washburn 1fd1c654a9 fix: hide empty update message box (#9784) 2023-09-19 13:11:22 -06:00
Dean Sheather eda32659a8 chore: fix flake in tunnel (#9746) 2023-09-19 18:54:56 +00:00
Spike Curtis 70e481e7a5 fix: use terminal emulator that keeps state in ReconnectingPTY tests (#9765)
* Add more pty diagnostics for terminal parsing

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

* print escaped strings

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

* Only log on failure - heisenbug?

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

* use the terminal across matches to keep cursor & contents state

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

* Only log bytes if we're not expecting EOF

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-19 17:57:30 +00:00
Kayla Washburn 269b1c59f1 refactor: get rid of templateVariablesXService (#9763) 2023-09-19 11:54:14 -06:00
Mathias Fredriksson 530dd9d247 fix(coderd): subscribe to workspace when streaming agent logs to detect outdated build (#9729)
Fixes #9721
2023-09-19 20:02:27 +03:00
Bruno Quaresma 87d50f17a2 chore(site): refactor groups to use react-query (#9701) 2023-09-19 13:37:17 -03:00
Mathias Fredriksson 161a3cfa26 fix(coderd/batchstats): use debug log on query cancellation in flush (#9778)
Fixes #9772
2023-09-19 18:16:07 +03:00
Marcin Tojek ceb52ac24a fix: user should always belong to an organization (#9781) 2023-09-19 16:22:37 +02:00
Mathias Fredriksson d6089ae0ad fix(coderd/batchstats): use debug log on context cancellation in flush (#9777) 2023-09-19 13:19:39 +00:00
Bruno Quaresma 7bc98c296b refactor(site): do not display error details as message (#9755) 2023-09-19 09:54:59 -03:00
Bruno Quaresma e26bb2d91b chore(site): rollback remark-gfm version (#9774) 2023-09-19 09:43:11 -03:00
Bruno Quaresma ffa77ba6ff feat(site): show CLI flags and env variables for the options (#9757) 2023-09-19 09:34:04 -03:00
Dr. Pi3cH 94cccd0a01 fix: make sure fly_app name is lower case (#9771)
fly_app does not support uppercase. Coder allows uppercase for username/owner.
2023-09-19 12:30:52 +00:00
Eric Paulsen e9c183d0dc feat: add envFrom value to Helm chart (#9587)
* feat: add envFrom value to Helm chart

* add envUseClusterAccessURL

* add tests

---------

Co-authored-by: Dean Sheather <dean@deansheather.com>
2023-09-19 16:03:13 +04:00
Marcin Tojek ceeb9987a5 test(cli): ensure first option selected with is expected (#9770) 2023-09-19 13:55:51 +02:00
Marcin Tojek b0e3daa120 feat(coderd): support weekly aggregated insights (#9684) 2023-09-19 13:06:19 +02:00
Muhammad Atif Ali b358e3d558 chore: fix permission for kubeconfig (#9768) 2023-09-19 08:36:00 +00: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
dependabot[bot] 6cf531bfef chore: bump typescript from 5.1.6 to 5.2.2 in /site (#9743)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-19 08:32:14 +03:00
dependabot[bot] 8fe4401e23 chore: bump github.com/klauspost/compress from 1.16.5 to 1.17.0 (#9735)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-19 05:30:04 +00:00
Cian Johnston aa8652c928 fix(dbtestutil): avoid truncating inserts that span multiple lines (#9756) 2023-09-18 19:46:22 +00:00
Kayla Washburn ed25f1449d refactor: use a line graph for DAUChart (#9758) 2023-09-18 12:28:30 -06:00
Kayla Washburn f85aa443dd feat: show version messages in version lists (#9708) 2023-09-18 11:17:07 -06:00
Jon Ayers 622442203d chore: fix test flake in TestProvisionerd (#9709) 2023-09-18 11:23:22 -05: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
Asher 17f9991118 fix: reconnect terminal on non-modified key presses (#9686)
* Listen to web terminal keydown on capture

Instead of bubbling.  I think maybe what happens here is that xterm is
capturing key presses and preventing the event from bubbling?  So
setting the listener on the capture phase instead works around this.
Probably would also work to dipsose the terminal.

* Prevent issuing terminal reload when already reloading

I am not sure this actually causes any issues, but might as well.

* Ignore modifier keys for reconnecting terminal
2023-09-18 07:24:01 -08:00
Michael Smith 2caf7a7ceb fix: remove just-debounce-it (#9707)
* fix: Switch UserAutocomplete to useDebouncedFunction

* fix: switch UserOrGroupAutocomplete to useDebouncedFunction

* chore: remove just-debounce-it dependency

* docs: Clean up comments
2023-09-18 14:20:11 +00:00
Bruno Quaresma a2aff1f527 chore(site): replace xstate by react-query on update password (#9696) 2023-09-18 11:03:35 -03:00
Bruno Quaresma e74d8a7b21 chore(site): refactor starter templates to use react-query (#9697)
* Remove starter templates service

* Remove starter template service

* Remove template x service
2023-09-18 11:02:55 -03:00
dependabot[bot] e1bd6ddc25 chore: bump the otel group with 3 updates (#9731)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:55:38 +03:00
dependabot[bot] a989e8363b chore: bump google.golang.org/api from 0.140.0 to 0.141.0 (#9732)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:54:32 +03:00
dependabot[bot] 24bff1098d chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.54.0 to 1.55.0 (#9734)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:53:40 +03:00
dependabot[bot] 1d8a4ed201 chore: bump jest-location-mock from 1.0.9 to 2.0.0 in /site (#9727)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 13:46:08 +00:00
Bruno Quaresma 2319486806 chore(site): replace deployment stats service by react-query (#9698) 2023-09-18 10:44:52 -03:00
dependabot[bot] 5a22f08f3f chore: bump @tanstack/react-query from 4.33.0 to 4.35.3 in /site (#9738)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:34:56 +03:00
dependabot[bot] d326f1b10c chore: bump remark-gfm from 3.0.1 to 4.0.0 in /site (#9726)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:32:57 +03:00
dependabot[bot] 972425e3d4 chore: bump @playwright/test from 1.37.1 to 1.38.0 in /site (#9739)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:32:42 +03:00
dependabot[bot] b76a430d22 chore: bump github.com/valyala/fasthttp from 1.49.0 to 1.50.0 (#9736)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:31:54 +03:00
dependabot[bot] ea93b4bbe4 chore: bump react-icons from 4.10.1 to 4.11.0 in /offlinedocs (#9740)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:31:48 +03:00
dependabot[bot] bd3f2f8c10 chore: bump eslint from 8.48.0 to 8.49.0 in /offlinedocs (#9742)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:31:16 +03:00
dependabot[bot] 010a13c654 chore: bump @testing-library/user-event from 14.4.3 to 14.5.1 in /site (#9730)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:24:05 +03:00
dependabot[bot] 9c8140270a chore: bump the react group in /site with 1 update (#9723)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 16:23:35 +03:00
dependabot[bot] c58e5bf09a chore: bump the eslint group in /site with 1 update (#9725)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 11:41:20 +00:00
Muhammad Atif Ali 3ed65de82e chore: increase dependabot open pr limit for site (#9728) 2023-09-18 11:24:49 +00:00
dependabot[bot] eb72866a29 ci: bump the github-actions group with 2 updates (#9722)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 11:15:56 +00:00
Cian Johnston 1df7589105 feat(coderd/database/dbtestutil): add ability to dump database on failure (#9704)
Adds dbtestutil.DumpOnFailure() to allow dumping the entire test database contents upon test failure.
This does nothing for dbfake currently.
2023-09-18 11:50:15 +01:00
Muhammad Atif Ali e6865e0df5 ci: remove example templates readme from docs filter (#9720) 2023-09-18 10:38:57 +00:00
Cian Johnston 9bcff30dee fix(coderd/database): migrate workspaces.last_used_at to timestamptz (#9699) 2023-09-18 11:07:54 +01:00
Cian Johnston 1f5eb088b5 fix(examples): fix typo in examples.gen.json (#9718) 2023-09-18 09:09:30 +00:00
Cian Johnston 653488e8ee fix(coderd): emit CollectedAt as UTC in convertWorkspaceAgentMetadata (#9700) 2023-09-18 09:17:18 +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
sharkymark b2f84668c8 docs: document display_apps feature to hide/show built-in coder_app resources (#9714)
* docs: display_apps feature to hide/show terminal, vscode desktop, port-forwarding, etc.

* Update docs/templates/index.md

Co-authored-by: Muhammad Atif Ali <atif@coder.com>

* Update docs/templates/index.md

Co-authored-by: Muhammad Atif Ali <atif@coder.com>

---------

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-09-17 15:13:56 +00:00
kpoxo6op ab08b2c3e4 fix typo in README.md (#9715)
typo
2023-09-17 07:07:13 -05:00
Michael Smith fcc8b9ec92 fix: prevent workspace search bar text from getting garbled (#9703)
* chore: Reorganize hook calls for useWorkspacesFilter

* refactor: Clean up some filter logic

* refactor: Create debounce utility hooks

* docs: Clean up comments for clarity

* fix: Update focus logic to apply for any inner focus

* fix: Add onBlur behavior for state syncs

* chore: Add progress for debounce test

* chore: Finish tests for debounce hooks

* docs: Add file description and warning
2023-09-15 15:55:59 -04:00
Ammar Bandukwala b104e0ec0c ci: cache datadog-ci (#9702) 2023-09-15 19:22:38 +00:00
Kayla Washburn 9e053ce220 feat: show update messages on workspace page (#9705) 2023-09-15 13:09:29 -06:00
Kayla Washburn efe804498b feat: add quiet hours settings page (#9676) 2023-09-15 11:14:33 -06:00
Cian Johnston 72dff7f188 fix(enterprise/dbcrypt): do not skip deleted users when encrypting or deleting (#9694)
- Broadens scope of data generation in TestServerDBCrypt over all user login types, statuses, and deletion status.
- Adds support for specifying user status / user deletion status in dbgen
- Adds more comprehensive logging in TestServerDBCrypt upon test failure (to be generalized and expanded upon in a follow-up)
- Adds AllUserIDs query, updates dbcrypt to use this instead of GetUsers.
2023-09-15 15:09:40 +01:00
Mathias Fredriksson bc97eaa41b feat(scaletest): add scaletest-runner template (#9662)
Closes #9571
2023-09-15 13:23:37 +00:00
Marcin Tojek d0d64bbdca refactor: define insights interval (#9693) 2023-09-15 12:01:00 +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 281faf9ccd ci: upgrade runners (#9689)
Per DataDog, I've doubled the resources of our slowest jobs.
2023-09-14 20:20:39 -05: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
Bruno Quaresma 79d4179123 chore(site): migrate a few services to react-query used in the DashboardProvider (#9667) 2023-09-14 19:35:03 -03:00
Bruno Quaresma 3b088a5cb8 chore(site): refactor deployment values service to react-query (#9669) 2023-09-14 18:49:23 -03:00
Marcin Tojek 225cf8acec chore: print page content on failed promise (#9681) 2023-09-14 13:30:46 +02:00
Marcin Tojek dcad0a437c fix: wait for build job (#9680) 2023-09-14 11:20:09 +02:00
Cian Johnston 8b6e2862fd refactor(coderd): collapse activityBumpWorkspace into a single query (#9652)
* Adds unit-style tests for activityBumpWorkspace
* Ports logic of activityBumpWorkspace to a SQL query
* Updates activityBumpWorkspace to call above query
2023-09-14 09:09:51 +01:00
Colin Adler 38560dd922 chore: remove coder trace telemetry (#9677) 2023-09-14 02:20:28 -04:00
Bruno Quaresma e7b0181519 feat(site): add support to .sh and .tpl files (#9674) 2023-09-13 16:27:02 -03:00
Steven Masley e0e6d7c9a6 fix: case insensitve agent ssh session env var (#9675) 2023-09-13 14:18:00 -05:00
Steven Masley 0e4d6896e3 test: fix cleanup order on provisioner daemon work dir (#9668)
* test: fix cleanup order on provisioner daemon work dir

* Reduce the test race condition
2023-09-13 13:13:08 -05:00
Kayla Washburn 53a985ff11 refactor: clean up workspace and template settings (#9654) 2023-09-13 11:55:27 -06:00
dependabot[bot] 6c409b8872 chore: bump chromatic from 6.24.1 to 7.1.0 in /site (#9629)
Bumps [chromatic](https://github.com/chromaui/chromatic-cli) from 6.24.1 to 7.1.0.
- [Changelog](https://github.com/chromaui/chromatic-cli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chromaui/chromatic-cli/compare/v6.24.1...v7.1.0)

---
updated-dependencies:
- dependency-name: chromatic
  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>
2023-09-13 14:49:54 -03:00
Jon Ayers 3dc1e22d56 feat: add template_id and template_name to workspace data source (#9655) 2023-09-13 11:09:08 -05:00
Marcin Tojek d171b3611b fix: flaky: TestDeleteTemplate/NoWorkspaces (#9666) 2023-09-13 17:05:08 +02:00
Cian Johnston 3be783b319 fix(scaletest/workspacetraffic): wait for non-zero metrics before cancelling in TestRun (#9663) 2023-09-13 15:54:56 +01:00
Muhammad Atif Ali 254f459d69 chore(dogfood): add a coder_app for JetBrains gateway IDEs (#9644) 2023-09-13 17:49:36 +03:00
Marcin Tojek a229855e71 test(site): e2e: improve webTerminal test (#9659) 2023-09-13 16:18:10 +02:00
Spike Curtis 4ebf490d97 feat: add Acquirer to provisionerdserver pkg (#9658)
* 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>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-13 16:36:43 +04:00
Cian Johnston 2ac532982d feat(coderd/database): generate foreign key constraints and add database.IsForeignKeyViolation (#9657)
* feat(coderd/database): generate foreign key constraints, add database.IsForeignKeyViolation

* address PR comments
2023-09-13 13:28:46 +01:00
Cian Johnston a6f7f71808 chore(docs/admin): update encryption.md (#9660) 2023-09-13 12:56:20 +01:00
Marcin Tojek e2579e9440 test: fix flaky TestPatchTemplateMeta/Modified (#9656) 2023-09-13 11:34:53 +02:00
Steven Masley 18c34ee456 chore: support external types in typescript codegen (#9633)
* chore: support external types in typescript codegen
* fix enums on external packages
* Support clibase.struct
* Add regexp
* Make gen with updated generator
2023-09-12 18:21:09 -05:00
Bruno Quaresma 641bf272ed fix(site): fix renderer error (#9653) 2023-09-12 19:59:09 -03:00
Kayla Washburn 0726eb56bb fix: update autostart/autostop text (#9650) 2023-09-12 15:29:39 -06:00
Bruno Quaresma b3c98395ab chore(site): use react-query to fetch roles (#9630) 2023-09-12 15:07:56 -03:00
Bruno Quaresma b33cb0ef97 chore(site): refactor workspace quota to use react-query instead of XState (#9626) 2023-09-12 14:58:35 -03:00
Julio 64bc317cd4 Doc - Remove sysbox 16 pods max. (#9646) 2023-09-12 17:49:51 +00:00
Bruno Quaresma 5ca8c4287f chore(site): move ssh keys management to react-query (#9625) 2023-09-12 14:40:07 -03:00
Bruno Quaresma 6db89b0372 chore(site): move templates fetching to react-query (#9622) 2023-09-12 14:09:16 -03:00
Bruno Quaresma b7550bfda5 chore(site): remove unecessary types and move types to where they are used (#9621) 2023-09-12 13:54:05 -03:00
Marcin Tojek 0e28397c82 fix: use CRC32 to shorten app subdomain (#9645) 2023-09-12 17:11:45 +02:00
Marcin Tojek 898971b329 refactor: generate application URL on backend side (#9618) 2023-09-12 15:25:10 +02:00
dependabot[bot] 228d1cf361 chore: bump the eslint group in /site with 3 updates (#9639)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 10:25:04 +00:00
dependabot[bot] 531e1334af chore: bump monaco-editor from 0.41.0 to 0.43.0 in /site (#9642)
Bumps [monaco-editor](https://github.com/microsoft/monaco-editor) from 0.41.0 to 0.43.0.
- [Changelog](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/monaco-editor/compare/v0.41.0...v0.43.0)

---
updated-dependencies:
- dependency-name: monaco-editor
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 12:56:43 +03:00
dependabot[bot] 7f126758a5 chore: bump jest-websocket-mock from 2.4.0 to 2.5.0 in /site (#9641)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 09:24:10 +00:00
dependabot[bot] d49bc2003b chore: bump msw from 1.2.2 to 1.3.0 in /site (#9640)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 12:16:16 +03:00
dependabot[bot] 8b08a78168 chore: bump google.golang.org/api from 0.138.0 to 0.140.0 (#9636)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 08:45:29 +00:00
Muhammad Atif Ali f1f522a9a7 revert: "chore: bump the eslint group in /site with 3 updates" (#9638) 2023-09-12 11:26:51 +03:00
dependabot[bot] 2c19995712 ci: bump the github-actions group with 2 updates (#9620)
Bumps the github-actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [crate-ci/typos](https://github.com/crate-ci/typos).


Updates `actions/checkout` from 3 to 4
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

Updates `crate-ci/typos` from 1.16.10 to 1.16.11
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.16.10...v1.16.11)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 10:22:22 +03:00
dependabot[bot] e85981713d chore: bump the xterm group in /site with 6 updates (#9627)
Bumps the xterm group in /site with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [xterm](https://github.com/xtermjs/xterm.js) | `5.2.1` | `5.3.0` |
| [xterm-addon-canvas](https://github.com/xtermjs/xterm.js) | `0.4.0` | `0.5.0` |
| [xterm-addon-fit](https://github.com/xtermjs/xterm.js) | `0.7.0` | `0.8.0` |
| [xterm-addon-unicode11](https://github.com/xtermjs/xterm.js) | `0.5.0` | `0.6.0` |
| [xterm-addon-web-links](https://github.com/xtermjs/xterm.js) | `0.8.0` | `0.9.0` |
| [xterm-addon-webgl](https://github.com/xtermjs/xterm.js) | `0.15.0` | `0.16.0` |


Updates `xterm` from 5.2.1 to 5.3.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/5.2.1...5.3.0)

Updates `xterm-addon-canvas` from 0.4.0 to 0.5.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/0.4...0.5)

Updates `xterm-addon-fit` from 0.7.0 to 0.8.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/0.7...0.8)

Updates `xterm-addon-unicode11` from 0.5.0 to 0.6.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/0.5...0.6)

Updates `xterm-addon-web-links` from 0.8.0 to 0.9.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/0.8...0.9)

Updates `xterm-addon-webgl` from 0.15.0 to 0.16.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/0.15...0.16)

---
updated-dependencies:
- dependency-name: xterm
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: xterm
- dependency-name: xterm-addon-canvas
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: xterm
- dependency-name: xterm-addon-fit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: xterm
- dependency-name: xterm-addon-unicode11
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: xterm
- dependency-name: xterm-addon-web-links
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: xterm
- dependency-name: xterm-addon-webgl
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: xterm
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 10:21:59 +03:00
dependabot[bot] 140a7d2de2 chore: bump the eslint group in /site with 3 updates (#9628)
Bumps the eslint group in /site with 3 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [eslint](https://github.com/eslint/eslint).


Updates `@typescript-eslint/eslint-plugin` from 6.5.0 to 6.7.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.5.0 to 6.7.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.0/packages/parser)

Updates `eslint` from 8.48.0 to 8.49.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.48.0...v8.49.0)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 10:21:47 +03:00
dependabot[bot] 3e0969004d chore: bump ts-proto from 1.156.0 to 1.157.0 in /site (#9631)
Bumps [ts-proto](https://github.com/stephenh/ts-proto) from 1.156.0 to 1.157.0.
- [Release notes](https://github.com/stephenh/ts-proto/releases)
- [Changelog](https://github.com/stephenh/ts-proto/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stephenh/ts-proto/compare/v1.156.0...v1.157.0)

---
updated-dependencies:
- dependency-name: ts-proto
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 10:21:09 +03:00
dependabot[bot] abbd780373 chore: bump cronstrue from 2.31.0 to 2.32.0 in /site (#9632)
Bumps [cronstrue](https://github.com/bradymholt/cronstrue) from 2.31.0 to 2.32.0.
- [Release notes](https://github.com/bradymholt/cronstrue/releases)
- [Changelog](https://github.com/bradymholt/cRonstrue/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bradymholt/cronstrue/compare/v2.31.0...v2.32.0)

---
updated-dependencies:
- dependency-name: cronstrue
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 10:20:54 +03:00
dependabot[bot] d4bdb96883 chore: bump google.golang.org/grpc from 1.57.0 to 1.58.0 (#9563)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.57.0 to 1.58.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.57.0...v1.58.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 10:18:21 +03:00
Kayla Washburn 13acf5976c chore: remove i18next (#9608) 2023-09-11 11:17:58 -06:00
Marcin Tojek 1a1c230534 fix(docs): skip >> character (#9616) 2023-09-11 12:23:40 +02:00
Marcin Tojek 67fe3ae8d6 feat: clean stale provisioner files (#9545) 2023-09-11 07:37:14 +00:00
sharkymark d055f93706 Docs coder apps web ides (#9613)
* chore: document external URLs, refresh web IDE images

* chore: coder_app external URL, updated images, file browser

* Update docs/ides/web-ides.md

---------

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-09-10 20:26:59 +00:00
Muhammad Atif Ali 84ede326e8 docs: add VS Code Web to web-ides (#9591) 2023-09-10 02:32:41 +00: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
Bruno Quaresma 11404af9ca chore(site): update files to use a more standard naming (#9605) 2023-09-08 15:14:41 -03:00
Bruno Quaresma 554ddb11cd chore(site): refactor stories and test from page components (#9603)
* Refactor AuditPage

* Refactor CliAuthPageView stories

* Refactor CreateTemplateForm stories

* Refactor CreateUserPage test

* Refactor CreateWorkspacePage tests

* Fix stories name

* Refactor AppereancePageView stories

* Refactor GitAuthSettingsPageView stories

* Refactor NetworkSettingsPageView stories

* Refactor SecuritySettingsPageView stories

* Refactor UserAuthSettingsPageView stories

* Refactor GroupsPage stories

* Refactor LoginPage tests

* Refactor SetupPage stories

* Refactor StarterTemplatePageView stories

* Refactor StarterTemplatesPage tests

* Refactor TemplatePage tests

* RefactorTemplateSettingsPage tests

* Refactor TemplatesPage tests

* Flat TemplateVersionEditorPage

* Refactor TemplateVersionPage stories

* Refactor UserSettingsPage stories

* Refactor UsersPage stories

* Simplify IndexPage

* Refactor WorkspaceSettingsPage stories

* Refactor WorkspacePage stories

* Refactor Conditionals stories

* Fix typo

* Fix imports

* Fix ChooseOne story

* Fix UserAuthSettingsPageView stories
2023-09-08 15:14:13 -03:00
David Morcillo 9e5a59e222 Update upgrade.md (#9569)
Fix wrong docker-compose update instructions.
2023-09-08 10:38:35 -04:00
Marcin Tojek ad23075e1b refactor: build application URL (#9601)
* refactor: build application URL

* fix
2023-09-08 14:01:57 +00:00
Cian Johnston 392b11272b fixup! fix(scripts): modify logic for determining terraform arch (#9595) (#9596) 2023-09-08 11:07:57 +00:00
Cian Johnston a3a16a1586 fix(scripts): modify logic for determining terraform arch (#9595)
Commit fb3616c used a build-arg to set the desired terrafomr
architeture to fetch. This is set in build_docker.sh but not
when building using depot.dev. Baking the logic into the
Dockerfile instead.
2023-09-08 10:47:51 +00:00
Spike Curtis 8d7eb1728c fix: stop inserting provisioner daemons into the database (#9108)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-09-08 10:37:36 +00:00
Cian Johnston fb3616c37e fix(scripts): wget terraform directly from releases.hashicorp.com (#9594) 2023-09-08 10:02:18 +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
Kayla Washburn 8b51a2f3c5 docs: mention the need for permission to read email addresses (#9588) 2023-09-07 16:40:22 -06: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
Kayla Washburn 8421f56137 refactor: bring back updated install.sh with patches (#9583) 2023-09-07 21:17:16 +00:00
Eric Paulsen ccda1c5c7d fix: rm tf provider versions in examples/ (#9586) 2023-09-07 18:53:23 +00:00
Cian Johnston 0306631518 fix(docs): fix broken link (#9585) 2023-09-07 18:36:26 +00:00
Bruno Quaresma 869d040cc6 chore(site): refactor stories and tests from components directory (#9578)
* Refactor Alert

* Refactor Avatar and its stories

* Refactor AvatarData and its stories

* Refactor CodeExample and its tests

* Refactor ServiceBanner stories

* Refactor Navbar and its tests

* Refactor ServiceBanner stories

* Refactor LicenseBannerView stories

* Refactor DeploymentBannerView stories

* Extract optionValue into a module

* Refactor DeleteDialog stories

* Refactor ConfirmDialog tests

* Refactor EmptyState tests

* Flat ErrorBoundaryState and refactor stories

* Refactor Expander stories

* Refactor FormFooter stories

* Refactor FullPageForm stories

* Refactor EnterpriseSnackbar stories

* Refactor GroupAvatar stories

* Refactor HelpTooltip stories and remove index

* Remove unecessary types module from IconField

* Refactor LoadingButton stories

* Refactor Margins stories

* Refactor Markdown stories

* Refactor PageHeader stories

* Refactor PageButton tests

* Refactor Pill stories

* Refactor Resources stories

* Refactor RichParameterInput stories and flat MultiTextField

* Remove unecessary Stack story

* Refactor TableRowMenu stories

* Refactor TemplateLayout stories

* Refactor Typography props

* Refactor UserAutocomplete

* Refactor WorkspaceBuildLogs components and tests

* Refactor WorkspaceStatusBadge stories

* Fix wrong imports

* Remove Example.args pattern

* Fix wrong import

* Refactor EmptyState stories

* Refactor HelpTooltip stories

* Remove not valid ErrorAlert story

* Fix AvatarData story

* Add border back to CodeExample

* Fix Navbar story

* Fix AgentRow proxy in the stories
2023-09-07 18:38:28 +02:00
Kayla Washburn 4f142fa959 feat: add minimal frontend for creating workspaces from specific template versions (#9475) 2023-09-07 10:33:42 -06:00
Mathias Fredriksson 40fcabfa0e chore(go.mod): update github.com/hashicorp/terraform-json to main (#9582) 2023-09-07 16:06:28 +00: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
Mathias Fredriksson ed7f682fd1 chore(go.mod): update github.com/hashicorp/terraform-json to v0.17.1 (#9570) 2023-09-07 14:55:39 +03:00
dependabot[bot] 5a6f6e5679 chore: bump the golang-x group with 4 updates (#9562)
Bumps the golang-x group with 4 updates: [golang.org/x/crypto](https://github.com/golang/crypto), [golang.org/x/net](https://github.com/golang/net), [golang.org/x/oauth2](https://github.com/golang/oauth2) and [golang.org/x/tools](https://github.com/golang/tools).


Updates `golang.org/x/crypto` from 0.12.0 to 0.13.0
- [Commits](https://github.com/golang/crypto/compare/v0.12.0...v0.13.0)

Updates `golang.org/x/net` from 0.14.0 to 0.15.0
- [Commits](https://github.com/golang/net/compare/v0.14.0...v0.15.0)

Updates `golang.org/x/oauth2` from 0.11.0 to 0.12.0
- [Commits](https://github.com/golang/oauth2/compare/v0.11.0...v0.12.0)

Updates `golang.org/x/tools` from 0.12.0 to 0.13.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.12.0...v0.13.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-x
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-x
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-x
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-x
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-07 08:26:40 +00:00
Kayla Washburn fd565e0e0b chore: enable test-2e (#9567) 2023-09-07 05:49:40 +00:00
Kayla Washburn bfff88d2d3 revert: improve flag interpretation for install.sh (#9566) 2023-09-07 05:29:52 +00:00
Muhammad Atif Ali 2dae60038a fix(docs): fix manifest of gcp docs (#9559) 2023-09-06 22:21:00 +03:00
Kayla Washburn fd8a86808f chore: add #9555 to .git-blame-ignore-revs (#9557) 2023-09-06 13:10:58 -06:00
Kayla Washburn 988c9af015 chore: format code with semicolons when using prettier (#9555) 2023-09-06 12:59:26 -06:00
Muhammad Atif Ali bef38b8413 docs: update google-cloud-platform docs to use our marketplace image (#9549) 2023-09-06 21:58:14 +03:00
Kayla Washburn 4ed8dd0d6c refactor: improve flag interpretation for install.sh (#9554) 2023-09-06 12:57:28 -06:00
Bruno Quaresma b15bfa41c2 chore(site): move components close to where they are used (#9552)
* Move AppLink

* Move AuditLogRow

* Move UserDropdown

* Move BuildsTable

* Remove CodeBlock

* Move CreateUserForm

* Move DeploymentBanner

* Move ResetPassworDialog

* Move EditRolesButton

* Move EnterpriseSnackbar

* Move GitAuth

* Move LicenseBanner

* Move Logs

* Move MultiTextField

* Move Navbar

* Remove PasswordField

* Move RuntimeErrorState

* Remove Section

* Move SectionAction

* Move ServiceBanner

* Move SettingsAccountForm

* Move LicenseCard

* Move SettingsSecurityForm

* Move SignInForm

* Remove TabPanel and TabSidebar

* Move TemplateStats and TemplateVariableField

* Move TemplateEditor

* Move TerminalLink

* Move SSH Button

* Move many tooltips

* Move UsersTable

* Move VersionsTable

* Move VSCodeDesktopButton

* Remove WarningAlert

* Move Workspace

* Move WorkspaceActions

* Move WorkspaceBuildProgress

* Move WorkspaceDeletedBanner

* Move WorkspaceScheduleForm

* Move WorkspaceSection

* Move WorkspaceStats

* Fix imports

* Flat CreateUserForm

* Flat GitAuth

* Transform WorkspaceSection into ChartSection

* Flat AccountForm

* Flat ConfirmDeleteDialog

* Flat ResetPasswordDialog

* Flat BuildsTable
2023-09-06 18:06:08 +00:00
Kayla Washburn 75139d1d06 refactor(site): update versions table design (#9540) 2023-09-06 08:31:07 -06:00
Ben Potter 1bcc4152af chore: avoid formatting changelogs (#9548) 2023-09-06 14:26:50 +00:00
Eric Paulsen 4ec2fea66b docs: fix psk secret cmd (#9524) 2023-09-06 09:04:44 -04:00
Cian Johnston 7918e65510 feat(coderd): add dbcrypt package (#9522)
- Adds package enterprise/dbcrypt to implement database encryption/decryption
- Adds table dbcrypt_keys and associated queries
- Adds columns oauth_access_token_key_id and oauth_refresh_token_key_id
  to tables git_auth_links and user_links

Co-authored-by: Kyle Carberry <kyle@coder.com>
2023-09-06 12:06:26 +01:00
Spike Curtis 3bd0fd396c feat: add boringcrypto builds for linux (#9543)
This reverts commit da0ef92f77.
2023-09-06 12:48:27 +04:00
Kayla Washburn 2849895832 fix: use $coder_version instead of hardcoded version in release script (#9539) 2023-09-05 17:30:54 -06:00
Ben Potter 66019ef70a docs: add v2.1.6 changelog (#9538) 2023-09-05 21:44:12 +00:00
Alexis Emerson d85c354507 docs: add CODER_TLS_ADDRESS to documentation for TLS setup (#9503)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-09-05 19:07:56 +00:00
Steven Masley 630d125286 chore: fix typo in OpenID on cli help (#9535) 2023-09-05 18:37:21 +00:00
Muhammad Atif Ali 2487e64d25 fix(docs): fix broken markdown links (#9534) 2023-09-05 18:12:04 +00:00
Kyle Carberry 82e238b0c6 chore: exclude generated files from vscode search by default (#9530)
Anyone can feel free to revert some of these, but they were constantly
annoying when searching for symbols in our code.
2023-09-05 15:05:46 +00:00
Steven Masley 58f7071569 fix: make 'NoRefresh' honor unlimited tokens in gitauth (#9472)
* chore: fix NoRefresh to honor unlimited tokens
* improve testing coverage of gitauth
* refactor rest of gitauth tests
2023-09-05 09:08:04 -05: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
dependabot[bot] ce08c47b8a chore: bump github.com/gohugoio/hugo from 0.117.0 to 0.118.2 (#9516)
Bumps [github.com/gohugoio/hugo](https://github.com/gohugoio/hugo) from 0.117.0 to 0.118.2.
- [Release notes](https://github.com/gohugoio/hugo/releases)
- [Changelog](https://github.com/gohugoio/hugo/blob/master/hugoreleaser.toml)
- [Commits](https://github.com/gohugoio/hugo/compare/v0.117.0...v0.118.2)

---
updated-dependencies:
- dependency-name: github.com/gohugoio/hugo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 11:52:26 +03:00
Mathias Fredriksson 76ab22f539 chore(coderd/database): introduce compile-time guard against import in slim build (#9521)
This change introduces a compile-time error when `coderd/database` is
imported into the slim build. This is to guard against accidentally
growing the binary size via import.

Ref: #9380
2023-09-04 19:01:11 +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 a1025f92af refactor(examples): pre-parse frontmatter via scripts/examplegen (#9514)
* refactor(examples): pre-parse frontmatter via scripts/examplegen

This removes 2 MB from the slim binary.

Ref: #9380
2023-09-04 20:15:29 +03:00
Mathias Fredriksson 6fc1f5276d refactor(coderd/httpapi): remove database, dbauthz and rbac imports (#9481)
Ref: #9380
2023-09-04 19:39:14 +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
dependabot[bot] c31292abe8 ci: bump the github-actions group with 2 updates (#9509)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 16:29:56 +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
Marcin Tojek aa94d89f97 test: improve E2E framework (#9469) 2023-09-04 14:46:48 +02:00
dependabot[bot] 91cb9c65f9 chore: bump github.com/hashicorp/hc-install from 0.5.2 to 0.6.0 (#9511)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 15:29:10 +03:00
dependabot[bot] c2be893b7f chore: bump github.com/open-policy-agent/opa from 0.55.0 to 0.56.0 (#9512)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 15:28:51 +03:00
dependabot[bot] c5714f2b47 chore: bump github.com/swaggo/swag from 1.8.6 to 1.16.2 (#9513)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 15:28:39 +03:00
dependabot[bot] cb5347bb12 chore: bump the golang-x group with 3 updates (#9510)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 15:27:03 +03:00
Bruno Quaresma b9f604c58d fix(site): fix workspace parameters update when having immutable parameters (#9500) 2023-09-03 21:56:25 -03:00
Ben Potter f5829d2be6 chore(dogfood): authenticate to coder CLI if unauthenticated (#9487) 2023-09-04 02:26:48 +03:00
Kyle Carberry 05439d2c1b fix: generate username with uuid to prevent collision (#9496)
See https://github.com/coder/coder/actions/runs/6052801777/job/16426982174
2023-09-03 18:02:28 +00:00
sharkymark 43ebf667f0 docs: explain why coder port-forward is more performant than dashboard and sshd (#9494) 2023-09-03 10:10:48 -05:00
Mathias Fredriksson 18c9f33dec chore: use tailscale extra small buildflags (#9490)
Ref: #9380
2023-09-01 19:14:56 +00:00
Mathias Fredriksson 27ab0d9a84 refactor(enterprise/cli): remove provisionerd from slim binary (#9488)
This change saves 8 MB in the slim binary.

Ref: #9380
2023-09-01 18:26:44 +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 d8718c3818 chore: add ts_omit_aws tag to remove aws dependency pulled in by tailscale (#9486)
On Linux, this saves us 7 MB.

Ref: #9380
2023-09-01 18:37:49 +03: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 5d7a77911e fix: use getProvisionerJobByIDNoLock (#9484) 2023-09-01 13:21:18 +00:00
Cian Johnston bc9fdd15f2 fix(enterprise/cli): correctly set default tags for PSK auth (#9436)
* provisionerd: unconditionally set tag scope to org for psk auth
* provisionerd: add unit tests for MutateTags
* cli: add some informational logging around provisionerd tags
* cli: respect CODER_VERBOSE when initializing logger
2023-09-01 10:37:09 +01:00
Colin Adler 8ee6178c66 chore(tailnet): fix MultiAgentConn mockgen (#9476) 2023-08-31 22:37:05 +00:00
Kayla Washburn eded7a4b88 feat: create a workspace from any template version (#9471) 2023-08-31 15:07:58 -06:00
Colin Adler 796a9754a9 feat(enterprise/audit): add user object to slog exporter (#9456) 2023-08-31 13:32:28 -05:00
Marcin Tojek 11d4b6f758 chore: move dormancy to enterprise package (#9468) 2023-08-31 17:59:53 +02:00
Marcin Tojek 7c4ce62a58 test(site): print agent logs (#9464) 2023-08-31 14:44:44 +02:00
Cian Johnston 22f31e721c fix(coderd/prometheusmetrics): close batcher to force flush before asserting agent stats (#9465) 2023-08-31 11:40:57 +01:00
Cian Johnston fd17857095 fix(cli): template pull tests: await template version job before exiting (#9430) 2023-08-31 11:40:24 +01:00
Spike Curtis ed50acaabf fix: don't log error on context cancel (#9463)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-31 12:08:18 +04:00
Muhammad Atif Ali 73976dd076 fix: fix aws_linux template (#9349) 2023-08-31 04:24:10 +03:00
dependabot[bot] 2aa66ad7c3 chore: bump monaco-editor from 0.40.0 to 0.41.0 in /site (#9458)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 02:23:32 +03:00
dependabot[bot] 723bba98ff chore: bump jest-canvas-mock from 2.4.0 to 2.5.2 in /site (#9460)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 02:22:54 +03:00
dependabot[bot] 83cee77de0 chore: bump cronstrue from 2.28.0 to 2.31.0 in /site (#9459)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 02:22:39 +03:00
dependabot[bot] f4affda554 chore: bump cron-parser from 4.7.0 to 4.9.0 in /site (#9455)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-30 23:13:48 +00:00
dependabot[bot] 03052c2e64 chore: bump @testing-library/jest-dom (#9375)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Atif Ali <atif@coder.com>
2023-08-30 23:02:01 +00:00
dependabot[bot] e8047838b3 chore: bump chart.js from 4.3.3 to 4.4.0 in /site (#9454)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-30 22:45:59 +00:00
dependabot[bot] 8841e23065 chore: bump the eslint group in /site with 7 updates (#9450)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Atif Ali <atif@coder.com>
2023-08-31 01:42:48 +03:00
dependabot[bot] c6f0d5a6e0 chore: bump axios from 1.3.4 to 1.5.0 in /site (#9452)
Bumps [axios](https://github.com/axios/axios) from 1.3.4 to 1.5.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.3.4...v1.5.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-30 19:38:10 -03:00
dependabot[bot] a67bd2ce3b chore: bump @tanstack/react-query from 4.32.0 to 4.33.0 in /site (#9453)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 01:31:00 +03:00
Kayla Washburn 4c91146cb8 fix: hide OIDC and Github auth settings when they are disabled (#9447) 2023-08-30 15:56:18 -06:00
Ammar Bandukwala 8f3b4075c7 ci: enable nestif linter (#9363) 2023-08-30 21:50:43 +00:00
Bruno Quaresma d29696296f refactor(site): refactor rich parameter input and form initial data (#9440) 2023-08-30 18:42:36 -03:00
dependabot[bot] db93f17dab chore: bump eslint from 8.46.0 to 8.48.0 in /offlinedocs (#9366)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 00:31:11 +03:00
dependabot[bot] 6268904421 chore: bump the storybook group in /site with 7 updates (#9449)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 00:27:46 +03:00
Steven Masley e827278db7 feat: failed update refresh should redirect to login (#9442)
* chore: update refresh oauth token message
* chore: unauthorized -> forbidden for non authentication failures
* redirect to login on all 401 responses
* add unit test to verify 401 on expired refresh
2023-08-30 16:14:24 -05:00
dependabot[bot] b9fbc541c6 chore: bump framer-motion from 10.15.0 to 10.16.1 in /offlinedocs (#9369)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 00:14:02 +03:00
dependabot[bot] 2bc8ba251d chore: bump archiver from 5.3.1 to 6.0.0 in /offlinedocs (#9367)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 00:13:52 +03:00
dependabot[bot] 5b1da77291 chore: bump github.com/valyala/fasthttp from 1.48.0 to 1.49.0 (#9385)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 00:13:19 +03:00
dependabot[bot] e4543e0e14 chore: bump the otel group with 4 updates (#9413)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 00:12:42 +03:00
dependabot[bot] 2c1b92b1d2 chore: bump chromatic from 6.20.0 to 6.24.1 in /site (#9377)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 00:11:05 +03:00
dependabot[bot] bb478d4939 chore: bump @playwright/test from 1.36.0 to 1.37.1 in /site (#9378)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-31 00:10:31 +03:00
Dean Sheather 1de61246a3 feat: add experimental template autostop requirement template settings UI (#9417) 2023-08-30 20:41:27 +00:00
Kayla Washburn d2462e5b88 docs: add macOS installation page (#9443) 2023-08-30 14:37:51 -06:00
Denbeigh Stevens 53a5f18ba4 fix(examples): remove reference to non-existent local variable (#9448) 2023-08-30 20:14:11 +00:00
Jon Ayers ee24260614 feat: allow configuring display apps from template (#9100) 2023-08-30 14:53:42 -05:00
Kayla Washburn 9c9d035354 feat: automate updating homebrew tap formula (#9412) 2023-08-30 13:44:38 -06:00
Kayla Washburn c6f4f0f8ad feat: install from homebrew in install.sh (#9414) 2023-08-30 11:58:53 -06:00
Mathias Fredriksson 21f3282c82 chore(dogfood): fix code-server folder (#9437) 2023-08-30 20:08:06 +03:00
Bruno Quaresma a2516b5fc3 fix(site): remove checkbox from ws table loader (#9441) 2023-08-30 14:06:39 -03:00
Marcin Tojek 2377ab6624 test(site): improve E2E framework (#9438) 2023-08-30 15:34:45 +00:00
Steven Masley a910e934a4 chore: improve error message around gitaskpass failures (#9407) 2023-08-30 08:58:31 -05:00
Bruno Quaresma 2399063a56 feat(site): make workspace batch deletion GA (#9313) 2023-08-30 10:08:42 -03:00
Spike Curtis 90acf998bf fix: fix null pointer on external provisioner daemons with daily_cost (#9401)
* fix: fix null pointer on external provisioner daemons with daily_cost

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

* Add logging for debounce and job acquire

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

* Return error instead of panic

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

* remove debounce on external provisioners to fix test flakes

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-30 10:48:35 +00:00
Spike Curtis a415395e9e fix: stop dropping error log on context canceled after heartbeat (#9427)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-30 14:44:00 +04:00
Marcin Tojek 3e67d8fa6a docs: describe dynamic options and locals (#9429) 2023-08-30 12:30:24 +02:00
Ammar Bandukwala 16ef97a061 feat(cli): add DataDog Go tracer (#9411) 2023-08-29 22:14:28 +00:00
Eric Paulsen 9ceba20ea4 docs: add jetbrains offline mode config steps (#9388) 2023-08-29 17:04:49 -04:00
Colin Adler 64ef867b4f fix(tailnet): re-add keepalives (#9410) 2023-08-29 15:21:30 -05:00
Colin Adler 8443d3e0f8 fix(enterprise): ensure audit log json fields are formatted correctly (#9397) 2023-08-29 13:36:54 -05:00
Dean Sheather a572800d47 chore: rename template restart requirement to autostop requirement (#9295) 2023-08-29 18:35:05 +00:00
Bruno Quaresma fc4683d8b3 chore: support protobuf files in the UI (#9408) 2023-08-29 17:26:23 +00:00
Mathias Fredriksson 605d2b20e2 chore(go.mod): update github.com/fergusstrange/embedded-postgres to v1.24.0 (#9405) 2023-08-29 19:00:38 +03:00
Marcin Tojek f5d813c4fb test(site): e2e: update workspace with parameters (#9338) 2023-08-29 15:10:31 +02:00
Mathias Fredriksson 3557497ea4 test(coderd): fix workspace rename test (#9402)
Fixes #9400
2023-08-29 11:42:42 +00:00
Dean Sheather 5993f85ec9 fix: avoid redirect loop on workspace proxies (#9389)
* fix: avoid redirect loop on workspace proxies

---------

Co-authored-by: Steven Masley <stevenmasley@coder.com>
2023-08-28 20:34:52 -05:00
Ben Potter eb68684327 docs: add v2.1.4 changelog (#9398)
* docs: add v2.1.4 changelog

* fmt

* reorder

* clarify
2023-08-28 22:55:09 +00:00
Mathias Fredriksson be47cc58ff fix(enterprise/coderd): use websocketNetConn in workspaceProxyCoordinate to bind context (#9395) 2023-08-28 23:12:45 +03:00
Mathias Fredriksson 487bdc2e08 fix(coderd): allow workspaceAgentLogs follow to return on non-latest-build (#9382) 2023-08-28 19:46:42 +00:00
Steven Masley fea8813f13 chore: drop 'template plan' unused command (#9386) 2023-08-28 13:33:40 -05:00
Bruno Quaresma 2167fe16d6 chore: remove e2e workaround (#9393) 2023-08-28 15:24:01 -03:00
Bruno Quaresma d138ed7314 fix(coderd): send updated workspace data adter ws connection (#9392) 2023-08-28 15:14:17 -03:00
Dean Sheather a2be2f9838 fix: avoid derp-map updates endpoint leak (#9390) 2023-08-28 18:13:19 +00:00
Kayla Washburn ce9b048f06 feat(site): improve template publishing flow (#9346) 2023-08-28 11:27:51 -06:00
Marcin Tojek 80425c32bf fix(site): workaround: reload page every 3sec (#9387) 2023-08-28 16:22:39 +00:00
Muhammad Atif Ali 35d0809830 ci: prefix dependabot github-actions PRs with ci: (#9376) 2023-08-28 18:20:52 +03:00
dependabot[bot] b6e808d116 chore: bump github.com/charmbracelet/lipgloss from 0.7.1 to 0.8.0 (#9370)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-28 14:08:32 +03:00
dependabot[bot] 506b81adeb ci: bump crate-ci/typos@v1.16.6 to crate-ci/typos@v1.16.8 (#9372)
bumps crate-ci/typos@v1.16.6 to crate-ci/typos@v1.16.8
2023-08-28 09:41:05 +00:00
Muhammad Atif Ali 79aba1d5ff ci: remove redundant groups from dependabot.yaml (#9365) 2023-08-28 09:21:54 +00:00
Ammar Bandukwala 594a6aae19 chore: format oidctest (#9362) 2023-08-27 19:51:13 +00: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
Ben Potter 173aac959c fix(systemd): use more reasonable restart limit (#9355) 2023-08-27 14:35:06 -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 61634d482f fix: truncate websocket close error (#9360)
Related #9324
2023-08-27 16:26:31 +00: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
Muhammad Atif Ali 54032ccfe8 ci: update pr-cleanup.yaml to remove set -x (#9358) 2023-08-26 23:02:22 +00:00
Muhammad Atif Ali f97b497966 chore(dogfood): update docker tf provider and metadata (#9356) 2023-08-27 01:22:28 +03:00
Ammar Bandukwala 451ca042ce feat(site): show entity name in DeleteDialog (#9347) 2023-08-25 22:16:30 +00:00
Muhammad Atif Ali 7904d0b92f docs: list firewall exceptions for restricted internet installations (#8936)
* docs: add firewall exceptions for restricted internet installtions

closes #7542

* fix link

* fmt
2023-08-25 23:48:35 +03:00
Bruno Quaresma 1de1e3b98a fix(site): make right panel scrollable on template editor (#9344) 2023-08-25 13:52:10 -06:00
Steven Masley d9d4d74f99 test: add full OIDC fake IDP (#9317)
* test: implement fake OIDC provider with full functionality
* Refactor existing tests
2023-08-25 14:34:07 -05:00
Bruno Quaresma 0a213a6ac3 refactor(site): improve the overall user table design (#9342) 2023-08-25 17:59:41 +00:00
Ammar Bandukwala 14f769d229 fix(site): use WebGL renderer for terminal (#9320) 2023-08-25 12:46:14 -05:00
Ammar Bandukwala e5c64a8ea9 fix(site): render variable width unicode characters in terminal (#9259)
Previously, characters such as 🟢 were given insufficient space, leading
to mangled output.
2023-08-25 17:45:36 +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
Muhammad Atif Ali 3b1ecd3c2f chore: update aws_linux template (#9325) 2023-08-25 13:50:03 +00:00
Marcin Tojek d7a788d89d test(site): e2e: restart workspace with ephemeral parameters (#9304) 2023-08-25 14:50:38 +02: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 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
Bruno Quaresma 058fb2ecf0 fix(site): fix default ephemeral parameter value on parameters page (#9314) 2023-08-25 12:28:18 +02: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
sharkymark 4bed492012 docs: ui option for adding licenses (#9322) 2023-08-24 22:23:59 -05:00
Jon Ayers 7ddb216d87 chore: revert nix-related CI changes (#9321)
* chore: revert nix-related CI changes

- Reverts using nix to run CI-dependencies.
- Running 'make gen' in a dogfood workspace resulted in inconsistent
  results for protobuf-related files making it difficult to pass CI.
  This PR imports the minimum changes necessary to make CI compatible
  with dogfood.
2023-08-24 21:26:30 -05:00
Ammar Bandukwala 630ec55c48 fix(coderd): remove rate limits from agent metadata (#9308)
Include the full update message in the PubSub notification so that
we don't have to refresh metadata from the DB and can avoid rate
limiting.
2023-08-24 15:18:42 -05: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
Ben Potter ebd878b6b5 chore: v2.1.3 changelog (#9311) 2023-08-24 17:35:00 +00:00
Dean Sheather 64df076328 feat: add server flag to force DERP to use always websockets (#9238) 2023-08-24 17:22:31 +00:00
Mathias Fredriksson 9cb913fb1a fix(go.mod): upgrade cdr.dev/slog to fix isTTY race (#9305) 2023-08-24 18:08:52 +03:00
Mathias Fredriksson af939d1e94 fix(coderd): optimize template app insights query for speed and decrease intervals (#9302) 2023-08-24 14:34:38 +00:00
Bruno Quaresma 67c8635543 fix(site): only show workspace actions if user has permission (#9303) 2023-08-24 11:28:59 -03:00
Bruno Quaresma 14aa1af45f refactor(site): remove as many 100vh units as possible(#9272) 2023-08-24 09:25:27 -03:00
Mathias Fredriksson 04d5e3f54f fix(coderd): rewrite template insights query for speed and fix intervals (#9300) 2023-08-24 14:38:32 +03:00
Mathias Fredriksson d00817ea4a perf(coderd): simplify insights queries to speed them up (#9299) 2023-08-24 10:52:20 +00:00
Mathias Fredriksson 6b69abfec7 fix(coderd): use stable sorting for insights and improve test coverage (#9250)
Fixes #9213
2023-08-24 13:36:40 +03:00
Cian Johnston 970072f61d chore(docs): add example scenario for parameter updates (#9298) 2023-08-24 10:35:20 +01:00
Marcin Tojek 52ea23355a docs: incompatibility in parameter options for workspace builds (#9297) 2023-08-24 11:05:31 +02:00
coryb 113894c045 fix(coderd): prevent oidc refresh being ignored (#9293) 2023-08-24 00:42:20 -05:00
Ben Potter f96622f192 chore: add exempt users to CLAbot allowlist (#9292) 2023-08-23 23:17:22 +00:00
Bruno Quaresma 6c93687095 fix(site): fix vertical scroll in the bottom bar (#9270) 2023-08-23 17:24:47 -03:00
Cian Johnston 2fa6a50de6 chore(docs): update scaling table (#9279) 2023-08-23 20:18:42 +00:00
Ben Potter e0ba80c872 chore: write v2.1.2 changelog (#9288) 2023-08-23 19:51:29 +00:00
Reuben Ellis 868ae06d4e chore: add a base directory for TurboSnap (#9258)
* Add base dir for TurboSnap

* updated main workflow as well

* Add vite configuration

* remove the mergeConfig and return config
2023-08-23 15:12:00 -03:00
dependabot[bot] 69b5c9cc27 chore: bump the react group in /site with 1 update (#9164)
Bumps the react group in /site with 1 update: [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom).

- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.15.0/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: react
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-23 15:11:02 -03:00
Kyle Carberry 707a0a2d95 fix: resolve deadlock when fetching everyone group for in-memory db (#9277) 2023-08-23 16:54:16 +00:00
Marcin Tojek e845deaa89 fix: prompt when parameter options are incompatible (#9247) 2023-08-23 18:18:38 +02:00
Mathias Fredriksson 8bfa312905 fix(coderd): parallelize queries to improve template insights performance (#9275) 2023-08-23 15:31:23 +00:00
dependabot[bot] d180df1fd5 chore: bump google.golang.org/api from 0.137.0 to 0.138.0 (#9216)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-23 18:04:20 +03:00
dependabot[bot] cff33c2326 chore: bump the github-actions group with 1 update (#9218)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-23 18:03:59 +03:00
Kayla Washburn 72cb42b8e0 feat(site): add descriptions for each auth method to the selection menu (#9252) 2023-08-23 08:58:49 -06:00
Bruno Quaresma b6aedb9f1d refactor(site): improve how string values are displayed (#9273) 2023-08-23 11:32:55 -03:00
Dean Sheather f35423c041 fix: update conn derpmap every 5s in single tailnet (#9176) 2023-08-23 11:20:31 +00: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
Marcin Tojek e6d90bd4fe fix: rewrite onlyDataResources (#9263) 2023-08-23 10:17:16 +00:00
Muhammad Atif Ali d37f6d80f7 chore(docs): update docs for correct use of shell and console and enforce linewidth (#9245) 2023-08-23 12:27:57 +03:00
Mathias Fredriksson ed2b1236c0 fix(coderd/batchstats): fix init race and close flush (#9248) 2023-08-23 11:58:25 +03:00
Kayla Washburn 31ffb566d0 fix: disable setup page once setup has been completed (#9198) 2023-08-22 14:57:46 -06:00
Jon Ayers 6e41cd1eda feat: add activity bumping to template scheduling (#9040) 2023-08-22 15:15:13 -05:00
Ammar Bandukwala 6214117d3d fix: pull agent metadata even when rate is high (#9251)
This commit fixes a bug where when the rate of metadata updates was
too high, the debounce caused a new update to get indefinitely delayed.
2023-08-22 13:55:00 -05:00
Kayla Washburn 697b0283c5 chore: fix low hanging lint issues (#9253) 2023-08-22 12:32:37 -06:00
Ben Potter 306615c674 docs: add v2.1.1 changelog (#9249)
* add WPL to manifest

* docs: add v2.1.1 changelog
2023-08-22 16:09:33 +00:00
Steven Masley 262d7692b6 feat: add force refresh of license entitlements (#9155)
* feat: add force refresh of license entitlements
* send "going away" mesasge on licenses pubsub on close
* Add manual refresh to licenses page
2023-08-22 09:26:43 -05:00
Steven Masley 37a3b42c55 feat: add last_used search params to workspaces (#9230)
* feat: add last_used search params to workspaces
2023-08-22 08:41:58 -05:00
Cian Johnston e57d635739 feat: add script to run a local keycloak instance (#9242) 2023-08-22 14:32:03 +01:00
Marcin Tojek 8a1da743cc test(site): e2e: create workspace with rich parameters (#9185) 2023-08-22 14:21:32 +02:00
Ammar Bandukwala 545a256b57 fix: correctly reject quota-violating builds (#9233)
Due to a logical error in CommitQuota, all workspace Stop->Start operations
were being accepted, regardless of the Quota limit. This issue only
appeared after #9201, so this was a minor regression in main for about
3 days. This PR adds a test to make sure this kind of bug doesn't recur.

To make the new test possible, we give the echo provisioner the ability
to simulate responses to specific transitions.
2023-08-22 02:55:39 +00: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
Kayla Washburn 2a263b9534 fix: always show add user button (#9229)
Fixes #9172

There is always at least one authentication method enabled (none), so we should remove the authMethod check to make sure that the button is always shown.
2023-08-21 15:44:20 -06:00
Ammar Bandukwala 4a9c7733d8 chore(dogfood): revert to pre-nix image (#9231) 2023-08-21 20:30:09 +00:00
Kyle Carberry 2a04d15c6d chore: downgrade dogfood image to postgres 13 (#9228) 2023-08-21 19:26:31 +00:00
Bruno Quaresma f6e02068e7 fix(site): fix ports update (#9221) 2023-08-21 14:32:59 -03:00
Bruno Quaresma 92445cf52e fix(site): fix locale dates in timeline component (#9223) 2023-08-21 14:24:54 -03:00
Cian Johnston 5c1ecfbd5f feat(scripts/develop.sh): provide an easy way to specify access url (#9222)
Allows `develop.sh --access-url="http://host:port"`
2023-08-21 17:23:07 +00:00
Steven Masley b2ca3ebaa3 fix: add workspace_proxy type to auditlog friendly strings (#9194)
* fix: add workspace_proxy type to auditlog friendly strings
* add unit test and organization type
2023-08-21 10:53:41 -05:00
Kyle Carberry 07188b123a chore: add dependencies for js-test to our nix flake (#9224) 2023-08-21 15:03:33 +00:00
Cian Johnston 5d4a17717f refactor(coderd): fetch owner information when authorizing workspace agent (#9123)
* Refactors the existing httpmw tests to use dbtestutil so that we can test them against a real database if desired,
* Modifies the GetWorkspaceAgentByAuthToken to return the owner and associated roles, removing the need for additional queries
2023-08-21 15:49:26 +01:00
Ammar Bandukwala 6d939b726c fix: correctly assess quota for stopped resources (#9201) 2023-08-21 09:01:16 -05:00
Mathias Fredriksson 509411f87c chore(flake.nix): add kubectx (#9219) 2023-08-21 15:54:22 +03:00
Mathias Fredriksson 03453b1e02 feat(coderd): add template app usage to insights (#9138)
Fixes #8658
2023-08-21 15:08:58 +03:00
Cian Johnston 4de7de420e fix(flake.nix): add gcloud auth plugin (#9215) 2023-08-21 10:58:34 +00:00
Kyle Carberry 7404ee9b21 chore: add name to top-level package.json to allow importing (#9209) 2023-08-20 00:35:38 +00:00
Kyle Carberry 4d85d56327 chore: add version to top-level package.json to allow importing (#9208) 2023-08-20 00:10:53 +00:00
Kyle Carberry 2c83bfdfa5 fix: set the location of locale_archive (#9207)
See https://nixos.wiki/wiki/Locales
2023-08-19 22:37:44 +00:00
Ammar Bandukwala 6b8102cf4c feat(cli): add daily_cost to coder ls (#9200) 2023-08-19 12:56:08 -05:00
Vaibhav Kumar e95557890a docs: remove <> and use shell for code blocks in azure docs (#9078) 2023-08-19 13:52:24 +00:00
Kyle Carberry 40ef9ff779 fix: add sapling to the nix flake (#9202) 2023-08-18 16:41:03 -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 0d40e7fe24 chore(flake.nix): add gcloud and kubectl to flake (#9197) 2023-08-18 18:29:24 +00:00
Kyle Carberry 9e9c79dbd3 fix: remove nix bash from the dogfood image (#9195)
This was unnecessary.
2023-08-18 17:59:25 +00:00
Mathias Fredriksson bbaa057e15 fix(agent): log correct script timeout for startup script (#9190) 2023-08-18 17:35:49 +00:00
Kyle Carberry 4c133e7058 fix: add yarn to the dogfood image (#9193) 2023-08-18 17:15:33 +00:00
Ben Potter 36fcee50b6 fix: use proper link to workspace proxies page (#9183)
we changed the route in #9070
2023-08-18 11:49:14 -05:00
Kyle Carberry c93782aba6 fix: allow chsh in dev image (#9191) 2023-08-18 16:15:05 +00:00
Kyle Carberry 9725ec0713 fix: separate dev shell and dev image nix deps (#9189)
* fix: separate dev shell and dev image nix deps

* Add less
2023-08-18 15:58:52 +00:00
Kyle Carberry e94ebea5e9 fix: add gh cli to the dogfood image (#9184) 2023-08-18 14:49:54 +00:00
Kyle Carberry 88de63f891 fix: add locale to dogfood image (#9181)
* fix: add locale to dogfood image

* Update flake.nix

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Add gcc

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-08-18 09:16:16 -05:00
Cian Johnston 95458ac8a5 chore(scripts/develop.sh): restore original access url setting (#9174) 2023-08-18 13:24:17 +00:00
Bruno Quaresma 8db3869415 chore: add zsh to dogfood (#9178) 2023-08-18 13:05:02 +00:00
Dean Sheather f4f3132120 docs: add workspace process logging doc (#9002) 2023-08-18 23:02:01 +10:00
Bruno Quaresma 531f740070 fix(site): remove mock data from port forward button (#9177) 2023-08-18 12:59:20 +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
phorcys420 376352eeb3 fix(ci): add github token to chocolatey workflow (#9166) 2023-08-18 13:16:56 +03:00
Marcin Tojek ea34ec7538 chore(site): regenerate provisioner stub (#9151) 2023-08-18 10:50:43 +02:00
Marcin Tojek 04810cb42e fix: do not install strace on OSX (#9167) 2023-08-18 10:07:11 +02:00
Spike Curtis 2f46f2315c fix: fix race in PGCoord at startup (#9144)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-18 09:53:03 +04:00
Kyle Carberry c0a78533bf chore: reduce build time by converting docker image to build with nix (#9099)
* Add Docker image

* Try building the container in CI

* Uncomment testing lines

* Trim image step

* Hit 'em with a Docker load

* Oopsie!

* Add a tag and push!

* Fix image name 🤦

* Fix sudo

* Fix target name

* Build and push

* Fix login to docker hub

* Revert to Docker push

* Fix PATH

* Fix SHA

* Fix ca certs

* Fix ca certs

* Fix coping files in

* Fix docker init

* Fix Docker group and init

* Add comments to our Nix

* Fix build stage

* Add some more comments

* Remove old dogfood image files

* Tag and push with branch name

* Fix tag passing

* Fix tag passing

* Remove old pull triggers

* Convert gen to use Nix

* Add protobuf to the flake

* Add prettier to the dev shell

* Swap to the faster Nix cache action

* Add the correct yq

* Fix gen

* Add make to the flake

* Update extensions
2023-08-17 21:19:36 -05:00
Kayla Washburn 5b165d5cb9 fix: make displayName primary in ParameterLabel component (#9158) 2023-08-17 19:07:57 -06:00
Ben Potter 71d5882341 chore: 2.1.0 changelog (#9160) 2023-08-17 23:02:54 +00:00
Bruno Quaresma 9caa4cfde0 feat(site): display build logs history in the build log page (#9150) 2023-08-17 18:59:26 -03: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
Kayla Washburn 9710bada06 fix: redirect to login upon authentication error (#9134) 2023-08-17 13:54:20 -06:00
Ammar Bandukwala 720ad9a653 fix(site): avoid showing disabled fields in group settings page (#9154)
Previously we allowed interaction with the icon setter and showed
confusing help text under the disabled "Display Name" field.
2023-08-17 14:21:36 -05:00
Jon Ayers 2f6687a475 feat: expose Everyone group through UI (#9117)
- Allows setting quota allowances on the 'Everyone' group.
2023-08-17 13:25:16 -05:00
Steven Masley 8910f05172 fix: /workspaces should work even if missing template perms (#9152)
If a user is missing template perms to a workspace, just block reading
that workspace. This is to keep the api consistent, it is not a rbac
enforcement.

This should ublock users reporting this bug that /workspaces returns
nothing when 1 workspace cannot be fully read. We might want to be
able to return missing or unknown fields in our api to account
for this.
2023-08-17 13:22:03 -05:00
Kayla Washburn e39402f1c9 fix: don't navigate away from editor after publishing (#9153) 2023-08-17 10:49:16 -06:00
Reuben Ellis 94cbc2ae7f chore: update storybook build script (#9140) 2023-08-17 09:58:52 -03:00
Oleg Kovalov c639674b39 chore: replace chi with chi/v5 (#9143) 2023-08-17 07:46:56 -05:00
Spike Curtis c66befb548 fix(scaletest): change IP range to non-reserved in GCP (#9146)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-17 13:11:02 +04:00
Spike Curtis c7a6d626b4 fix: make PGCoordinator close connections when unhealthy (#9125)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-17 09:36:47 +04:00
Eric Paulsen c217a0d819 fix!: remove jq from image (#8979)
* fix: remove jq from base and add jq ext image

* Delete Dockerfile.ext-jq

---------

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-08-16 21:20:33 -04:00
Kayla Washburn 5c7780015b chore: rename UsersDropdown.tsx component file to UserDropdown.tsx (#9137) 2023-08-16 17:36:51 -06:00
Ben Potter fa8e103b0e docs: last seen before & after (#9096) 2023-08-16 23:20:03 +00:00
Asher 02ee724d9f fix: do terminal emulation in reconnecting pty tests (#9114)
It looks like it is possible for screen to use control sequences instead
of literal newlines which fails the tests.

This reuses the existing readUntil function used in other pty tests.
2023-08-16 13:02:03 -08:00
Steven Masley 74999305b6 fix: change oauth convert oidc cookie to SameSite=Lax (#9129)
The strict mode was blocking the cookie from being sent on the
redirect flow. This worked on localhost because cookies
behave differently on localhost
2023-08-16 12:50:44 -05:00
Bruno Quaresma b05293572f refactor(site): remove template parameters insights out of experimental (#9126) 2023-08-16 12:29:42 -03:00
Muhammad Atif Ali 8646f7c00d chore: add JFrog VS Code extension to jfrog template (#9128) 2023-08-16 10:03:42 -05:00
Bruno Quaresma 752070baf5 refactor(site): use bar chart for DAUs (#9127) 2023-08-16 10:59:15 -03:00
Spike Curtis ff9252c706 feat: add provisioner chart to release and docs (#9050)
* Add provisioner chart to release and docs

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

* Update docs/admin/provisioners.md

Co-authored-by: Muhammad Atif Ali <atif@coder.com>

* Prettier

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

* spell out PSK first time per section

Co-authored-by: Cian Johnston <cian@coder.com>

---------

Signed-off-by: Spike Curtis <spike@coder.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
Co-authored-by: Cian Johnston <cian@coder.com>
2023-08-16 16:26:38 +04:00
Mathias Fredriksson 6fd9975aed feat(coderd): add coder_app usage stats (#9001)
Updates #8658
2023-08-16 15:22:00 +03:00
phorcys420 f3c707648c ci: publsh Chocolatey package (#8921) 2023-08-16 15:21:28 +03:00
Ammar Bandukwala 95d66ac385 docs: explain using Artifactory as a template store (#9071) 2023-08-15 16:46:56 -05:00
sharkymark 7261f0a9d4 docs: add bpmct template repo to community markdown (#9113) 2023-08-15 21:13:51 +00:00
Cian Johnston 6cdf1c73c0 chore: update sqlc to version 1.20.0 (#9111) 2023-08-15 20:06:03 +00:00
Colin Adler 5b2ea2e94f fix(tailnet): disable wireguard trimming (#9098)
Co-authored-by: Spike Curtis <spike@coder.com>
2023-08-15 14:26:56 -05:00
Eric Paulsen e4c24e05f8 fix: rename group GET request (#9097)
* fix: group GET req naming

* make: gen
2023-08-15 14:47:08 -04:00
dependabot[bot] 279d9f71f9 chore: bump github.com/gohugoio/hugo from 0.116.0 to 0.117.0 (#9084)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-15 13:40:03 -05:00
Ben Potter ee9deb0a6e docs: add conditional example to optional vs required parameters (#9115) 2023-08-15 18:24:05 +00:00
dependabot[bot] 65d84827cd chore: Bump the github-actions group with 1 update (#9086)
Bumps the github-actions group with 1 update: [crate-ci/typos](https://github.com/crate-ci/typos).

- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.16.2...v1.16.4)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-15 19:33:34 +03:00
Bruno Quaresma c5d4a4d85d docs: update FE stack (#9112) 2023-08-15 16:03:14 +00:00
Spike Curtis 63278ab88f Reword latency docs for HA (#8860)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-15 19:58:04 +04:00
Bruno Quaresma 4058f049af feat(site): add batch actions to the workspaces page (#9091) 2023-08-15 12:57:39 -03:00
dependabot[bot] c2c9da7db0 chore: bump google.golang.org/api from 0.134.0 to 0.137.0 (#9093)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-15 10:50:10 -05:00
Colin Adler 9d9b330b16 chore: add request body to patch groups openapi spec (#9101) 2023-08-15 15:29:15 +00:00
Spike Curtis 41433cd1ec feat: add terminationGracePeriodSeconds to provisioner chart (#9048)
* feat: add terminationGracePeriodSeconds to provisioner chart

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

* Remove hardcoded 1 minute graceful timeout

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-15 08:38:58 +00:00
Spike Curtis e893ab232c chore: enables debug logging on TestTemplateInsights (#9103)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-15 12:35:51 +04:00
Muhammad Atif Ali 86fcd4503f Revert "ci: run tests intelligently based on changes between consecutive commits (#9017)" (#9104) 2023-08-15 08:22:49 +00:00
Muhammad Atif Ali 9a1f845553 docs: expand jfrog platform and example template (#9073) 2023-08-15 07:04:07 +00:00
Spike Curtis d54b387e34 fix: fix deadlock on tailnet close (#9079)
* fix: fix deadlock in tailnet close

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

* close another tailscale race

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

* Close another race

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

* HACK - run go tests

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

* Revert "HACK - run go tests"

This reverts commit d2729f36b4.

* tailscale to tip of coder/tailscale/main

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-15 06:54:06 +00:00
Colin Adler 344d32b2f1 feat(coderd): expire agents from server tailnet (#9092) 2023-08-14 20:38:37 -05:00
Asher a08f7b8fb9 fix: catch missing output with reconnecting PTY (#9094)
I forgot that waiting on the cond releases the lock so it was possible
to get pty output after writing the buffer but before adding the pty to
the map.  To fix, add the pty to the map while under the same lock where
we read from the buffer.

The rest does not need to be behind the lock so I moved it out of
doAttach, and that also means we no longer need
waitForStateOrContextLocked.

Also, this can hit a logger error saying the attach failed which fails
the tests however it is not that the attach failed, just that the
process already ran and exited, so when the process exits do not
set an error, instead for now assume this is an expected close.
2023-08-14 15:54:23 -08:00
Steven Masley 6ea82c5ae7 chore: add oidc sequence diagram image to docs (#9089)
* chore: add oidc sequence diagram image to docs

* Change wording

* Direct link to the sequence diagram
2023-08-14 17:35:43 -05: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
dependabot[bot] 4e36f91ea2 chore: bump the golang-x group with 1 update (#9083)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-14 16:59:28 -05:00
Dean Sheather 47b8bf6585 feat: update workspace deadline when template policy changes (#8964) 2023-08-14 21:16:47 +00: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
Asher b993cab49a fix: use screen for reconnecting terminal sessions on Linux if available (#8640)
* Add screen backend for reconnecting ptys

The screen portion is a port from wsep.  There is an interface that lets
you choose between screen and the previous method.  By default it will
choose screen if it is installed but this can be overidden (mostly for
tests).

The tests use a scanner instead of a reader now because the reader will
loop infinitely at the end of a stream.

Replace /bin/bash with bash since bash is not always in /bin.

* Remove connection_id from reconnecting PTY logger

This serves multiple connections so it makes no sense to scope it to a
single connection.

Also lets us use "connection_id" when logging write errors instead of
"other_conn_id".

* Use PATH to test buffered reconnecting pty
2023-08-14 11:19:13 -08:00
Muhammad Atif Ali 878315dcaf fix: fix CI concurrency (#9088) 2023-08-14 18:48:14 +03:00
Cian Johnston ef9d84c723 fix(scaletest): cleanup: attempt to cancel in-progress jobs (#9080)
This change modifies the cleanup behaviour to make a best-effort attempt to cancel the in-progress scaletest workspace build jobs before deleting them.
2023-08-14 12:43:45 +01:00
Cian Johnston 72575cc462 chore(docs): fix indentation in install/kubernetes.md (#8906)
* chore(docs): fix indentation in install/kubernetes.md

* fmt
2023-08-14 09:41:00 +01:00
Kyle Carberry 594b9797dd fix: change dashboard route /settings/deployment to /deployment (#9070)
It felt unnecessary to nest this.
2023-08-13 16:58:04 +00: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
Kyle Carberry 9a13814b46 fix: remove duplication from language of query param error (#9069) 2023-08-13 11:47:44 -05:00
Muhammad Atif Ali 1629a2a4ee chore: sort DERP regions by latencies on workspace page (#9063) 2023-08-13 18:52:14 +03:00
Kyle Carberry abe17b1164 chore: update speakeasy to fix stty path bug on nixos (#9022)
Prompts failed on NixOS due to /bin/stty being hardcoded for turning
off echo in the terminal prompt. See:
https://github.com/bgentry/speakeasy/commit/760eaf8b681647364e7a400b856e0921248728a5
2023-08-13 15:10:58 +00:00
Muhammad Atif Ali 984f7ce045 fix: update BUILD condition in pr-deploy.yaml (#9064)
This makes the build condition more understandable and fixes an issue where we could not deploy a new PR as the build condition was constantly evaluating false.
2023-08-13 11:18:17 +03:00
Eric Paulsen 6af6e85fe3 docs: add coder login to CI docs (#9038)
* docs: add coder login to CI docs

* add CODER_URL

* add --url flag to login cmd
2023-08-11 20:55:55 +00:00
Eric Paulsen d2a9049fd7 docs: add offline docs for JetBrains Gateway (#9039) 2023-08-11 14:56:35 -05:00
Steven Masley 320de18be7 fix: correct github oauth2 callback url (#9052)
* fix: correct github oauth2 callback url
2023-08-11 09:25:05 -05:00
Steven Masley 47ca84be47 chore: return queried user on failure to help debug (#9051) 2023-08-11 14:02:19 +00:00
Steven Masley 1c7bd57da8 chore: clarify region selection behavior (#9021)
* chore: clarify region selection behavior

* Update site/src/components/Navbar/NavbarView.tsx

Co-authored-by: Kyle Carberry <kyle@coder.com>

---------

Co-authored-by: Kyle Carberry <kyle@coder.com>
2023-08-11 08:26:01 -05:00
Muhammad Atif Ali 59fd4e86c9 ci: remove deleting comments section from pr-cleanup.yaml (#9047) 2023-08-11 15:43:37 +03:00
Muhammad Atif Ali a13c8c88d5 fix: prevent unrequested PR deployments (#9049) 2023-08-11 12:32:42 +00:00
Muhammad Atif Ali 7fb9197860 ci: do not run deploy-pr on main (#9046) 2023-08-11 10:54:55 +00:00
Muhammad Atif Ali 114ad4624e ci: upgrade pr deployments workflow (#8924) 2023-08-11 13:49:23 +03:00
Muhammad Atif Ali 4d8152d543 ci: run tests intelligently based on changes between consecutive commits (#9017) 2023-08-11 13:48:24 +03: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
ffais 6fd5344d0a feat: add support for NodePort service type in Helm chart (#8993)
* add support for NodePort service type in Helm chart

* fix nodeport values

* formatting & make update-golden-files

* update-golden-files

---------

Co-authored-by: Eric <ericpaulsen@coder.com>
2023-08-10 20:57:59 -04:00
timquinlan a2d64c08c1 docs: update helm values.yaml code snippet, put quote around boolean value (#9026)
* updated helm values.yaml code snippet, put quote around boolean values and added comments showing that CODER_OAUTH2_GITHUB_ALLOW_EVERYONE and CODER_OAUTH2_GITHUB_ALLOW_EVERYONE are mutually exclusive

* Update auth.md

spotted and fixed minor typo
2023-08-10 17:06:10 -04:00
Dean Sheather d2f22b063a fix: move STUN servers into their own regions (#9030) 2023-08-11 05:04:17 +10:00
Dean Sheather 25c6832772 chore: update tailscale (#9027) 2023-08-11 04:26:28 +10:00
Bruno Quaresma 175aed1685 feat(site): add tooltip showing the error in the failure badge (#9029) 2023-08-10 15:23:31 -03:00
Bruno Quaresma 83061bef7e refactor(site): add minor improvements to the port button (#9028) 2023-08-10 14:47:56 -03:00
Ben Potter 76ad116e12 docs: write 2.0.2 changelog (#9025)
* mention provisioner authentication

* add changelog for 2.1.0

* rename to 2.0.2
2023-08-10 17:02:02 +00:00
Marcin Tojek 967a4b0c7c feat: add example template using rich parameters (#9020) 2023-08-10 16:36:18 +02:00
Muhammad Atif Ali 091c00bd70 fix: make preferred region the first in list (#9014) 2023-08-10 12:59:39 +00:00
Bruno Quaresma 834ce41013 refactor(site): add default background color to html and body (#9009) 2023-08-10 09:41:35 -03:00
Marcin Tojek 9d9814c6b0 refactor(cli): adjust parameter resolver (#9019) 2023-08-10 12:08:00 +02:00
Spike Curtis 21af020386 feat: add external provisioner daemon helm chart (#8939)
* Refactor helm to extract common templates to libcoder

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

* Remove comment from libcoder Chart.yaml

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

* Add provisioner helm chart

* Fix prettier, linting, docs

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

* Log at INFO when provisionerd connects to coderd

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

* remove unnecessary exports in helm tests

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-10 13:59:43 +04:00
Steven Masley cdb089049e chore: add docs for creating missing groups on oidc sync (#8983) 2023-08-09 22:43:44 -05:00
Colin Adler 370bdd6a03 fix(cli): only init clistat.Client when calling coder stat (#9013) 2023-08-09 19:17:57 -05:00
Bruno Quaresma c0d1cacc49 fix(site): fix storybook error and inconsistent snapshots (#9010) 2023-08-09 21:22:13 +00:00
Eric Paulsen fb5e0c4bba docs: add TLS config steps for K8s (#9011)
* docs: add TLS config steps for K8s

* add note on wildcard cert
2023-08-09 17:00:22 -04:00
Bruno Quaresma 3245e91a32 fix(site): set default color and display error on appearance form (#9004) 2023-08-09 16:53:32 -03:00
Colin Adler bc862fa493 chore: upgrade tailscale to v1.46.1 (#8913) 2023-08-09 19:50:26 +00:00
Bruno Quaresma 5b9dc2ee8b fix(site): add search params to auth redirect (#9005) 2023-08-09 16:31:12 -03:00
phorcys420 53f26b313d fix(scripts): check if PR list is empty (#8805)
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-08-09 19:22:46 +00:00
Colin Adler 612f1c6a55 chore: use echo provisioners in logging tests (#9008) 2023-08-09 19:03:02 +00:00
Steven Masley f334b66178 chore: do not allow resetting password of non password users (#9003) 2023-08-09 13:56:13 -05:00
Colin Adler 919f5c6fe9 chore: increase e2e timeout to 60s (#9007) 2023-08-09 18:50:27 +00:00
Colin Adler a9e01bf3f1 chore: fix terraform tests (#9006) 2023-08-09 18:11:03 +00:00
Bruno Quaresma 7b35f3b3ad fix(site): add horizontal scroll when having many tabs (#8998) 2023-08-09 14:28:25 +00:00
Bruno Quaresma 7fceb9aaff fix(site): make stats bar scrollable on smaller viewports (#8996) 2023-08-09 11:26:56 -03:00
Bruno Quaresma d73e3ad3f3 fix(site): show user avatar on group page (#8997) 2023-08-09 11:26:43 -03:00
dependabot[bot] a6716ca829 chore: bump chart.js from 3.9.1 to 4.3.3 in /site (#8874)
* chore: bump chart.js from 3.9.1 to 4.3.3 in /site

Bumps [chart.js](https://github.com/chartjs/Chart.js) from 3.9.1 to 4.3.3.
- [Release notes](https://github.com/chartjs/Chart.js/releases)
- [Commits](https://github.com/chartjs/Chart.js/compare/v3.9.1...v4.3.3)

---
updated-dependencies:
- dependency-name: chart.js
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* Remove timescale

* Fix step size

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
Co-authored-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>
2023-08-09 09:54:03 -03:00
Bruno Quaresma 73e518b0fb refactor(site): remove last 7 days label (#8986) 2023-08-09 09:46:14 -03:00
Spike Curtis e0f644c598 test(coderd): fix TestWorkspaceWatcher hang waiting for update (#8992)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-08-09 16:09:25 +04:00
Marcin Tojek 0d382d1e05 feat(cli): provide parameter values via command line (#8898) 2023-08-09 13:00:25 +02:00
Ben Potter 1730d35467 Revert "fix: hide experiment CTA from OIDC copy (#8695)" (#8825)
This reverts commit adbabe4e09.
2023-08-09 10:05:46 +00:00
Dean Sheather 9941f49056 fix: remove stun nodes from workspace proxy regions (#8990) 2023-08-09 09:31:25 +00:00
Dean Sheather 00a8221e51 fix: rename duplicate migration (#8989) 2023-08-09 05:49:13 +00:00
Dean Sheather 07fd73c4a0 chore: allow multiple agent subsystems, add exectrace (#8933) 2023-08-08 22:10:28 -07:00
Bruno Quaresma 70bd23a40a refactor(site): add default title (#8985) 2023-08-08 18:48:53 -03:00
Steven Masley d4e115d267 chore: show basic experiment set value (#8984)
This value is pre-parsed, meaning the experiments listed may not
be valid. This is a very basic display for helping debuging purposes.
2023-08-08 15:33:08 -05:00
Dean Sheather f7a35e0559 chore: add workspace proxies to telemetry (#8963) 2023-08-08 18:29:35 +00:00
Dean Sheather 3c52b01850 chore: add tailscale magicsock debug logging controls (#8982) 2023-08-08 17:56:08 +00:00
Colin Adler a5c59b9934 chore: upgrade to alpine 3.18.3 (#8980) 2023-08-08 12:21:38 -05:00
Bruno Quaresma 76b1594670 feat(site): add date range picker for the template insights (#8976) 2023-08-08 13:43:21 -03: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
Bruno Quaresma 4a987e9917 feat(site): add parameters usage to insights (#8886) 2023-08-08 13:09:31 -03:00
Steven Masley 5339a31532 fix: remove refresh oauth logic on OIDC login (#8950)
* fix: do not do oauth refresh logic on oidc login
2023-08-08 10:05:12 -05:00
Cem 1d4a72f43f perf(coderd/util/slice): refactor unique method for large lists (#8925) 2023-08-08 10:02:52 -05:00
Muhammad Atif Ali 05054c6a0a ci: make test-e2e a required check (#8977) 2023-08-08 14:57:57 +00:00
Kyle Carberry 4d3230c9ad fix: default to executing e2e ssh without args (#8975)
This was causing the test to fail consistently!
2023-08-08 14:35:34 +00:00
Muhammad Atif Ali c20c4faa7c docs: format CONTRIBUTING.md (#8973) 2023-08-08 17:12:51 +03:00
Dean Sheather b2a84462ab chore: fix ruleguard xerrors rules (#8967) 2023-08-08 12:32:41 +00:00
Muhammad Atif Ali 31b7de6a3e chore: upgrade go to 1.20.7 (#8923)
* chore: upgrade go to 1.20.7

* remove unused env
2023-08-08 09:20:36 +03:00
Kyle Carberry bac3a588b3 chore: add e2e test for backwards client ssh compatibility (#8958)
* chore: add e2e test for backwards client ssh compatibility

This was discussed as part of our regression review for outdated
agents, so here is the reverse with an extremely old client.

* fmt
2023-08-08 05:36:46 +00:00
Kyle Carberry 73b136e3f0 fix: add exp backoff to validate fresh git auth tokens (#8956)
A customer using GitHub in Australia reported that validating immediately
after refreshing the token would intermittently fail with a 401. Waiting
a few milliseconds with the exact same token on the exact same request
would resolve the issue. It seems likely that the write is not propagating
to the read replica in time.
2023-08-08 04:29:35 +00:00
Colin Adler 694729b4f7 chore: disable goleak in windows cli tests (#8955) 2023-08-07 22:23:00 -05:00
Colin Adler 7e3ff5b66e chore: fix TestBatchStats flake (#8952) 2023-08-07 21:55:31 -05:00
Colin Adler 758c368222 chore: fix TestTailnet/ForcesWebSockets flake (#8953) 2023-08-07 21:17:39 -05:00
dependabot[bot] 827de08007 chore: bump the golang-x group with 3 updates (#8940)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-07 14:30:14 -05:00
dependabot[bot] b2dc8897ff chore: bump github.com/go-playground/validator/v10 from 10.14.0 to 10.15.0 (#8941)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-07 14:16:03 -05:00
Ben Potter 3b16e7112d fix: improve formatting in Gateway docs (#8949)
* fix: image formatting for gateway docs

* chore: fix some more spots

* more

* fmt

* space things out more
2023-08-07 17:34:41 +00:00
Ben Potter b67ece1cbc fix: image formatting for gateway docs (#8947) 2023-08-07 11:45:15 -05:00
sharkymark 9f76381fc1 chore: add install more providers step in jetbrains docs; update images (#8943) 2023-08-07 16:31:43 +00:00
Marcin Tojek e8627195a2 feat(coderd): expose parameter description and type (#8944) 2023-08-07 16:11:44 +00:00
dependabot[bot] 00be8ab875 chore: bump the github-actions group with 1 update (#8942)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-07 18:54:20 +03:00
Dean Sheather 67ff2077a6 feat: add derp only text to proxies list in dashboard (#8932) 2023-08-08 01:52:06 +10:00
Cian Johnston 82e0e2e43c fix(cli): clistat: accept positional arg for stat disk cmd (#8911) 2023-08-07 16:26:16 +01:00
Muhammad Atif Ali 6ded748989 fix: update tag name for coder-preview image in ci.yaml (#8945) 2023-08-07 14:35:28 +00:00
Steven Masley 71ea5ace07 feat: add login type to users page (#8912) 2023-08-07 09:34:39 -05:00
Muhammad Atif Ali 90c1647fcf ci: change ghcr.io/coder/coder-preview:main tag to use version names (#8938) 2023-08-07 16:41:20 +03:00
Muhammad Atif Ali e7047726d8 docs: fix a broken link in docs.changelogs/README.md (#8937) 2023-08-07 13:00:05 +03:00
Ammar Bandukwala 81752d1b84 fix(cli/delete): prompt for confirmation after workspace is found (#8579) 2023-08-05 11:25:37 -05:00
Colin Adler eddaa7781d fix: don't close cached tailnet on pty close (#8917) 2023-08-04 22:54:27 +00:00
Colin Adler 0c7ff4fb8a fix(enterprise): ensure SCIM create user can unsuspend (#8916) 2023-08-04 22:03:21 +00:00
Bruno Quaresma 8f7b6a2936 fix(site): fix date range on template insights (#8914) 2023-08-04 18:00:13 +00:00
Cian Johnston 7224ff2af8 fix(enterprise/replicasync): fix data race in Manager.Regional (#8910) 2023-08-04 17:33:05 +01:00
Muhammad Atif Ali 9f5ac4d15d ci: publish main commit tag to ghcr.io/coder/coder-preview (#8897)
* wip

* push new tag and delete old tag

* prune by filtering

* fix permission

* fix filter

* keep last 2 versions

* use first 7 characters of sha for tag

* do not use gh cli

* test

* typo

* use gh cli again

* reduce days to 3

* fixup

* typo

* keep-last 5

* ready to merge

* retain tags from last 7 days

* test

* ready
2023-08-04 19:27:12 +03: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
Bruno Quaresma 5106dfde52 refactor(site): refactor the ports button design (#8879)
* Refactor button

* Move component to where it is used

* Add base state of port forward component

* Add stories and empty state

* Add listening ports to handlers

* Add review suggestions

* Fix minor thing
2023-08-04 09:55:33 -05:00
Eric Paulsen 1c3ec8743c docs: clean up k8s install steps and order (#8869) 2023-08-04 08:40:48 -04:00
Ammar Bandukwala eae15c0789 chore(examples): bump envbuilder version (#8893) 2023-08-04 06:47:15 -05:00
Cian Johnston aff025e78c chore(docs): fix link to helm values highlighting affinity (#8901) 2023-08-04 10:25:24 +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
Muhammad Atif Ali b77d6b2c84 ci: delete comments by github-action[bot] (#8896) 2023-08-04 06:55:38 +00:00
Eric Paulsen 2e45a0ffd7 fix(helm): set correct prom port in helm notes (#8888) 2023-08-04 07:52:59 +03:00
Jon Ayers e43608395c feat: add frontend for locked workspaces (#8655)
- Fix workspaces query for locked workspaces.
2023-08-03 19:46:02 -05:00
Colin Adler 502c7680a2 chore: fix release and security pipelines (#8891) 2023-08-03 18:40:47 -05:00
Ben Potter 7ad944da5f chore: v2 changelog (#8890) 2023-08-03 21:45:32 +00:00
Colin Adler 8ee500c59d fix: generate typescript types for healthcheck pkg (#8846) 2023-08-03 16:20:46 -05:00
Cian Johnston 72780c8031 chore(docs): update scaling.md (#8883)
* chore(docs): update scaling docs

* fixup! chore(docs): update scaling docs

* Update docs/admin/scale.md

* update with compute resources provided to coder

* address PR comments
2023-08-03 21:59:07 +01:00
Ben Potter 1314cd8fcb chore: support manual changelog and version 2.0 for releases (#8880)
* chore(release): add manual changelog + 2.0 support

* add comment

* fix typo

* fmt
2023-08-03 12:41:54 -05:00
Muhammad Atif Ali 10da570916 fix: prevent PR deployment without manual trigger (#8882)
* fix: do not deploy without a manual trigger

This will fix automatic first deployment

* fix typo

* Update pr-deploy.yaml

* Update pr-deploy.yaml

* Update pr-deploy.yaml

* Update pr-deploy.yaml

* Update pr-deploy.yaml

* Update pr-deploy.yaml

* Update pr-deploy.yaml

* build at least once

* wait for certificate

* Update pr-deploy.yaml
2023-08-03 19:32:20 +03:00
Muhammad Atif Ali b47bd7ccb5 ci: implement automatic upgrade of PR deployment (#8876) 2023-08-03 18:11:07 +03:00
Mathias Fredriksson d3991fac26 feat(coderd): add parameter insights to template insights (#8656) 2023-08-03 14:43:23 +00:00
Bruno Quaresma 2ed453035e fix: fix develop script and pnpm command (#8878) 2023-08-03 14:15:45 +00:00
dependabot[bot] 7493b28155 chore: bump the storybook group in /site with 1 update (#8872)
Bumps the storybook group in /site with 1 update: [storybook-addon-react-router-v6](https://github.com/JesusTheHun/storybook-addon-react-router-v6).

- [Release notes](https://github.com/JesusTheHun/storybook-addon-react-router-v6/releases)
- [Changelog](https://github.com/JesusTheHun/storybook-addon-react-router-v6/blob/main/CHANGELOG.md)
- [Commits](https://github.com/JesusTheHun/storybook-addon-react-router-v6/compare/v1.0.2...v2.0.0)

---
updated-dependencies:
- dependency-name: storybook-addon-react-router-v6
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: storybook
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-03 08:19:22 +03:00
Colin Adler e68d508469 chore: bump openssl in base image (#8811) 2023-08-02 16:16:34 -05:00
Bruno Quaresma b6018198b7 chore: remove insights from experimental (#8868) 2023-08-02 20:24:00 +00:00
Muhammad Atif Ali f7327dd2c6 fix: avoid using comment body directly (#8851) 2023-08-02 22:19:17 +03:00
Colin Adler 4b81cfaa0d chore: switch from yarn to pnpm (#8822) 2023-08-02 13:28:16 -05:00
Bruno Quaresma cf35c0dfc5 feat(site): add health warning and a health monitor page (#8844) 2023-08-02 14:49:24 -03:00
Bruno Quaresma 44f9b0228a fix(site): fix initial value for update parameters (#8863) 2023-08-02 14:37:02 -03:00
Bruno Quaresma 00cbb211b4 fix(site): show error when user exists (#8864) 2023-08-02 14:36:35 -03:00
Colin Adler eddd4f8888 chore: fix dupliate migration round 2 (#8867) 2023-08-02 16:28:30 +00:00
Steven Masley 4c1e63aae8 feat: add display_name field to groups (#8740)
* feat: add display_name field to groups

This is a non-unique human friendly group name for display
purposes. This means a display name can be used instead of
using an environment var to remap groups with OIDC names to
Coder names. Now groups can retain the OIDC name for mapping,
and use a display name for display purposes.
2023-08-02 10:53:06 -05:00
Dean Sheather 6ea32e4e80 fix: show current DERP name correctly in vscode (#8856) 2023-08-03 01:30:43 +10:00
Colin Adler aa7b267170 chore: add pnpm to dogfood image (#8865) 2023-08-02 10:26:47 -05:00
Colin Adler e482d39052 chore: fix duplicate migration (#8866) 2023-08-02 15:09:10 +00:00
Dean Sheather cd1e088f7c feat: add --derp-only flag to wsproxy (#8850) 2023-08-03 00:35:06 +10:00
Marcin Tojek d6e9870209 feat: add "dormant" user state (#8644) 2023-08-02 16:31:25 +02:00
Muhammad Atif Ali d2c7c8e1d8 fix: allow ci to publish a package (#8862) 2023-08-02 17:22:11 +03:00
Muhammad Atif Ali 57c7d7d4d2 ci: build and push ghcr.io/coder/coder-preview:main (#8832) 2023-08-02 15:45:14 +03:00
Dean Sheather 496ec6cfc5 fix: add read call to derp-map endpoint to avoid ws ping timeout (#8859) 2023-08-02 08:31:51 +00:00
Muhammad Atif Ali 75fcc24b60 fix: copy secret for the first deployment too (#8857) 2023-08-02 10:44:38 +03:00
Dean Sheather b955c5fefc fix: avoid agent runLoop exiting due to ws ping (#8852) 2023-08-02 07:25:07 +00:00
Muhammad Atif Ali f48e8dcf88 chore: update concurrency to use PR number (#8853) 2023-08-02 10:04:39 +03:00
Colin Adler 1472cce6c3 chore: increment GOCACHE key (#8849) 2023-08-02 03:33:52 +00:00
Dean Sheather 6b69970d7c fix: avoid infinite loop in agent derp-map (#8848) 2023-08-02 13:18:46 +10:00
Colin Adler 805eaca4b7 chore: use fetch-depth: 1 for most ci jobs (#8847) 2023-08-02 02:48:35 +00:00
dependabot[bot] 9b6750a4db chore: bump github.com/open-policy-agent/opa from 0.51.0 to 0.55.0 (#8808)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 21:48:02 -05:00
Ben Potter 4456d0bfea docs: sync roles (enterprise) (#8696)
* docs: role sync (enterprise)

* edits from code review

* fix typo
2023-08-01 13:47:55 -05:00
Eric Paulsen 924bccbfcf docs: rm microsoft vs code server docs (#8845) 2023-08-01 12:46:17 -05:00
Steven Masley 66649f97a8 chore: use system permission to prevent fetching all workspaces (#8843)
* chore: use system permission to prevent fetching all workspaces
2023-08-01 12:26:22 -05:00
Dean Sheather c575292ba6 fix: fix tailnet netcheck issues (#8802) 2023-08-02 01:50:43 +10:00
Steven Masley 929f2d585a fix: intiator user fields are included in the workspace build (#8836) 2023-08-01 10:35:43 -05:00
dependabot[bot] b7eafe1635 chore: bump github.com/gohugoio/hugo from 0.115.0 to 0.116.0 (#8807)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 10:27:23 -05:00
Colin Adler 437256d352 chore: upgrade slog (#8815) 2023-08-01 10:26:52 -05:00
Muhammad Atif Ali e23e5262b4 chore: wait 30 seconds before checking winget PR in release.yaml (#8835) 2023-08-01 14:57:25 +00:00
Muhammad Atif Ali b104bb7005 docs: update CONTRIBUTING.md with PR deployments instructions (#8831)
* docs: Update CONTRIBUTING.md with PR deployments instructions

* update
2023-08-01 16:48:32 +03:00
dependabot[bot] dcc63aec90 chore: bump the storybook group in /site with 6 updates (#8828)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 16:14:20 +03:00
dependabot[bot] 27c2fb8a56 chore: bump the eslint group in /site with 5 updates (#8829)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 15:19:07 +03:00
Muhammad Atif Ali 6a12912d6e ci: use a wildcard subdomain for PR deployments (#8801) 2023-08-01 12:02:42 +01:00
Marcin Tojek 336e663180 fix: parse insights start and end time (#8826) 2023-08-01 10:43:49 +02:00
dependabot[bot] a96c4a3f29 chore: bump framer-motion from 6.5.1 to 10.15.0 in /offlinedocs (#8817)
Bumps [framer-motion](https://github.com/framer/motion) from 6.5.1 to 10.15.0.
- [Changelog](https://github.com/framer/motion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/framer/motion/compare/v6.5.1...v10.15.0)

---
updated-dependencies:
- dependency-name: framer-motion
  dependency-type: direct:production
  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>
2023-08-01 07:28:06 +03:00
dependabot[bot] 8d0e8f45e0 chore: bump eslint from 8.45.0 to 8.46.0 in /offlinedocs (#8816)
Bumps [eslint](https://github.com/eslint/eslint) from 8.45.0 to 8.46.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.45.0...v8.46.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-01 07:27:19 +03:00
dependabot[bot] 280fc9d5ef chore: bump typescript from 4.7.3 to 5.1.6 in /offlinedocs (#8819)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.7.3 to 5.1.6.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.7.3...v5.1.6)

---
updated-dependencies:
- dependency-name: typescript
  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>
2023-08-01 07:27:04 +03:00
Colin Adler b84bba8fd1 chore: increase fmt timeout (#8820) 2023-07-31 16:36:53 -05:00
Steven Masley cb36783e8c feat: convert to oidc out of experimental (#8742) 2023-07-31 10:30:34 -05:00
Colin Adler ed82b864d0 chore: reenable prisma image scan (#8810) 2023-07-31 10:12:24 -05:00
Muhammad Atif Ali af036b440b docs: allow multiple Coder deployments to use single GitHub OAuth app (#8786)
* docs: Add instructions for using the same GitHub OAuth app for multiple Coder deployments

* fmt

* typo

* Update auth.md
2023-07-31 10:00:48 -04:00
Marcin Tojek ddabe9cc7f feat: improve RBAC preconditions for Insights endpoint (#8794) 2023-07-31 13:44:32 +00:00
Colin Adler 4cc270b12b revert(enterprise): make pgcoord experimental again (#8797) 2023-07-28 18:38:32 -05:00
Colin Adler 98d9a65cf5 chore: mark site/src/api/typesGenerated.ts as generated (#8798) 2023-07-28 18:22:37 -05:00
Colin Adler 0b4f333a6f chore: add http debug support to pgcoord (#8795) 2023-07-28 17:59:31 -05:00
Bruno Quaresma a75346dd32 refactor(site): simplify workspaces page component structure (#8793) 2023-07-28 13:07:50 -03: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
Bruno Quaresma 78b06397a6 fix(site): fix metadata value changing width all the time (#8780) 2023-07-28 09:59:49 -03:00
Muhammad Atif Ali ea2ae10bc3 ci: update terraform to ~1.5 (#8766)
* ci: update terraform to 1.5.3

* Update action.yaml
2023-07-28 10:12:06 +00:00
Muhammad Atif Ali e029df61ff ci: update secret name in pr-cleanup.yaml (#8790) 2023-07-28 08:26:11 +00:00
Bruno Quaresma e8f82538e8 refactor(site): sort proxies in navbar by latency (#8781) 2023-07-27 21:50:11 -03:00
Kyle Carberry 91a0c7abe0 fix: improve the language of the template insights page (#8777) 2023-07-27 21:04:28 +00:00
Bruno Quaresma 471dc6126c chore: upgrade nodejs version to 18.x (#8768) 2023-07-27 17:54:38 -03:00
Bruno Quaresma 3114a60e5c ci: optimize chromatic (#8776)
* Update ci.yaml

Modified the Chromatic job configuration to reduce snapshot usage and only run Chromatic on necessary UI changes.

Signed-off-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>

* fix fmt

---------

Signed-off-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>
Co-authored-by: Reuben Ellis <ethriel3695@gmail.com>
2023-07-27 15:51:26 -03:00
dependabot[bot] c236a29307 chore: bump google.golang.org/grpc from 1.56.2 to 1.57.0 (#8757)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-27 12:49:13 -05:00
Bruno Quaresma 4d36b859d2 refactor(site): make few ui changes on template insights (#8774) 2023-07-27 14:37:04 -03:00
Cian Johnston 5c9167df36 chore(helm): update sample resource requests/limits (#8773)
The sample resource requests/limits are undersized.
2023-07-27 13:28:06 -04:00
dependabot[bot] ca710e52b6 chore: bump google.golang.org/api from 0.133.0 to 0.134.0 (#8756)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-27 16:50:18 +00:00
Yinon Avraham de60bff88e chore(docs): small fixes in JFrog integration docs (#8736) 2023-07-27 11:46:06 -05: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
Kyle Carberry ff794e4b23 chore: add e2e test for backwards ssh compatibility (#8761)
* chore: add e2e test for backwards ssh compatibility

* Use the SSH client directly

* fmt
2023-07-27 10:42:11 -05:00
Ben Potter 34dfbfa9d3 ci: add DB to PR deploys (#8770)
* ci: add DB to PR deploys

* add bitnami remo

* fix namespace

* change ingress host

* remove wildcard host
2023-07-27 14:50:53 +00:00
dependabot[bot] 975424b3a2 chore: bump the eslint group in /site with 5 updates (#8636)
* chore: bump the eslint group in /site with 5 updates

Bumps the eslint group in /site with 5 updates:

| Package | Update |
| --- | --- |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | 5.62.0 to 6.1.0 |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | 5.62.0 to 6.1.0 |
| [eslint](https://github.com/eslint/eslint) | 8.44.0 to 8.45.0 |
| [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) | 7.31.1 to 7.33.0 |
| [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) | 47.0.0 to 48.0.0 |


Updates `@typescript-eslint/eslint-plugin` from 5.62.0 to 6.1.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.1.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 5.62.0 to 6.1.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.1.0/packages/parser)

Updates `eslint` from 8.44.0 to 8.45.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.44.0...v8.45.0)

Updates `eslint-plugin-react` from 7.31.1 to 7.33.0
- [Release notes](https://github.com/jsx-eslint/eslint-plugin-react/releases)
- [Changelog](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jsx-eslint/eslint-plugin-react/compare/v7.31.1...v7.33.0)

Updates `eslint-plugin-unicorn` from 47.0.0 to 48.0.0
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v47.0.0...v48.0.0)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: eslint
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: eslint
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: eslint-plugin-react
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: eslint
...

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

* ignore no-redundant-type-constituents

* Fix minor lint errors

* Discard changes to site/.eslintrc.yaml

* Fix redudant types

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Atif Ali <atif@coder.com>
Co-authored-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>
Co-authored-by: Muhammad Atif Ali <matifali@live.com>
2023-07-27 10:51:18 -03:00
Muhammad Atif Ali 92798e957f chore: bump typescript from 4.8.2 to 5.1.6 in /site (#8688) 2023-07-27 10:21:38 -03:00
Muhammad Atif Ali f6c36d903e ci: prevent running deploy on all comments (#8767) 2023-07-27 13:00:00 +00:00
Muhammad Atif Ali 3761205bae ci: further improve pr deployments (#8764) 2023-07-27 12:40:59 +00:00
Bruno Quaresma e85b88ca90 feat(site): add restart button when workspace is unhealthy (#8765) 2023-07-27 09:20:24 -03:00
Bruno Quaresma f54d385266 feat(site): add auto mode on create workspace form (#8651) 2023-07-27 08:47:58 -03:00
Muhammad Atif Ali bc55ffdf0d ci: improve deploy-pr workflow (#8735) 2023-07-27 13:07:53 +03: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 74c4553a3f fix(codersdk): always dial agents with WorkspaceAgentIP (#8760) 2023-07-27 03:44:44 +00:00
dependabot[bot] 7b08be8000 chore: bump google.golang.org/api from 0.132.0 to 0.133.0 (#8746)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 18:53:06 -05:00
Colin Adler 2811ab62d0 chore: fix workspace proxy flake (#8755) 2023-07-26 23:50:25 +00:00
Colin Adler 5cfa7082d1 chore: attempt to fix windows goleak failures (#8753) 2023-07-26 18:50:13 -05:00
Colin Adler 6af1f6a9d9 chore: fix Test_parseInsightsStartAndEndTime test (#8754) 2023-07-26 23:27:30 +00:00
Colin Adler dd2f79995b chore(tailnet): rewrite coordinator debug using html/template (#8752) 2023-07-26 22:54:21 +00:00
Ammar Bandukwala 02550a9062 fix(cli): apply log-filter to debug logs only (#8751) 2023-07-26 22:31:41 +00:00
Kyle Carberry 131babfb00 fix: request trial after password is validated (#8750) 2023-07-26 22:04:15 +00:00
Ammar Bandukwala 25e30c6f41 feat(cli): support fine-grained server log filtering (#8748) 2023-07-26 16:46:22 -05:00
Bruno Quaresma 4e9e480cc6 fix(site): fix latency values (#8749) 2023-07-26 17:14:45 -03:00
Ammar Bandukwala f28bac1b05 chore(scripts): use fake semver when using sapling (#8747)
The fact that the Sapling commit didn't conform to semver
broke the agent handshake with coderd.
2023-07-26 20:00:21 +00:00
Colin Adler 6b92abebb9 fix(tailnet): track agent names for http debug (#8744) 2023-07-26 18:44:10 +00:00
Bruno Quaresma b5dec61cd5 feat(site): show metadata stale data (#8745) 2023-07-26 15:41:07 -03:00
Dean Sheather 9ffbdc6696 hotfix: fix failed 32-bit builds (#8741) 2023-07-26 17:30:47 +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 70692c2e4e fix: unify parameter validation errors (#8738) 2023-07-26 17:44:50 +02:00
Steven Masley 2089006fbc feat!: drop reading other 'user' permission (#8650)
* feat: drop reading other 'user' permission

Members of the platform can no longer read or list other users.
Resources that have "created_by" or "initiated_by" still retain
user context, but only include username and avatar url.

Attempting to read a user found via those means will result in
a 404.

* Hide /users page for regular users
* make groups a privledged endpoint
* Permissions page for template perms
* Admin for a given template enables an endpoint for listing users/groups.
2023-07-26 10:33:48 -04:00
Bruno Quaresma 8649a10441 feat(site): add template insights page (#8722) 2023-07-26 13:13:56 +00:00
Muhammad Atif Ali da7e1eb75d ci: add a missing end quote (#8734) 2023-07-26 00:39:00 +00:00
Muhammad Atif Ali 0b5a01aa1b test: fix comments in deploy-pr.yaml (#8733) 2023-07-26 00:06:59 +00:00
Muhammad Atif Ali 26264bd3ef test: remove erroneous quotes from deploy-pr.yaml (#8732) 2023-07-25 23:16:57 +00:00
Muhammad Atif Ali 2c7d8ee06a fix: remove the usage of -u flag (#8731) 2023-07-25 22:54:42 +00:00
Colin Adler f07d2ff68d fix(enterprise): ensure creating a SCIM user is idempotent (#8730) 2023-07-25 17:49:52 -05:00
Muhammad Atif Ali 0feb855b8f fix: revert back to curl in deply-pr.yaml (#8729) 2023-07-25 22:40:26 +00:00
Muhammad Atif Ali 733ae5038a fix: a small issue with pr_deploy.yaml (#8728) 2023-07-25 22:15:44 +00:00
Muhammad Atif Ali 86d4c4ff0e test: improve pr deployments (#8720) 2023-07-26 00:56:38 +03:00
Muhammad Atif Ali 844ef76d39 fix: handle issue_comment event (#8726) 2023-07-25 19:52:44 +00:00
Muhammad Atif Ali 67f1123808 use gh cli (#8725) 2023-07-25 19:35:28 +00:00
Ammar Bandukwala ee652d525d docs: explain how to install the JFrog VS Code extension (#8724) 2023-07-25 18:06:30 +00:00
Muhammad Atif Ali 7447bfa320 fix: checkout correct branch for PR deployment (#8721) 2023-07-25 16:08:44 +00:00
Bruno Quaresma dfb1a1df3a feat(site): add terminal icon (#8719) 2023-07-25 11:41:29 -03: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
Steven Masley de1a7a9210 chore: join user information to workspace_build and template_version (#8625)
* include minimial user on template version and build
* Add unit test to ensure join is superset
2023-07-25 09:14:38 -04:00
Bruno Quaresma fbb2a6a434 refactor(coderd): add avatar URL to the users' latency endpoint (#8701) 2023-07-25 12:15:46 +02:00
Marcin Tojek 7004013537 chore: update nix flake to include sqlc v1.19.1 (#8715) 2023-07-25 09:09:16 +00:00
Ammar Bandukwala f6f61dfa26 docs: fix duplicate sentence (#8712)
Resolves #8664
2023-07-25 02:22:41 +00:00
Ammar Bandukwala b8e792bf8a chore: make update-golden-files (#8711)
One of the recent helm changes snuck in CI breakage.
2023-07-25 01:18:53 +00:00
Ammar Bandukwala 5eb825155e docs: slightly improve wording in jfrog.md (#8709) 2023-07-24 20:05:54 -05:00
Ammar Bandukwala a0f478c02f docs: cleanup jfrog (#8708)
* Add a missing requirement
* Improve English
2023-07-24 19:29:30 -05:00
Ammar Bandukwala 8686b7a499 docs: explain JFrog integration 🐸 (#8682) 2023-07-24 23:16:09 +00:00
Eric Paulsen 29963433ee feat(helm)!: set enableDeployments default to true (#8704) 2023-07-24 17:13:28 -05:00
Eric Paulsen 353bfb618c fix: missing manifest for deployment logs doc (#8703) 2023-07-24 17:12:48 -05:00
Ben Potter adbabe4e09 fix: hide experiment CTA from OIDC copy (#8695) 2023-07-24 14:51:28 -05:00
Steven Masley ac559f101e fix: handle omitted role sync claim (#8697)
* fix: handle omitted role sync claim
2023-07-24 15:50:23 -04:00
Bruno Quaresma ac973a4b2c fix(site): fix error 'Reduce of empty array with no initial value' (#8700) 2023-07-24 14:17:27 -03:00
Ammar Bandukwala c32085ca10 chore(scripts): handle Sapling in version.sh (#8687) 2023-07-24 11:11:46 -05:00
Muhammad Atif Ali 6929792a58 docs: add coder-logstream-kube docs and update k8s example template (#8675)
* docs: add kubestream docs and update example template

* make fmt

* add to template's README

* add the seperate page

* make fmt

* make fmt

* add namespace to deployment resource

* fmt

* add screenshots

* link docs in template

* Add remaining examples

* enable deployments requirement

* Update deployment-logs.md

* rewording

* fix spelling

* how?

* cleanup

* Update docs/platforms/kubernetes/deployment-logs.md

Co-authored-by: Ben Potter <ben@coder.com>

* suggestions

* use online link

* refine

---------

Co-authored-by: Eric <ericpaulsen@coder.com>
Co-authored-by: Ben Potter <ben@coder.com>
2023-07-24 11:51:25 -04:00
Marcin Tojek b7ced94f0f fix: prevent repetition of template IDs in template_usage_by_day (#8693) 2023-07-24 15:07:01 +02: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
dependabot[bot] 94541d201f chore: bump react-chartjs-2 in /site from 4.3.1 to 5.2.0 (#8632)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-07-24 14:44:14 +03:00
dependabot[bot] 75265ecf68 chore: bump fs-extra from 10.1.0 to 11.1.1 in /offlinedocs (#8630)
Bumps [fs-extra](https://github.com/jprichardson/node-fs-extra) from 10.1.0 to 11.1.1.
- [Changelog](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jprichardson/node-fs-extra/compare/10.1.0...11.1.1)

---
updated-dependencies:
- dependency-name: fs-extra
  dependency-type: direct:production
  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>
2023-07-24 14:25:55 +03:00
dependabot[bot] 0f915e1e75 chore: bump @types/react-dom from 18.0.5 to 18.2.7 in /offlinedocs (#8671)
Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 18.0.5 to 18.2.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom)

---
updated-dependencies:
- dependency-name: "@types/react-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 11:21:33 +00:00
dependabot[bot] 625eef93c5 chore: bump next from 12.1.6 to 13.4.12 in /offlinedocs (#8669)
Bumps [next](https://github.com/vercel/next.js) from 12.1.6 to 13.4.12.
- [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.1.6...v13.4.12)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:production
  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>
2023-07-24 14:17:08 +03:00
dependabot[bot] c136fa9e52 chore: bump @types/react from 18.0.14 to 18.2.15 in /offlinedocs (#8672)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.0.14 to 18.2.15.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 14:16:57 +03:00
dependabot[bot] d54bc60842 chore: bump react-icons from 4.4.0 to 4.10.1 in /offlinedocs (#8673)
Bumps [react-icons](https://github.com/react-icons/react-icons) from 4.4.0 to 4.10.1.
- [Release notes](https://github.com/react-icons/react-icons/releases)
- [Commits](https://github.com/react-icons/react-icons/compare/v4.4.0...v4.10.1)

---
updated-dependencies:
- dependency-name: react-icons
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 14:16:44 +03:00
Muhammad Atif Ali 757ea68d4a ci: fmt, lint and build offlinedocs (#8642)
Co-authored-by: Dean Sheather <dean@deansheather.com>
2023-07-24 10:54:08 +00:00
Muhammad Atif Ali 87f07b9f2f ci: reduce duplication (#8692)
* ci: reduce duplication

* typo
2023-07-24 10:51:43 +00:00
Muhammad Atif Ali 196b29983b docs: fix a broken link (#8691) 2023-07-24 09:13:59 +00:00
Ammar Bandukwala c3b8898f0a fix(coderd/unhanger): de-duplicate logs (#8686)
The final warning just repeated previous lines.
2023-07-24 14:28:09 +10:00
Ammar Bandukwala c9ade6f6c5 chore: enforce that site icons are .svg (#8684) 2023-07-23 16:27:11 -05:00
Ammar Bandukwala d56bf52141 chore(scripts): support Sapling in project_root (#8685) 2023-07-23 15:59:49 -05:00
Ammar Bandukwala 9833cd32b3 Revert "chore(scripts): support sappling in project_root"
This reverts commit 6855735085.

This was pushed accidentally.
2023-07-23 19:40:28 +00:00
Ammar Bandukwala 6855735085 chore(scripts): support sappling in project_root 2023-07-23 19:34:44 +00:00
Muhammad Atif Ali 43cc5449a1 fix: fix a typo in deploy-pr.yaml (#8678) 2023-07-23 16:21:29 +00:00
Muhammad Atif Ali 30e86e0058 chore: do not deploy a PR on deleted comment (#8677)
* chore: improve deploy-pr.yaml

* Update pr-deploy.yaml

* make fmt
2023-07-23 19:06:24 +03:00
Muhammad Atif Ali e7330436c9 chore: insatll coder-logstream-kube for PR deployments (#8676) 2023-07-23 15:35:53 +00:00
Muhammad Atif Ali ec880f26b4 chore: enable deployments for PR deplyments (#8674) 2023-07-23 17:32:17 +03:00
Sebastiaan ten Pas a28883d9f0 fix: do not wait for devcontainer template volume claim bound (#8539) 2023-07-23 06:06:23 +00:00
dependabot[bot] 1cadfa4e4f chore: bump the storybook group in /site with 6 updates (#8635)
Bumps the storybook group in /site with 6 updates:

| Package | Update |
| --- | --- |
| [@storybook/addon-actions](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/actions) | 7.0.26 to 7.1.0 |
| [@storybook/addon-essentials](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/essentials) | 7.0.26 to 7.1.0 |
| [@storybook/addon-links](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/links) | 7.0.26 to 7.1.0 |
| [@storybook/addon-mdx-gfm](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/gfm) | 7.0.26 to 7.1.0 |
| [@storybook/react-vite](https://github.com/storybookjs/storybook/tree/HEAD/code/frameworks/react-vite) | 7.0.26 to 7.1.0 |
| [storybook](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/cli) | 7.0.26 to 7.1.0 |


Updates `@storybook/addon-actions` from 7.0.26 to 7.1.0
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.1.0/code/addons/actions)

Updates `@storybook/addon-essentials` from 7.0.26 to 7.1.0
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.1.0/code/addons/essentials)

Updates `@storybook/addon-links` from 7.0.26 to 7.1.0
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.1.0/code/addons/links)

Updates `@storybook/addon-mdx-gfm` from 7.0.26 to 7.1.0
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.1.0/code/addons/gfm)

Updates `@storybook/react-vite` from 7.0.26 to 7.1.0
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.1.0/code/frameworks/react-vite)

Updates `storybook` from 7.0.26 to 7.1.0
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.1.0/code/lib/cli)

---
updated-dependencies:
- dependency-name: "@storybook/addon-actions"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: "@storybook/addon-essentials"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: "@storybook/addon-links"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: "@storybook/addon-mdx-gfm"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: "@storybook/react-vite"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
- dependency-name: storybook
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: storybook
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-23 01:00:42 +03:00
dependabot[bot] 9a7729d60f chore: bump @testing-library/jest-dom from 5.16.5 to 5.17.0 in /site (#8670)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.16.5 to 5.17.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.16.5...v5.17.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-22 21:46:39 +00:00
dependabot[bot] 82310896ad chore: bump eslint from 8.17.0 to 8.45.0 in /offlinedocs (#8631)
Bumps [eslint](https://github.com/eslint/eslint) from 8.17.0 to 8.45.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.17.0...v8.45.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-22 21:39:59 +00:00
dependabot[bot] aae7175a83 chore: bump @chakra-ui/react from 2.7.1 to 2.8.0 in /offlinedocs (#8633)
Bumps [@chakra-ui/react](https://github.com/chakra-ui/chakra-ui/tree/HEAD/packages/components/react) from 2.7.1 to 2.8.0.
- [Release notes](https://github.com/chakra-ui/chakra-ui/releases)
- [Changelog](https://github.com/chakra-ui/chakra-ui/blob/main/packages/components/react/CHANGELOG.md)
- [Commits](https://github.com/chakra-ui/chakra-ui/commits/@chakra-ui/react@2.8.0/packages/components/react)

---
updated-dependencies:
- dependency-name: "@chakra-ui/react"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-23 00:34:23 +03:00
dependabot[bot] e056d0243a chore: bump @tanstack/react-query from 4.29.19 to 4.32.0 in /site (#8668)
Bumps [@tanstack/react-query](https://github.com/tanstack/query) from 4.29.19 to 4.32.0.
- [Release notes](https://github.com/tanstack/query/releases)
- [Commits](https://github.com/tanstack/query/compare/v4.29.19...v4.32.0)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-22 21:33:18 +00:00
dependabot[bot] a9036ed02b chore: bump chromatic from 6.19.9 to 6.20.0 in /site (#8667)
Bumps [chromatic](https://github.com/chromaui/chromatic-cli) from 6.19.9 to 6.20.0.
- [Changelog](https://github.com/chromaui/chromatic-cli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chromaui/chromatic-cli/compare/v6.19.9...v6.20.0)

---
updated-dependencies:
- dependency-name: chromatic
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-22 21:31:50 +00:00
dependabot[bot] b7db4ee69f chore: bump eslint-config-next from 12.1.6 to 13.4.10 in /offlinedocs (#8629)
Bumps [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next) from 12.1.6 to 13.4.10.
- [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/commits/v13.4.10/packages/eslint-config-next)

---
updated-dependencies:
- dependency-name: eslint-config-next
  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>
2023-07-23 00:28:56 +03:00
Mathias Fredriksson e0c1aacac1 fix(coderd): fix template insight intervals (#8662) 2023-07-21 20:51:35 +00:00
Jyotirmoy Bandyopadhyaya 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
Bruno Quaresma 7f67000b90 fix(site): send build parameters over the confirmation dialog on restart (#8660) 2023-07-21 12:35:28 -06:00
Mathias Fredriksson 30fe153296 feat(coderd): add user latency and template insights endpoints (#8519)
Part of #8514
Refs #8109
2023-07-21 18:00:19 +00:00
Cian Johnston 539fcf9e6b chore(coderd/util/tz): skip flaky test (#8652) 2023-07-21 16:31:52 +00:00
Eric Paulsen 001670cc13 docs: add steps for postgres SSL cert config (#8648)
* docs: add steps for postgres SSL cert config

* make fmt

* Update docs/install/kubernetes.md

Co-authored-by: Cian Johnston <cian@coder.com>

* fixup! Update docs/install/kubernetes.md

---------

Co-authored-by: Cian Johnston <cian@coder.com>
2023-07-21 10:36:11 -04:00
Ben Potter 1a915f5b30 chore: improve workspace proxy copy (#8427)
* chore: workspace proxy copy

* fmt
2023-07-21 13:34:29 +00:00
Ben Potter 12b51ca804 ci: fix release notes compare link (#8581)
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-07-21 15:22:54 +03:00
Marcin Tojek c8772fba82 chore: update nix flake to include sqlc v1.19.0 (#8645) 2023-07-21 14:21:44 +02: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
dependabot[bot] 87d5cdaf58 chore: bump ts-proto from 1.153.2 to 1.156.0 in /site (#8637)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-21 10:49:25 +03:00
Colin Adler 2901147ae3 test: fix race in templateedit_test.go (#8641) 2023-07-21 03:26:55 +00:00
Jon Ayers b47d076756 feat: add deleting_at column to workspaces (#8333) 2023-07-20 22:01:11 -05:00
Muhammad Atif Ali 0c73164f15 chore: add offlinedocs to ts filter in ci.yaml (#8616) 2023-07-20 20:33:50 +00:00
dependabot[bot] 2d3d78b5b1 chore: bump google.golang.org/api from 0.131.0 to 0.132.0 (#8596)
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.131.0 to 0.132.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.131.0...v0.132.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-20 23:13:07 +03:00
Muhammad Atif Ali cc659163ef chore: add offlinedocs to depemdabot.yaml (#8617)
Add offlinedocs to depemdabot.yaml
2023-07-20 23:12:08 +03:00
Colin Adler 830020df15 fix(site): don't mark metadata with interval: 0 as stale (#8627) 2023-07-20 15:05:32 -05:00
Colin Adler 1cb39fc65d test: ignore more spurious pgcoord errors (#8628) 2023-07-20 19:55:25 +00:00
Colin Adler 71d4e4e6e8 fix(agent): check agent metadata every second instead of minute (#8614) 2023-07-20 14:02:58 -05:00
Colin Adler c8d65de4b7 test(agent): fix TestAgent_Metadata/Once flake (#8613) 2023-07-20 18:49:44 +00:00
Muhammad Atif Ali deb9261232 ci: allow running other jobs in the matrix if one of them fails (#8624) 2023-07-20 15:56:47 +00:00
Muhammad Atif Ali fd5d26d385 chore: prevent running chromatic on all merged PRs (#8623) 2023-07-20 15:18:02 +00:00
Bruno Quaresma 6de95f4f32 chore(site): remove build logs from experimental (#8619) 2023-07-20 15:02:19 +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
Ben Potter 4821e2e6d8 chore: add jq to base image (#8563)
* chore: add jq to base image

* fix formatting
2023-07-20 07:04:56 -05:00
Cian Johnston 68a46198d3 fix(scaletest): deploy external provisionerd (#8618)
* scaletest: stop kubernetes_secret from being constantly recreated
* scaletest: ensure we do not get auto-upgraded
* scaletest: add external provisionerd deployment, the lazy way
2023-07-20 11:38:46 +01:00
Marcin Tojek 9689bca5d2 feat(cli): implement ssh remote forward (#8515) 2023-07-20 12:05:39 +02:00
dependabot[bot] c68e80970d chore: bump semver from 6.3.0 to 6.3.1 in /offlinedocs (#8600)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-20 10:14:09 +03:00
dependabot[bot] bd5eb9dc1b chore: bump word-wrap from 1.2.3 to 1.2.4 in /offlinedocs (#8598)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-20 10:14:00 +03:00
dependabot[bot] b16901485e chore: bump json5 from 1.0.1 to 1.0.2 in /offlinedocs (#8599)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-20 10:13:27 +03:00
Colin Adler 39889179ea test(coderd): fix TestWorkspaceWatcher flake (#8612) 2023-07-19 18:03:56 -05:00
Jon Ayers 80b940c556 feat: support localhost apps running https (#8585) 2023-07-19 17:33:07 -05:00
Colin Adler 00b9a3ce58 fix: prevent error log when pgcoord query is canceled (#8609) 2023-07-19 16:40:57 -05:00
Steven Masley aceedefce3 chore: add template_with_user view to include user contextual data (#8568)
* chore: Refactor template sql queries to use new view
* TemplateWithUser -> Template
* Add unit test to enforce good view
2023-07-19 16:07:33 -04:00
Ben Potter cdbae29a83 fix: agent health copy (#8608)
* fix: agent health copy

* remove restart in place of upcoming button
2023-07-19 19:56:23 +00:00
Bruno Quaresma d96a6575af docs: add link to CODER_DOCS_URL (#8606) 2023-07-19 19:47:38 +00:00
Bruno Quaresma 16cd1a675c docs: add documentation about the offline docs (#8603) 2023-07-19 13:51:44 -05:00
Bruno Quaresma 0e52461624 feat(site): add support for custom docs url (#8601) 2023-07-19 15:27:38 -03:00
Colin Adler f8a2bd0f4d chore: remove duplicate logger name in wsproxy ServerTailnet (#8604) 2023-07-19 18:06:26 +00:00
Ben Potter b4bb77f2f3 hotfix: change permissions for /deploy-pr comment (#8597) 2023-07-19 17:02:51 +00:00
Bruno Quaresma acc12d3426 feat: add offline docs (#8527) 2023-07-19 13:57:57 -03:00
Marcin Tojek 164672e5d3 feat: expose docs URL via static meta (#8594) 2023-07-19 13:57:43 -03:00
Colin Adler 517fb19474 feat: add single tailnet support to moons (#8587) 2023-07-19 11:11:11 -05:00
Colin Adler cc8d0af027 fix(enterprise): avoid initial license reconfig if feature isn't enabled (#8586) 2023-07-19 10:32:29 -05: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
Josh Vawdrey 6318c4c09f feat(site): increase TTL and max TTL validation to 30 days (#8258)
Co-authored-by: Dean Sheather <dean@deansheather.com>
2023-07-19 23:43:10 +10:00
Marcin Tojek 4232a2eb96 feat: add custom docs URL to deployment config (#8590) 2023-07-19 08:31:17 -03:00
Eric Paulsen 164b816679 feat(helm): add commandArgs for custom entrypoint (#8567) 2023-07-19 00:50:52 +00:00
Mathias Fredriksson 611fbd8215 test(coderd): fix TestWorkspaceWatcher skipped pending state (#8584) 2023-07-18 21:58:50 +03:00
Bruno Quaresma d12221c782 feat(site): add build parameters option when starting or restarting a workspace (#8524) 2023-07-18 14:53:26 -03:00
Mathias Fredriksson 2fae9b0a69 chore(scripts/dbgen): only add arg validation for dbfake (#8578) 2023-07-18 17:26:03 +00: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
Mathias Fredriksson 58265881af test(testutil): increase wait times to reduce flakes (#8576) 2023-07-18 17:25:54 +03:00
Muhammad Atif Ali 9e170a7332 chore: add filebrowser to dogfood (#8535) 2023-07-18 17:04:00 +03: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
Muhammad Atif Ali 7d92537af5 chore: fix a typo dogfood.yaml (#8572) 2023-07-18 09:51:46 +00:00
Muhammad Atif Ali b012b4a810 chore: use commit title as template message in dogfood (#8570)
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-07-18 09:08:58 +00:00
Mathias Fredriksson d467160581 feat(cli): show workspace health in show (#8548) 2023-07-18 11:28:47 +03:00
dependabot[bot] 6b978bef71 chore: bump the github-actions group with 1 update (#8544)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-17 19:58:03 +00:00
Colin Adler fd7c019fff chore(coderd): require api key to access derpmap (#8569) 2023-07-17 19:40:12 +00:00
Bruno Quaresma a823ce7337 refactor(site): add sticky option to the build logs (#8565) 2023-07-17 14:58:25 -03:00
Bruno Quaresma 0bf1b01a9d fix(site): remove extra spacing on template variables page 2023-07-17 14:58:06 -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 854643236a chore(go.mod): update gvisor via github.com/coder/gvisor fork (#8561)
Fixes #7388
2023-07-17 16:09:26 +00:00
Muhammad Atif Ali bf5e0675fe chore: allow running multiple preview deployments in parallel (#8562) 2023-07-17 16:06:29 +00:00
Muhammad Atif Ali 0a56ea6916 chore: do not cancel in progress runs in pr-deploy.yaml (#8559) 2023-07-17 18:40:25 +03:00
Muhammad Atif Ali db8ba6cb68 chore: remove buggy comment reaction from deploy-pr.yaml (#8555) 2023-07-17 18:29:40 +03:00
Bruno Quaresma c83975cee0 fix(site): fix bottom border on build logs (#8554) 2023-07-17 11:57:24 -03:00
Bruno Quaresma 2218160e35 refactor(site): redirect the user to the workspace page after update parameters (#8553) 2023-07-17 11:26:24 -03:00
Steven Masley 67494a3012 chore: push GetUsers authorization filter to SQL (#8497)
* feat: push GetUsers filter to SQL
* Remove GetAuthorizedUserFilter
* Remove GetFilteredUserCount
* remove GetUsersWithCount
2023-07-17 09:44:58 -04:00
Mathias Fredriksson dfac0745f3 feat(cli): show workspace health in list (#8541)
Ref #6461
2023-07-17 15:04:06 +03:00
Alexander Hansen 616e1d7e9a Remove unmaintained 8Bitz0/coder-rust-template template (#8534) 2023-07-16 09:03:48 +00:00
sharkymark 3ea9699908 docs: added kubernetes option to workspace proxies (#8533) 2023-07-15 14:54:52 -05:00
Sebastiaan ten Pas dbc422f29e fix: devcontainer template workspace directory (#8530) 2023-07-15 09:04:51 +00:00
Muhammad Atif Ali ce114a7f9f chore: upgrade sqlc to 1.19.1 (#8511) 2023-07-15 09:07:19 +03:00
Dean Sheather 7a62534359 fix: allow unhanger to unhang canceling jobs (#8529) 2023-07-15 01:54:57 +00:00
Asher 7ed17b2605 fix: add some missing workspace updates (#7790)
* Standardize on function to get workspace channel name

There were two, now there is one.

* Add some missing workspace updates

There are some failure cases where we do not set the type as a workspace
build which causes the workspace update to never be published.

* Make build failures warnings

Otherwise the associated test fails due to the logger fataling on
error messages.
2023-07-14 15:07:48 -08:00
Ammar Bandukwala 970a829939 ci: relax stalebot (#8522)
\#6243 and others suggest the stalebot is too aggressive.
2023-07-14 16:38:04 +00:00
Cian Johnston 52b4563106 fix(scripts/develop.sh): use correct variables-file arg for template create (#8520) 2023-07-14 16:31:29 +00: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
Mathias Fredriksson 5fd77ad7cf test(agent): fix service banner and metadata intervals (#8516) 2023-07-14 16:10:26 +03:00
Marcin Tojek b7806fd216 fix(site): paginate audit logs (#8513) 2023-07-14 12:24:30 +02:00
dependabot[bot] 9aae983821 chore: bump @fontsource/ibm-plex-mono from 4.5.10 to 5.0.5 in /site (#8512)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-14 01:38:45 +03:00
Muhammad Atif Ali be1013899f chore: use names for all GitHub actions steps and use sqlc setup action (#8495) 2023-07-13 22:46:18 +03:00
Colin Adler 132f1d0eb5 chore: fuzzy match alpine terraform version (#8506) 2023-07-13 14:36:45 -05:00
Bruno Quaresma dc52df940b chore: update coder tf provider on dogfood (#8503) 2023-07-13 14:50:23 -03:00
Dean Sheather ecee3ceeec chore: improve listener algorithm in apptest (#8502) 2023-07-13 17:34:14 +00: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
dependabot[bot] 47d5806e2c chore: bump monaco-editor from 0.39.0 to 0.40.0 in /site (#8475)
Bumps [monaco-editor](https://github.com/microsoft/monaco-editor) from 0.39.0 to 0.40.0.
- [Changelog](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/monaco-editor/compare/v0.39.0...v0.40.0)

---
updated-dependencies:
- dependency-name: monaco-editor
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-13 11:13:26 -06:00
Steven Masley 3b433181be chore: add custom querier functions to dbgen (#8496)
* chore: add custom querier functions to dbgen
* chore: parse package was missing some imports, so force them
2023-07-13 13:12:29 -04:00
dependabot[bot] b650ab40f0 chore: bump @tanstack/react-query from 4.22.4 to 4.29.19 in /site (#8488)
Bumps [@tanstack/react-query](https://github.com/tanstack/query) from 4.22.4 to 4.29.19.
- [Release notes](https://github.com/tanstack/query/releases)
- [Commits](https://github.com/tanstack/query/compare/v4.22.4...v4.29.19)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-13 10:58:36 -06:00
Muhammad Atif Ali 9249309d8e docs: add docs to use remote Docker host (#8479)
Co-authored-by: Ben Potter <ben@coder.com>
2023-07-13 14:41:15 +00:00
Bruno Quaresma b833861960 feat(site): display version message (#8435) 2023-07-13 10:36:10 -03:00
Ben Potter 44e25185ff docs: add custom API use cases (#8445) 2023-07-13 13:24:09 +00:00
Marcin Tojek ebdc510f12 fix(site): delete workspace action in audit log (#8494) 2023-07-13 14:43:10 +02:00
dependabot[bot] 24ec05b5c5 chore: bump prettier from 2.8.1 to 3.0.0 in /site (#8477)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Cian Johnston <cian@coder.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-07-13 14:44:12 +03: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
Cian Johnston cdf9b9045f fix(scaletest/terraform): fix prometheus namespace deps, disable auto-upgrade (#8490)
* hotfix(scaletest/terraform): fix prometheus namespace deps, disable auto-upgrade

* fixup! hotfix(scaletest/terraform): fix prometheus namespace deps, disable auto-upgrade
2023-07-13 10:54:57 +01:00
Mathias Fredriksson 70047ffd15 chore(scripts): use slim and always run make in coder-dev.sh (#8418) 2023-07-13 11:51:53 +03:00
Muhammad Atif Ali f21541c0e4 chore: update gh cli in dogfood Dockerfile (#8489) 2023-07-13 11:49:43 +03:00
dependabot[bot] 837f88d38e chore: bump ts-proto from 1.152.0 to 1.153.2 in /site (#8486)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-13 09:07:48 +03:00
Colin Adler d7cbdbd9c6 chore: replace wsconncache with a single tailnet (#8176) 2023-07-12 17:38:25 -05:00
Colin Adler c47b78c44b chore: replace wsconncache with a single tailnet (#8176) 2023-07-12 17:37:31 -05:00
dependabot[bot] 0a37dd20d6 chore: bump google.golang.org/api from 0.130.0 to 0.131.0 (#8482)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-13 00:15:04 +03:00
dependabot[bot] ecda87060a chore: bump @octokit/types from 10.0.0 to 11.1.0 in /site (#8483)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 23:26:34 +03:00
dependabot[bot] 1bd188db66 chore: bump @emoji-mart/data from 1.0.5 to 1.1.2 in /site (#8484)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 23:22:56 +03:00
dependabot[bot] 79772f2f3f chore: bump @playwright/test from 1.35.1 to 1.36.0 in /site (#8476)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 22:45:24 +03:00
dependabot[bot] 7fc5cce356 chore: bump cronstrue from 2.27.0 to 2.28.0 in /site (#8478)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 22:44:35 +03:00
Colin Adler b5c17048c6 chore: upgrade github.com/codeclysm/extract to v3.1.1 (#8480) 2023-07-12 14:33:46 -05:00
Muhammad Atif Ali a0fedebd62 chore: rename dependabot groups (#8473) 2023-07-12 17:01:57 +00:00
ElioDiNino d502de8ca8 docs: fix git credentials file name (#8406) 2023-07-12 20:00:15 +03:00
Bruno Quaresma f8f4ae8e2c refactor(site): update build log to be displayed only on active statuses (#8459) 2023-07-12 13:34:07 -03:00
Mathias Fredriksson 29e4205abf ci(scripts): add support for --force in release.sh (#8469) 2023-07-12 16:31:13 +00:00
dependabot[bot] ffc28e6b93 chore: bump xterm in /site from 5.1.0 to 5.2.1 (#8465)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 18:35:32 +03:00
Colin Adler 1c3bfacca3 fix(cli): ensure cliui.Agent doesn't fetch infinitely (#8446) 2023-07-12 10:21:54 -05:00
dependabot[bot] 14caa9b7c1 chore: bump the npm-eslint group in /site with 3 updates (#8464)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 18:21:02 +03:00
dependabot[bot] b62798303c chore: bump just-debounce-it from 3.1.1 to 3.2.0 in /site (#8466)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 18:11:36 +03:00
dependabot[bot] d7eeb4118e chore: bump the npm-mui group in /site with 3 updates (#8460)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 15:04:08 +00:00
dependabot[bot] 49081e0383 chore: bump @emotion/react from 11.10.8 to 11.11.1 in /site (#8380)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 17:58:24 +03:00
dependabot[bot] 861efe7b50 chore: bump the npm-xstate group in /site with 3 updates (#8461)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 17:56:52 +03:00
Muhammad Atif Ali 765fd29336 chore: upgrade go version to 1.20.6 (#8457) 2023-07-12 17:27:17 +03:00
Ben Potter 280112a366 docs: add devcontainer templates (#8256)
* start

* start a template

* basic structure

* Update docs/templates/devcontainers.md

Co-authored-by: Sebastiaan ten Pas <sebastiaan@diggimedia.nl>

* Update examples/templates/devcontainer-docker/main.tf

Co-authored-by: Muhammad Atif Ali <atif@coder.com>

* add kubernetes template

* mention parameters

* fixups

* fixes from feedback

---------

Co-authored-by: Sebastiaan ten Pas <sebastiaan@diggimedia.nl>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-07-12 10:22:39 -04:00
Muhammad Atif Ali 19f58350f2 chore: group various npm dependencies (#8453) 2023-07-12 16:45:50 +03:00
Bruno Quaresma bff73ade6a feat(site): add warning for unhealthy workspace (#8422) 2023-07-12 10:27:25 -03:00
dependabot[bot] 86f89892c8 chore: bump msw from 1.1.0 to 1.2.2 in /site (#8440)
Bumps [msw](https://github.com/mswjs/msw) from 1.1.0 to 1.2.2.
- [Release notes](https://github.com/mswjs/msw/releases)
- [Changelog](https://github.com/mswjs/msw/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mswjs/msw/compare/v1.1.0...v1.2.2)

---
updated-dependencies:
- dependency-name: msw
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-12 10:26:51 -03:00
Mathias Fredriksson f6a8a5f7be fix(site): prevent ExtractAPIKey from dirtying the HTML output (#8450)
If `httpmw.ExtractAPIKey` fails when we are rendering an HTML page, the
HTML output will be dirtied with the error repsonse and the HTTP status
will also be wrong.

The use of this function in the `renderHTMLWithState` is additive, and
failure means we simply can't embed static data. To fix this, we can
simply pass a `http.ResponseWriter` that is no-op.

Fixes #8351
2023-07-12 15:38:30 +03:00
Steven Masley e9d7a230fa chore: server header specifies if wsproxy (#8432) 2023-07-12 12:07:36 +00:00
Steven Masley 928091aa05 feat!: add table format to 'coder license ls', 'license_expires' --> 'license_expires_human' (#8421)
* feat: add table format to 'coder license ls'
* feat: license expires_at to table view
* change: `license_expires` to `license_expires_human` and `license_expires` is unix timestamp
2023-07-12 08:06:18 -04:00
dependabot[bot] 2c2dd0eb83 chore: bump crate-ci/typos from v1.14.12 to v1.16.0 and fix typos (#8455)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-07-12 12:01:30 +00:00
Muhammad Atif Ali 7a210d941e chore: remove invalid dependabot config for example templates (#8452) 2023-07-12 14:33:57 +03:00
Spike Curtis b4057bd74a feat: make pgCoordinator generally available (#8419)
* pgCoord to GA, fix tests

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

* Fix generation and coordinator delete RBAC

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

* Fix fakeQuerier -> FakeQuerier

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-07-12 13:35:29 +04:00
dependabot[bot] 2e9f3e0a6b chore: bump the go-otel group with 4 updates (#8437)
Co-authored-by: Colin Adler <colin1adler@gmail.com>
2023-07-11 17:12:59 -05:00
dependabot[bot] 13b9ed3240 chore: bump google.golang.org/api from 0.129.0 to 0.130.0 (#8438)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 20:50:23 +00:00
Colin Adler 2c0f653aa8 chore(dogfood): give Asher more ram (#8442) 2023-07-11 15:24:29 -05:00
Marcin Tojek bc835dbf69 fix: use numeric comparison to check monotonicity (#8436) 2023-07-11 22:08:41 +02:00
Eric Paulsen d8d8eb2c8d docs: add note on recommended Azure LB (#8431) 2023-07-11 18:19:45 +00:00
Colin Adler 21597e2d69 chore: upgrade Go to 1.20.6 (#8433) 2023-07-11 13:06:34 -05:00
goodspark dd4aafb350 feat: add template info tags to coderd_agents_up metric (#7942)
Co-authored-by: Colin Adler <colin1adler@gmail.com>
2023-07-11 12:39:14 -05:00
Mathias Fredriksson 398e8fdf89 fix(coderd/httpmw): handle oauth config removed for existing auth (#8420)
This commit fixes an edge case tied to unexpired oauth logins where the
oauth provider is removed, the server restarted, and the users auth
expiring after the fact.

Refs #8351, #8352, #8390
2023-07-11 20:29:29 +03:00
Mathias Fredriksson e508d9aa6e fix(agent/usershell): check shell on darwin via dscl (#8366) 2023-07-11 20:27:50 +03:00
Mathias Fredriksson de1d04d7bb fix(dogfood): use gcr.io/coder-dev-1/alpine mirror to fix rate limit (#8424) 2023-07-11 20:27:07 +03:00
Steven Masley 704212e271 feat: expand wsproxy settings page by default (#8428)
* feat: wsproxy settings page expanded by default
* chore: warnings & defaults on proxy setting page start open
* always expanded
2023-07-11 13:15:11 -04:00
Steven Masley 0a911d58f9 chore: change workspace proxy badge names (#8429)
* chore: "Not Reachable" --> "Not Dialable"
* chore: "Not registered" --> "Never seen"
2023-07-11 13:05:42 -04:00
Steven Masley f67ccc9bc0 feat: add resource_target to audit log search (#8423)
* feat: add resource_target to audit log search
2023-07-11 13:05:21 -04:00
Muhammad Atif Ali 700ec966e3 chore: use dogfood-oss image in .devcontainer (#8231)
* use dogfood-oss image in devcontainer

* fix image name

* use Dockerfile

* Discard changes to dogfood/Dockerfile

* Use features to get docker in docker

* use previleged container

* use codercom/oss-dogfood image

* add `--priviliged` to fix GitHub Codespaces builds

* remove default options
2023-07-11 10:48:34 -04: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
Cian Johnston 3f6a158016 chore: enable exhaustruct linter (#8403)
* chore: enable exhaustruct linter

* add exlusion rules

* move to allowlist instead

* exhaustruct httpmw package

* fixup! exhaustruct httpmw package

* make lint

* address PR comments
2023-07-11 14:30:33 +01:00
Mathias Fredriksson 75f62dc39d feat: add support for template version messages in api and cli (#8336) 2023-07-11 13:11:08 +03:00
Kyle Carberry b4a7fe3221 fix: use expires_in field for git device refresh (#8411)
This was causing git auth to never refresh after the token
became expired after 8hrs.
2023-07-11 09:28:52 +00:00
Colin Adler 9df80530d7 chore(cli): unhide netcheck command (#8412) 2023-07-10 21:38:02 -05:00
Bruno Quaresma d896b74fa2 feat(site): display build logs on workspace transitioning statuses (#8397) 2023-07-10 17:47:39 -03:00
dependabot[bot] b7641b219e chore: bump the golang-x group with 4 updates (#8400)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 15:33:17 -05:00
dependabot[bot] ff62f70f55 chore: bump ts-proto from 1.150.0 to 1.152.0 in /site (#8402)
Bumps [ts-proto](https://github.com/stephenh/ts-proto) from 1.150.0 to 1.152.0.
- [Release notes](https://github.com/stephenh/ts-proto/releases)
- [Changelog](https://github.com/stephenh/ts-proto/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stephenh/ts-proto/compare/v1.150.0...v1.152.0)

---
updated-dependencies:
- dependency-name: ts-proto
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 17:28:52 -03:00
dependabot[bot] 000d538ace chore: bump react-router-dom from 6.13.0 to 6.14.1 in /site (#8398)
Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.13.0 to 6.14.1.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.14.1/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 17:28:40 -03:00
Bruno Quaresma ecb99717ef refactor(site) re-design proxies table (#8410) 2023-07-10 17:01:59 -03:00
Bruno Quaresma 3c2ce4f52a refactor(site): adjust the proxy menu design (#8409) 2023-07-10 17:01:09 -03:00
Colin Adler ef836de330 fix: document workspace filter query param correctly (#8408) 2023-07-10 18:57:09 +00:00
dependabot[bot] cee8fde93d chore: bump tough-cookie from 4.1.2 to 4.1.3 in /site (#8384)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 13:36:48 -05:00
Muhammad Atif Ali bf8af90d5a chore: group golang.org/x/* dependencies (#8392) 2023-07-10 18:07:14 +03:00
Steven Masley 2ee406d7b6 feat: log out and redirect user when converting to oidc (#8347)
* feat: log out user on conver to oidc

Log out user and redirect to login page and log out user when
they convert to oidc.
2023-07-10 10:25:41 -04:00
Mathias Fredriksson 90a3debe3f fix(coderd): pass oauth configs to site (#8390) 2023-07-10 17:23:41 +03:00
dependabot[bot] 9a3d9053a0 chore: bump @types/uuid from 8.3.4 to 9.0.2 in /site (#8377)
Bumps [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/uuid) from 8.3.4 to 9.0.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/uuid)

---
updated-dependencies:
- dependency-name: "@types/uuid"
  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>
2023-07-10 11:11:54 -03:00
dependabot[bot] 19ec5789a4 chore: bump vite from 4.3.9 to 4.4.2 in /site (#8381)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.3.9 to 4.4.2.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.4.2/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 11:11:10 -03:00
Mathias Fredriksson 9a72ddf7d4 fix(enterprise/coderd): add missing fields to extract api key config (#8393) 2023-07-10 16:51:50 +03:00
Marcin Tojek 9f2a931eb8 feat(coderd): support ephemeral parameters (#8367) 2023-07-10 13:44:03 +02:00
Marcin Tojek 8f4157c28d chore: go mod tidy (#8389) 2023-07-10 11:27:24 +00:00
Mathias Fredriksson b73f9d8e86 feat: add computed workspace and agent health fields to the api (#8280) 2023-07-10 12:40:11 +03:00
dependabot[bot] eabf929676 chore: bump actions/checkout from 2 to 3 (#8382) 2023-07-09 01:43:44 +03:00
Ammar Bandukwala 0115adf9d7 chore(.golangci.yaml): make gocyclo slightly more sensitive (#8383) 2023-07-08 22:43:34 +00:00
Muhammad Atif Ali d19e679c20 chore: use dependabot groups (#8372) 2023-07-08 17:29:47 +03:00
Steven Masley a297a014d6 chore: improve error message for incorrect login type (#8349)
* chore: add better error in wrong login type
2023-07-07 11:33:31 -04:00
Cian Johnston c1ab5cf0ba fix(cli/clistat): better handle cgroups with no limits (#8373) 2023-07-07 15:49:36 +01:00
Steven Masley f75d497c41 chore: touch ups to wsproxy UX (#8350)
* chore: update wording on wsproxy help
* chore: show help if no fields specified in wsproxy edit
* chore: Add run command example to wsproxy create
* chore: remove localhost warning
* chore: navbar match page title
* chore: Add helper text to latency picker
* chore: add confirm delete to workspace proxy delete cli
* chore: add errors + warnings to workspace proxy table
2023-07-07 10:06:11 -04:00
Cian Johnston 396e5e9a60 chore(database): fix test flake in TestUserLastSeenFilter (#8369) 2023-07-07 14:28:45 +01:00
Bruno Quaresma 2baa34364a fix(site): resize terminal when alert is dismissed (#8368) 2023-07-07 10:19:39 -03:00
Marcin Tojek e088303382 feat!: drop LegacyVariableName from coder parameter (#8360) 2023-07-07 14:14:29 +02:00
Cian Johnston 4e42c33769 chore(Makefile): specify count=1 instead of cleaning test cache (#8359)
* chore(Makefile): specify count=1 instead of cleaning test cache

* Update Makefile

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* add comment to test-clean target

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2023-07-07 12:16:16 +01:00
Mathias Fredriksson 34c3f919dc fix(agent/agentssh): check for hushlogin via afero fs (#8358) 2023-07-07 13:30:23 +03:00
Cian Johnston 259453007e chore(Makefile): add test-race target (#8357)
* chore(Makefile): add test-race target

* fixup! chore(Makefile): add test-race target
2023-07-07 10:15:50 +00:00
Marcin Tojek 64687631aa feat: enable Terraform template-wide variables by default (#8334) 2023-07-07 11:49:02 +02: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
Colin Adler ccea595b39 chore: temporarily skip prisma scan (#8355) 2023-07-07 00:48:29 +00:00
Colin Adler 6079cda851 chore(dogfood): add docker compose (#8354) 2023-07-06 19:46:40 -05:00
Colin Adler 9a0ba1bdc3 fix(coderd): remove CREATE INDEX CONCURRENTLY from migrations (#8353) 2023-07-06 16:44:29 -05:00
Steven Masley 2ebd0ec6c5 fix: resolve nil pointer dereference on missing oauth config (#8352) 2023-07-06 16:46:22 -04: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
Muhammad Atif Ali 5bb6bc5571 chore: update fly.io example to remove deprecated parameters (#8194)
* chore: update fly.io example to remove deprecated parameters

* `make fmt`

* update provider version
2023-07-06 10:20:23 -04:00
Bruno Quaresma a33a255885 chore: upgrade node version on CI to match workspace version (#8340) 2023-07-06 14:04:29 +00:00
Colin Adler 33bdc23e1d chore(site): fix node vulnerabilities (#8330)
* chore: fix node vulnerabilities

https://github.com/advisories/GHSA-c2qf-rxjj-qqgw
https://github.com/advisories/GHSA-j8xg-fqg3-53r7

* fixup! chore: fix node vulnerabilities

* fixup! chore: fix node vulnerabilities

* fixup! chore: fix node vulnerabilities

* fixup! chore: fix node vulnerabilities

* fixup! chore: fix node vulnerabilities
2023-07-06 10:26:55 -03:00
Mathias Fredriksson 4a13c58077 test(pty/ptytest): fix error message on deadline exceeded (#8337) 2023-07-06 16:18:03 +03:00
Mathias Fredriksson 814534d6b7 fix(enterprise/audit): improve error message for missing action (#8335) 2023-07-06 15:43:32 +03: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
Mathias Fredriksson 1d746b901b fix(Makefile): add dbmock to swagger deps and improve performance (#8332) 2023-07-06 10:59:08 +03:00
Mathias Fredriksson 3f058f28e7 test(agent): use afero for motd tests to allow parallel execution (#8329) 2023-07-06 10:57:51 +03:00
Marcin Tojek c6fcd7ee93 fix: report failed CompletedJob (#8318) 2023-07-06 07:26:33 +00:00
Marcin Tojek 45eca671fe feat: delay pending-in-queue banner (#8309) 2023-07-06 09:13:25 +02:00
Ben Potter d843735c02 docs: explain Template inheritance with Terraform modules (#8328)
* docs: explain Template inheritance with Terraform modules

* make fmt & title renaming

---------

Co-authored-by: Eric <ericpaulsen@coder.com>
2023-07-05 15:06:16 -04:00
Colin Adler c0835c443d chore: pin terraform to 1.5.2 (#8322)
The Alpine ARM builders are no longer behind on releases.
2023-07-05 12:59:58 -05:00
Steven Masley 418c9b8743 docs: update template acl example params (#8320)
Param examples were unhelpful
2023-07-05 17:24:21 +00: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 d70e2d97de chore: use correct prettier version in ci (#8321)
Install prettier in package.json + yarn.lock. Global install was using incorrect version
2023-07-05 13:11:08 -04:00
Steven Masley 0f5a1ad480 feat: add spinner to latencies when refetching (#8278)
* feat: add spinner to latencies when refetching
2023-07-05 13:06:09 -04: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
Mathias Fredriksson 88c35d3f04 fix(pty): close output writer before reader on Windows to unblock close (#8299) 2023-07-05 15:25:07 +03:00
Colin Adler 59246e054f chore(dogfood): add libssl-dev to image (#8312) 2023-07-05 00:24:32 -05:00
sharkymark 65112ecc04 docs: update examples of IDEs: remove JetBrains Projector and add VS Code Server (#8310)
* docs: remove mention of jetbrains projector; add vs code server web IDE example

* fmt

---------

Co-authored-by: Ben <me@bpmct.net>
2023-07-04 13:27:49 +00:00
dependabot[bot] 647fd7699b chore: bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 (#8300)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.15.1 to 1.16.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.15.1...v1.16.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-03 13:00:37 -05:00
dependabot[bot] 865f49af35 chore: bump github.com/gohugoio/hugo from 0.114.1 to 0.115.0 (#8301)
Bumps [github.com/gohugoio/hugo](https://github.com/gohugoio/hugo) from 0.114.1 to 0.115.0.
- [Release notes](https://github.com/gohugoio/hugo/releases)
- [Changelog](https://github.com/gohugoio/hugo/blob/master/hugoreleaser.toml)
- [Commits](https://github.com/gohugoio/hugo/compare/v0.114.1...v0.115.0)

---
updated-dependencies:
- dependency-name: github.com/gohugoio/hugo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-03 13:00:31 -05:00
dependabot[bot] 2fc8a275fe chore: bump google.golang.org/api from 0.128.0 to 0.129.0 (#8303)
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.128.0 to 0.129.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.128.0...v0.129.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-03 13:00:15 -05:00
dependabot[bot] 82a6405bfa chore: bump golang.org/x/tools from 0.9.3 to 0.10.0 (#8304)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.9.3 to 0.10.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.9.3...v0.10.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-03 13:00:05 -05:00
Jon Ayers 4a9c8f407a feat: add auto-locking/deleting workspace based on template config (#8240) 2023-07-02 21:29:52 -05:00
dependabot[bot] 818c4a7f23 chore: bump yup from 0.32.11 to 1.2.0 in /site (#8287)
Bumps [yup](https://github.com/jquense/yup) from 0.32.11 to 1.2.0.
- [Release notes](https://github.com/jquense/yup/releases)
- [Changelog](https://github.com/jquense/yup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jquense/yup/compare/v0.32.11...v1.2.0)

---
updated-dependencies:
- dependency-name: yup
  dependency-type: direct:production
  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>
2023-07-02 10:32:43 -05:00
dependabot[bot] 2af41a439b chore: bump @vitejs/plugin-react from 2.1.0 to 4.0.1 in /site (#8288)
Bumps [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) from 2.1.0 to 4.0.1.
- [Release notes](https://github.com/vitejs/vite-plugin-react/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-react/commits/plugin-react@4.0.1/packages/plugin-react)

---
updated-dependencies:
- dependency-name: "@vitejs/plugin-react"
  dependency-type: direct:production
  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>
2023-07-02 10:32:36 -05:00
dependabot[bot] 2899b9431d chore: bump monaco-editor from 0.38.0 to 0.39.0 in /site (#8289)
Bumps [monaco-editor](https://github.com/microsoft/monaco-editor) from 0.38.0 to 0.39.0.
- [Changelog](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/microsoft/monaco-editor/compare/v0.38.0...v0.39.0)

---
updated-dependencies:
- dependency-name: monaco-editor
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-02 10:32:30 -05:00
dependabot[bot] c19541e28f chore: bump eslint-plugin-unicorn from 44.0.0 to 47.0.0 in /site (#8291)
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 44.0.0 to 47.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v44.0.0...v47.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  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>
2023-07-02 10:32:19 -05:00
Jon Ayers 681e2db9ec Revert "fix: add front-end fixes for minor workspace action bugs (#8252)" (#8286)
This reverts commit c569528fb7.
2023-06-30 20:26:38 -05:00
Muhammad Atif Ali 83bee35c36 chore: prevent running ci when other workflows are updated (#8285) 2023-06-30 22:38:50 +00:00
Muhammad Atif Ali dad4876e90 chore: react to deploy-pr comment (#8284) 2023-06-30 22:25:23 +00:00
Asher 6015319e9d feat: show service banner in SSH/TTY sessions (#8186)
* Allow workspace agents to get appearance
* Poll for service banner every two minutes
* Show service banner before MOTD if not quiet
2023-06-30 10:41:29 -08:00
Steven Masley eb0497ff82 feat: fetch proxy latencies at most once per 30s (#8277)
* feat: fetch proxy latencies at most once per 30s
2023-06-30 12:45:02 -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
Cian Johnston 1e8cc2ca8d feat: scaletest: scale down nodegroups by default (#8276)
* feat: allow scaling down scaletest environments

* fix bugged namespace deletion

* misc fixes to scaletest.sh

* destroy namespaces is a no-op as the cluster will be gone anyway
2023-06-30 16:07:47 +01:00
Cian Johnston a6bd85df38 feat: scaletest: add Grafana dashboard for scale testing (#8274)
* feat: scaletest: add Grafana dashboard for scale testing

Fixes #7600.

* make fmt
2023-06-30 14:04:46 +00:00
Kira Pilot c569528fb7 fix: add front-end fixes for minor workspace action bugs (#8252)
* fix: incorrect copy on inactivity_ttl field

* disabling locked fields unless inactivity TTL is set

* scoping inactivity dialog message to template

* fixed pluralization for inactivity dialog

* amending logic gate to show inactivity dialog

* fixed pagination bug
2023-06-30 09:45:44 -04:00
Steven Masley 9f76dab348 chore: Bump migration to remove conflict (#8273) 2023-06-30 13:12:40 +00:00
Cian Johnston 8b2d4b87fc fix: examples/lima: use new parameter name when creating template (#8272) 2023-06-30 12:45:47 +00: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
Cian Johnston 357f3b38f7 fix: scaletest: mount CODER_CACHE volume under /tmp (#8271)
Mounting the CODER_CACHE volume under /tmp/coder causes
template creation to fail due to read-only tmp dir.
2023-06-30 12:48:34 +01:00
Marcin Tojek 6639c69fad feat: add "display_order" column to coder_parameter to keep parameters sorted in UI (#8227) 2023-06-30 12:41:55 +02:00
Colin Adler 72a48bee52 fix: pin datadog-ci version (#8270) 2023-06-30 03:42:13 +00: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
Eric Paulsen 7f82eca64a docs: note SSH key location in workspaces (#8264) 2023-06-29 12:01:07 -04:00
Cian Johnston 7072b8eff5 chore: update scaletest terraform with latest findings (#8249)
Updates scaletest terraform with learnings from #8213:

- Increase max pods per node to 256
- Decrease CPU requests for test workspace to allow maxing out workspaces per node
- Explicitly set CODER_ACCESS_URL for ssh to work
- Explicitly disable rate limits in coderd
- Increase DB size for medium and large scenarios
- Mount cache volume directly under /tmp/coder instead of /tmp.
- Plumb through requests and limits for workspaces
- Plumb through requests for coderd
2023-06-29 14:03:11 +00:00
Marcin Tojek 83fee4b192 feat: enable Terraform debug mode via deployment configuration (#8260) 2023-06-29 15:22:21 +02:00
Kira Pilot 7ca624eceb fix: removing prettier path in vscode config (#8255) 2023-06-29 09:00:51 -04:00
Jon Ayers 749307ef08 feat: provide endpoint to lock/unlock workspace (#8239) 2023-06-28 16:12:49 -05:00
Steven Masley 72e83df578 hotfix: fix broken link in the group sync docs (#8251) 2023-06-28 13:55:50 -04:00
Marcin Tojek 3dbc96d597 feat: show queue position of pending workspace build (#8244) 2023-06-28 14:48:58 +02:00
Mathias Fredriksson d3c39b60c9 feat: add agent log streaming and follow provisioner format (#8170) 2023-06-28 10:54:13 +02:00
Spike Curtis c0a01ec81c fix: fix TestPGCoordinatorDual_Mainline flake (#8228)
* fix TestPGCoordinatorDual_Mainline flake

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

* use slices.Contains instead of local function

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-28 11:37:45 +04:00
Eric Paulsen df95cf7ab2 feat: helm rbac perms for deployments (#8233) 2023-06-27 15:14:39 -04:00
Colin Adler b8a143566b fix: use *string instead of error in healthcheck response (#8234) 2023-06-27 19:13:54 +00:00
Asher e2e07b01e9 fix: revert to canvas renderer for xterm (#8138)
The default changed from canvas to DOM in the last update.  The canvas
renderer resolves line spacing issues and has better performance, as
well as bringing us back to the previous status quo.

In the new version the canvas is enabled via an addon.
2023-06-27 09:57:16 -08:00
Mathias Fredriksson b4751c72d8 fix(cli/agent): wrap lumberjack logger to prevent re-open (#8229) 2023-06-27 12:49:44 +00:00
Mathias Fredriksson 6d176aee5d test(agent): fix lifecycle test flakeyness (#8230) 2023-06-27 12:44:16 +00:00
Muhammad Atif Ali 25decc152a chore: fix broken docs links (#8198)
* chore: add examples templates to docs filter

* chore: fix broken docs links

* Discard changes to .github/workflows/ci.yaml
2023-06-27 08:20:57 -04:00
Ben Potter 70cd87140d docs: mark agent metadata as GA (#8111)
* docs: agent metadata is now GA

* fmt
2023-06-27 07:35:01 -04:00
Muhammad Atif Ali 9cefd46bcf chore: delete skipped workflow runs of pr-deploy.yaml (#8225) 2023-06-27 14:26:21 +03:00
Marcin Tojek b83cdfe428 chore: update nix flake to include sqlc v1.18.0 (#8226) 2023-06-27 12:50:04 +02:00
Spike Curtis 7943a5b85e fix PG coordinator context and RBAC subject (#8223)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-27 10:14:31 +00:00
Spike Curtis 5d26637686 feat(scaletest): add license and experiment to scaletest (#8222)
* add license and experiment to scaletest

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

* appease lint & fmt

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-27 10:13:36 +00:00
Muhammad Atif Ali 96435ee2ce chore: fix condition in pr-deploy.yaml (#8224) 2023-06-27 09:59:15 +00:00
dependabot[bot] c969da469d chore: bump semver from 7.3.7 to 7.5.2 in /site (#8162)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-27 12:54:19 +03:00
Muhammad Atif Ali b4ca285582 chore: ignore sub directories in examples for go files check (#8197)
There are no go files in any of the subdirectories in examples directory.
2023-06-27 00:35:09 +03:00
Steven Masley 140683813d chore: reword wsproxy help (#8168) 2023-06-26 12:32:47 -05:00
Mathias Fredriksson 31076ad665 fix(enterprise/coderd): prevent deadlock during entitlements update (#8215) 2023-06-26 20:22:28 +03:00
Steven Masley 56395410bd chore: disable auto proxy selection based on latency (#8137)
* chore: disable auto pick proxy based on latency

* Remove latency pulled from storage
2023-06-26 13:08:32 -04:00
Steven Masley 82415a6541 chore: add documentation to address common group sync errors (#8212)
* chore: Add documentation to address common group sync errors
2023-06-26 13:08:20 -04: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
dependabot[bot] 1558ef52f1 chore: bump github.com/gohugoio/hugo from 0.113.0 to 0.114.1 (#8201)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-26 10:48:39 -05:00
dependabot[bot] 98457e993b chore: bump github.com/valyala/fasthttp from 1.47.0 to 1.48.0 (#8204)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-26 15:40:21 +00:00
Kyle Carberry f40865bc2f chore: use mutex around blockEndpoints (#8209)
https://github.com/coder/coder/actions/runs/5378950122/jobs/9759972142
2023-06-26 10:01:50 -05:00
dependabot[bot] 4539ce7db6 chore: bump golang.org/x/oauth2 from 0.8.0 to 0.9.0 (#8203)
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.8.0 to 0.9.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-26 10:01:10 -05:00
Cian Johnston b8437ce453 fix(scaletest): adjust sessionAffinity and scenario resources (#8205)
* scaletest: adjust scenario resources
* scaletest: set sessionAffinity=None for coder service
2023-06-26 15:54:05 +01:00
Muhammad Atif Ali cfbe96a379 chore: return success if pr-cleanup.yaml faisl to find a PR image tag (#8208) 2023-06-26 14:47:10 +00:00
Marcin Tojek b4f14cc6a9 feat: include coder_parameters from external modules (#8195) 2023-06-26 13:46:30 +00:00
Muhammad Atif Ali 0a6e6442b8 chore: add examples templates to docs filter (#8196) 2023-06-26 09:48:23 +00:00
野漫横江 bdecf53413 Update additional-clusters.md (#8190)
Domain name should not be localhost
2023-06-25 15:41:17 +00:00
野漫横江 e27cfe6e6a docs: fix incorrect command in project documentation (#8191) 2023-06-25 15:12:10 +00:00
Dean Sheather 98a5ae7f48 feat: add provisioner job hang detector (#7927) 2023-06-25 13:17:00 +00:00
Eric Paulsen 3671846b1b docs: add default dir for VS Code Desktop (#8184) 2023-06-23 17:52:01 -05:00
Eric Paulsen 46df6c58bc docs: add max lifetime docs and refactor UI helper text (#8185) 2023-06-23 17:51:42 -05:00
Spike Curtis 5d48122f12 fix: fix PG Coordinator to update when heartbeats (re)start (#8178)
* fix: fix PG Coordinator to update when heartbeats (re)start

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

* rename resetExpiryTimer(WithLock)

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-23 10:38:58 +00:00
Spike Curtis ba9d038d42 feat: add periodic cleanup of PG Coordinator state (#8142)
* PG Coordinator cleans orphaned state

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

* Don't need pubsub

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-23 13:23:28 +04:00
Rodrigo Maia c594f02948 fix(site): display correct user_limit on license ui (#8118) 2023-06-23 08:38:36 +02: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
Marcin Tojek 5d45218a5d docs: application logs (#8166) 2023-06-22 23:25:17 +02:00
Mathias Fredriksson 3b9b06fe5a feat(codersdk/agentsdk): add StartupLogsSender and StartupLogsWriter (#8129)
This commit adds two new `agentsdk` functions, `StartupLogsSender` and
`StartupLogsWriter` that can be used by any client looking to send
startup logs to coderd.

We also refactor the `agent` to use these new functions.

As a bonus, agent startup logs are separated into "info" and "error"
levels to separate stdout and stderr.

---------

Co-authored-by: Marcin Tojek <mtojek@users.noreply.github.com>
2023-06-22 23:28:59 +03:00
Steven Masley f56db1b41b feat: add user search query param on last_seen (#8139)
* feat: add sql filter for before/after on last_seen column
2023-06-22 15:24:48 -05:00
Colin Adler 97945ae272 fix(scripts): properly shift for --build-base option (#8167) 2023-06-22 15:24:03 -05:00
Colin Adler 41e7216df7 chore: upgrade terraform to 1.5.1 (#8160) 2023-06-22 19:08:40 +00:00
Marcin Tojek 8e2422d42c feat: use named loggers in coderd (#8148) 2023-06-22 20:09:33 +02:00
Muhammad Atif Ali 1417c12229 ci: get PR number correctly from pull_request event (#8158) 2023-06-22 17:19:14 +00:00
Muhammad Atif Ali 2c046ef475 ci: use single quotes when we have backticks in title (#8159) 2023-06-22 16:57:44 +00:00
Muhammad Atif Ali f4a712b271 ci: delete old workflow runs for pr-cleanup.yaml(#8146) 2023-06-22 19:16:06 +03:00
Muhammad Atif Ali ea4b9a4354 ci: fix syntax issue in pr-deploy.yaml (#8154) 2023-06-22 16:06:15 +00:00
Muhammad Atif Ali eee4f835ec ci: fix wrong trigger pr-deploy.yaml (#8151) 2023-06-22 18:29:27 +03:00
Muhammad Atif Ali 1ffc8058c2 ci: deploy automatic PR deployments on request (#8121) 2023-06-22 14:35:58 +00:00
Spike Curtis e856491476 feat: enable PG Coordinator as experiment (#8144)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-22 13:12:29 +04:00
Spike Curtis e738123a9c chore: log ssh connection disconnects with errors (#8143)
Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-22 11:37:50 +04: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
Kyle Carberry 2a492b7008 chore: improve the setup experience with various fixes (#8130)
* Move updatecheck logs to debug mode

This was causing logs to be emitted immediately after
initial setup, which seemed odd for the user.

* Fix setup page text to say "Create" instead of "Setup" account

* Improve copy on the empty workspaces page

- This view can be seen after the user creates their first workspace, so saying first is bad.
- It should describe what a workspace is, so I modified the description.
- The create from template button wasn't helpful!

* Improve the copy for the empty templates view

- This didn't describe what a template actually is.
- The title had the same problem as workspaces, where first makes no sense.

* Improve text consistency on the Create Template page

* Fix "View activity" displaying for non-Enterprise users

This was causing an exception to be thrown.

* Improve messaging of empty groups view

* Appropriately capitalize Workspace and Template

* Improve Docker template taglines

* Fix types
2023-06-21 18:23:59 -05:00
Dean Sheather a28d422c35 feat: add flag to disable all direct connections (#7936) 2023-06-21 22:02:05 +00:00
Asher 96f9e61ca1 Strip CORS headers from applications (#8057)
The problem is that the headers get doubled up (not overwritten) and
browsers do not like multiple values for the allowed origin even though
it appears the spec allows for it.

We could prefer the application's headers instead of ours but since we
control OPTIONS I think preferring ours will by the more consistent
experience and also aligns with the original RFC.
2023-06-21 13:41:27 -08: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
Colin Adler 7703bb77a7 ci: update sqlc version in security scan (#8135) 2023-06-21 13:53:41 -05:00
Eric Paulsen a0d0e0e72d docs: add coder ping example for troubleshooting (#8133) 2023-06-21 18:07:24 +00:00
Bruno Quaresma 1faed639c4 fix(site): show error when parameter is invalid (#8125) 2023-06-21 11:39:28 -03:00
Bruno Quaresma bce8a983fe chore(site): remove new filter from experimental (#8112) 2023-06-21 10:20:37 -03:00
Spike Curtis cc17d2feea refactor: add postgres tailnet coordinator (#8044)
* postgres tailnet coordinator

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

* Fix db migration; tests

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

* Add fixture, regenerate

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

* Fix fixtures

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

* review comments, run clean gen

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

* Rename waitForConn -> cleanupConn

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

* code review updates

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

* db migration order

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

* fix log field name last_heartbeat

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

* fix heartbeat_from log field

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

* fix slog fields for linting

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-21 16:20:58 +04:00
Marcin Tojek 4fb4c9b270 chore: add more rules to ensure logs consistency (#8104) 2023-06-21 12:00:38 +02:00
Spike Curtis 1c8f564fdb feat: add logging of ssh connections to agent (#8096)
* feat: adds logging of ssh connections to agent

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

* code review improvements

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2023-06-21 13:49:58 +04:00
Colin Adler 4a431b6eb8 feat(helm): add coder.command to control pod command (#8116) 2023-06-20 22:59:01 +00:00
Colin Adler 15cba05dfc ci: scan images with sysdig (#8037) 2023-06-20 22:58:17 +00:00
Eric Paulsen b398814ab0 docs: add prometheus scrape_config example (#8113)
* docs: add prometheus scrape_config example

* make: fmt

* add: label

* fix: spelling

* scheme: http
2023-06-20 21:09:35 +00:00
Colin Adler 7d43f4ceee chore: update dogfood image (#8114) 2023-06-20 15:08:15 -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 bbb0fab1de chore: merge database gen scripts (#8073)
* chore: merge database gen scripts

* Fix type params gen

* Merge enum into dbgen
2023-06-20 16:24:33 +00:00
Kyle Carberry f3b2009499 chore: reorder helm chart to improve ux (#8108)
It makes no sense that the primary option `env` was so far
below infrequently used options.
2023-06-20 16:23:56 +00: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 823127e761 feat: add healthcheck database section (#8060) 2023-06-20 15:13:22 +00:00
Bruno Quaresma 2db4488337 fix(site): fix filters errors display (#8103) 2023-06-20 12:08:05 -03:00
Mathias Fredriksson ea4b7d60d7 fix(agent): refactor trackScriptLogs to avoid deadlock (#8084)
During agent close it was possible for the startup script logs consumer
to enter a deadlock state where by agent close was waiting via
`a.trackConnGoroutine` and the log reader for a flush event.

This refactor removes the mutex in favor of channel communication and
relies on two goroutines without shared state.
2023-06-20 18:05:11 +03: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
Bruno Quaresma a47a9b1cfe fix(site): prevent filter input update when focused (#8102) 2023-06-20 13:46:04 +00:00
Mathias Fredriksson b8ba287128 fix: disable websocket compression for startup logs in Safari (#8087) 2023-06-20 16:29:32 +03:00
Bruno Quaresma c3781d95b4 fix(site): fix build logs route (#8100) 2023-06-20 13:24:48 +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
Mathias Fredriksson 8dac0356ed refactor: replace startup script logs EOF with starting/ready time (#8082)
This commit reverts some of the changes in #8029 and implements an
alternative method of keeping track of when the startup script has ended
and there will be no more logs.

This is achieved by adding new agent fields for tracking when the agent
enters the "starting" and "ready"/"start_error" lifecycle states. The
timestamps simplify logic since we don't need understand if the current
state is before or after the state we're interested in. They can also be
used to show data like how long the startup script took to execute. This
also allowed us to remove the EOF field from the logs as the
implementation was problematic when we returned the EOF log entry in the
response since requesting _after_ that ID would give no logs and the API
would thus lose track of EOF.
2023-06-20 14:41:55 +03: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
Jon Ayers c3aef9363b feat: add locked TTL field to template meta (#8020) 2023-06-19 22:37:55 -04:00
dependabot[bot] 1ecc371ade chore: bump google.golang.org/grpc from 1.55.0 to 1.56.0 (#8079)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.55.0 to 1.56.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.55.0...v1.56.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-19 20:48:05 -05:00
Mathias Fredriksson af45e64b1d chore(coderd/database/gen): improve generated fake stub (#8088)
* chore(coderd/database/gen): generate arg validation where applicable
* fix(coderd/database/gen): support pointers and slices as return types
2023-06-20 00:05:26 +03:00
Kyle Carberry f444100aa6 feat: add region querying to pre-fetched html (#8077) 2023-06-19 11:23:26 -05:00
dependabot[bot] e083cbca6a chore: bump golang.org/x/mod from 0.10.0 to 0.11.0 (#8078)
Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.10.0 to 0.11.0.
- [Commits](https://github.com/golang/mod/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-19 10:00:37 -05:00
dependabot[bot] 020c6fb71e chore: bump google.golang.org/api from 0.127.0 to 0.128.0 (#8080)
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.127.0 to 0.128.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.127.0...v0.128.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-19 10:00:21 -05:00
dependabot[bot] 456ad85ce3 chore: bump golang.org/x/crypto from 0.9.0 to 0.10.0 (#8081)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.9.0 to 0.10.0.
- [Commits](https://github.com/golang/crypto/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-19 10:00:13 -05:00
Kyle Carberry 5b9c3784bc docs: add steps for registering a github app with coder (#7976)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-06-18 14:01:37 -05:00
Kyle Carberry 9df9ad4503 feat: embed common client requests into the template html (#8076)
This should reduce the number of API requests a client makes
when loading the dashboard dramatically!
2023-06-18 13:57:27 -05:00
Kyle Carberry 2a10c9127f fix: show git provider id instead of type (#8075)
Fixes #6343.
2023-06-18 17:01:44 +00:00
Ammar Bandukwala ca6b9e9368 chore: use robust RNG in cryptorand (#8040) 2023-06-17 17:33:40 -05:00
Montasser abd majid ZEHRI c8e67833f5 docs: add oidc keycloak docs (#8042)
* adding docs for keycloak to solve the problem with the refraish token

* fmt
2023-06-16 10:18:26 -05:00
Mathias Fredriksson 0c5077464b fix: avoid missed logs when streaming startup logs (#8029)
* feat(coderd,agent): send startup log eof at the end

* fix(coderd): fix edge case in startup log pubsub

* fix(coderd): ensure startup logs are closed on lifecycle state change (fallback)

* fix(codersdk): fix startup log channel shared memory bug

* fix(site): remove the EOF log line
2023-06-16 17:14:22 +03: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 751c0505bf chore: add benchmark for prometheusmetrics.MetricsAggregator (#8066)
* add benchmark for prom metrics aggregator

* fixup! add benchmark for prom metrics aggregator

* make fmt
2023-06-16 14:04:28 +01:00
Colin Adler 3ec2e96ff4 chore: tidy up grafana example dashboard (#8056) 2023-06-15 14:22:31 -05:00
dependabot[bot] 137b51e2c7 chore: bump cronstrue from 2.21.0 to 2.27.0 in /site (#7851)
Bumps [cronstrue](https://github.com/bradymholt/cronstrue) from 2.21.0 to 2.27.0.
- [Release notes](https://github.com/bradymholt/cronstrue/releases)
- [Changelog](https://github.com/bradymholt/cRonstrue/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bradymholt/cronstrue/compare/v2.21.0...v2.27.0)

---
updated-dependencies:
- dependency-name: cronstrue
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-06-15 14:34:00 -03:00
Bruno Quaresma e4d23ff5fe fix(site): add test and fix username params in terminal (#8052) 2023-06-15 13:18:19 -03:00
Bruno Quaresma f61001d049 chore(docs): optimize images (#8047) 2023-06-15 10:49:47 -03:00
dependabot[bot] 33c0674d76 chore: bump react-router-dom from 6.4.1 to 6.12.1 in /site (#7950)
* chore: bump react-router-dom from 6.4.1 to 6.12.1 in /site

Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.4.1 to 6.12.1.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.12.1/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* fix what needs to be fixed

* fix storybook

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>
2023-06-15 10:34:49 -03: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
Mathias Fredriksson 3f81f38fcc ci: fix commit type prefix regexp in release script (#8046)
Previously we were incorrectly categorizing `fix(a/b): ...` as other
because the regexp only expected letters, not `/`. Now we accept any
input within the parenthesis.

---------

Co-authored-by: Cian Johnston <cian@coder.com>
2023-06-15 10:57:18 +00:00
Cian Johnston b1588fa596 fix(helm): use /healthz for liveness and readiness probes instead of /api/v2/buildinfo (#8035) 2023-06-15 10:08:48 +01:00
Eric Paulsen 977e9ef505 docs: add steps for configuring trusted headers & origins in Helm chart (#8031) 2023-06-14 16:20:40 -04:00
Kyle Carberry 8ac68c95a4 chore: lazily initialize find commands in makefile (#8030)
Improves make performance for small targets!
2023-06-14 13:17:16 -05:00
Bruno Quaresma af06e80949 fix(site): fix footer year (#8036) 2023-06-14 14:59:33 -03: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
Bruno Quaresma cbd49abfcd fix(site): resize terminal when dismissing warning (#8028) 2023-06-14 14:40:55 -03: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
3216 changed files with 305742 additions and 111370 deletions
-83
View File
@@ -1,83 +0,0 @@
FROM ubuntu
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV EDITOR=vim
RUN apt-get update && apt-get upgrade --yes
RUN apt-get install --yes \
ca-certificates \
bash-completion \
build-essential \
curl \
cmake \
direnv \
emacs-nox \
gnupg \
htop \
jq \
less \
lsb-release \
lsof \
man-db \
nano \
neovim \
ssl-cert \
sudo \
unzip \
xz-utils \
zip
# configure locales to UTF8
RUN apt-get install locales && locale-gen en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
# configure direnv
RUN direnv hook bash >> $HOME/.bashrc
# install nix
RUN sh <(curl -L https://nixos.org/nix/install) --daemon
RUN mkdir -p $HOME/.config/nix $HOME/.config/nixpkgs \
&& echo 'sandbox = false' >> $HOME/.config/nix/nix.conf \
&& echo '{ allowUnfree = true; }' >> $HOME/.config/nixpkgs/config.nix \
&& echo '. $HOME/.nix-profile/etc/profile.d/nix.sh' >> $HOME/.bashrc
# install docker and configure daemon to use vfs as GitHub codespaces requires vfs
# https://github.com/moby/moby/issues/13742#issuecomment-725197223
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
&& echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install --yes docker-ce docker-ce-cli containerd.io docker-compose-plugin \
&& mkdir -p /etc/docker \
&& echo '{"cgroup-parent":"/actions_job","storage-driver":"vfs"}' >> /etc/docker/daemon.json
# install golang and language tooling
ENV GO_VERSION=1.20
ENV GOPATH=$HOME/go-packages
ENV GOROOT=$HOME/go
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
RUN curl -fsSL https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz | tar xzs
RUN echo 'export PATH=$GOPATH/bin:$PATH' >> $HOME/.bashrc
RUN bash -c ". $HOME/.bashrc \
go install -v golang.org/x/tools/gopls@latest \
&& go install -v mvdan.cc/sh/v3/cmd/shfmt@latest \
&& go install -v github.com/mikefarah/yq/v4@v4.30.6 \
"
# install nodejs
RUN bash -c "$(curl -fsSL https://deb.nodesource.com/setup_14.x)" \
&& apt-get install -y nodejs
# install zstd
RUN bash -c "$(curl -fsSL https://raw.githubusercontent.com/horta/zstd.install/main/install)"
# install nfpm
RUN echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list \
&& apt update \
&& apt install nfpm
+9 -20
View File
@@ -1,24 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json
{
"name": "Development environments on your infrastructure",
"image": "codercom/oss-dogfood:latest",
// Sets the run context to one level up instead of the .devcontainer folder.
"context": ".",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerFile": "Dockerfile",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"postStartCommand": "dockerd",
// privileged is required by GitHub codespaces - https://github.com/microsoft/vscode-dev-containers/issues/727
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined",
"--privileged",
"--init"
]
"features": {
// See all possible options here https://github.com/devcontainers/features/tree/main/src/docker-in-docker
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"moby": "false"
}
},
// SYS_PTRACE to enable go debugging
"runArgs": ["--cap-add=SYS_PTRACE"]
}
+6
View File
@@ -0,0 +1,6 @@
# Ignore all files and folders
**
# Include flake.nix and flake.lock
!flake.nix
!flake.lock
+5
View File
@@ -0,0 +1,5 @@
# If you would like `git blame` to ignore commits from this file, run...
# git config blame.ignoreRevsFile .git-blame-ignore-revs
# chore: format code with semicolons when using prettier (#9555)
988c9af0153561397686c119da9d1336d2433fdd
+4
View File
@@ -1,5 +1,7 @@
# Generated files
coderd/apidoc/docs.go linguist-generated=true
docs/api/*.md linguist-generated=true
docs/cli/*.md linguist-generated=true
coderd/apidoc/swagger.json linguist-generated=true
coderd/database/dump.sql linguist-generated=true
peerbroker/proto/*.go linguist-generated=true
@@ -9,3 +11,5 @@ provisionersdk/proto/*.go linguist-generated=true
*.tfstate.json linguist-generated=true
*.tfstate.dot linguist-generated=true
*.tfplan.dot linguist-generated=true
site/src/api/typesGenerated.ts linguist-generated=true
site/src/pages/SetupPage/countries.tsx linguist-generated=true
+3 -47
View File
@@ -4,59 +4,15 @@ description: |
inputs:
version:
description: "The Go version to use."
default: "1.20.5"
default: "1.21.5"
runs:
using: "composite"
steps:
- name: Cache go toolchain
uses: buildjet/cache@v3
- name: Setup Go
uses: buildjet/setup-go@v4
with:
path: |
${{ runner.tool_cache }}/go/${{ inputs.version }}
key: gotoolchain-${{ runner.os }}-${{ inputs.version }}
restore-keys: |
gotoolchain-${{ runner.os }}-
- uses: buildjet/setup-go@v4
with:
# We do our own caching for implementation clarity.
cache: false
go-version: ${{ inputs.version }}
- name: Get cache dirs
shell: bash
run: |
set -x
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
# We split up GOMODCACHE from GOCACHE because the latter must be invalidated
# on code change, but the former can be kept.
- name: Cache $GOMODCACHE
uses: buildjet/cache@v3
with:
path: |
${{ env.GOMODCACHE }}
key: gomodcache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}
restore-keys: |
gomodcache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}-
gomodcache-${{ runner.os }}-
- name: Cache $GOCACHE
uses: buildjet/cache@v3
with:
path: |
${{ env.GOCACHE }}
# Job name must be included in the key for effective
# test cache reuse.
# The key format is intentionally different than GOMODCACHE, because any
# time a Go file changes we invalidate this cache, whereas GOMODCACHE
# is only invalidated when go.sum changes.
key: gocache-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
restore-keys: |
gocache-${{ runner.os }}-${{ github.job }}-
gocache-${{ runner.os }}-
- name: Install gotestsum
shell: bash
run: go install gotest.tools/gotestsum@latest
+21 -5
View File
@@ -1,15 +1,31 @@
name: "Setup Node"
description: |
Sets up the node environment for tests, builds, etc.
inputs:
directory:
description: |
The directory to run the setup in.
required: false
default: "site"
runs:
using: "composite"
steps:
- uses: buildjet/setup-node@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
node-version: 16.16.0
version: 8
- name: Setup Node
uses: buildjet/setup-node@v3
with:
node-version: 18.19.0
# See https://github.com/actions/setup-node#caching-global-packages-data
cache: "yarn"
cache-dependency-path: "site/yarn.lock"
cache: "pnpm"
cache-dependency-path: ${{ inputs.directory }}/pnpm-lock.yaml
- name: Install root node_modules
shell: bash
run: ./scripts/pnpm_install.sh
- name: Install node_modules
shell: bash
run: ./scripts/yarn_install.sh
run: ../scripts/pnpm_install.sh
working-directory: ${{ inputs.directory }}
+10
View File
@@ -0,0 +1,10 @@
name: Setup sqlc
description: |
Sets up the sqlc environment for tests, builds, etc.
runs:
using: "composite"
steps:
- name: Setup sqlc
uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: "1.25.0"
+11
View File
@@ -0,0 +1,11 @@
name: "Setup Terraform"
description: |
Sets up Terraform for tests, builds, etc.
runs:
using: "composite"
steps:
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.5.7
terraform_wrapper: false
+1 -1
View File
@@ -20,7 +20,7 @@ runs:
echo "No API key provided, skipping..."
exit 0
fi
npm install -g @datadog/datadog-ci
npm install -g @datadog/datadog-ci@2.21.0
datadog-ci junit upload --service coder ./gotests.xml \
--tags os:${{runner.os}} --tags runner_name:${{runner.name}}
env:
+40 -26
View File
@@ -8,7 +8,7 @@ updates:
timezone: "America/Chicago"
labels: []
commit-message:
prefix: "chore"
prefix: "ci"
ignore:
# These actions deliver the latest versions by updating the major
# release tag, so ignore minor and patch versions
@@ -24,6 +24,10 @@ updates:
update-types:
- version-update:semver-minor
- version-update:semver-patch
groups:
github-actions:
patterns:
- "*"
- package-ecosystem: "gomod"
directory: "/"
@@ -34,6 +38,7 @@ updates:
commit-message:
prefix: "chore"
labels: []
open-pull-requests-limit: 15
ignore:
# Ignore patch updates for all dependencies
- dependency-name: "*"
@@ -76,39 +81,48 @@ updates:
- dependency-name: "@types/node"
update-types:
- version-update:semver-major
open-pull-requests-limit: 15
groups:
site:
patterns:
- "*"
- package-ecosystem: "terraform"
directory: "/examples/templates"
- package-ecosystem: "npm"
directory: "/offlinedocs/"
schedule:
interval: "monthly"
time: "06:00"
timezone: "America/Chicago"
reviewers:
- "coder/ts"
commit-message:
prefix: "chore"
labels: []
ignore:
# Ignore patch updates for all dependencies
- dependency-name: "*"
update-types:
- version-update:semver-patch
# Ignore major updates to Node.js types, because they need to
# correspond to the Node.js engine version
- dependency-name: "@types/node"
update-types:
- version-update:semver-major
groups:
offlinedocs:
patterns:
- "*"
# Update dogfood.
- package-ecosystem: "terraform"
directory: "/dogfood/"
schedule:
interval: "weekly"
time: "06:00"
timezone: "America/Chicago"
commit-message:
prefix: "chore"
labels: []
ignore:
# We likely want to update this ourselves.
- dependency-name: "coder/coder"
# Update dogfood.
- package-ecosystem: "docker"
directory: "/dogfood/"
schedule:
interval: "weekly"
time: "06:00"
timezone: "America/Chicago"
commit-message:
prefix: "chore"
labels: []
- package-ecosystem: "terraform"
directory: "/dogfood/"
schedule:
interval: "weekly"
time: "06:00"
timezone: "America/Chicago"
commit-message:
prefix: "chore"
labels: []
ignore:
- dependency-name: "coder/coder"
+28
View File
@@ -0,0 +1,28 @@
app = "paris-coder"
primary_region = "cdg"
[experimental]
entrypoint = ["/bin/sh", "-c", "CODER_DERP_SERVER_RELAY_URL=\"http://[${FLY_PRIVATE_IP}]:3000\" /opt/coder wsproxy server"]
auto_rollback = true
[build]
image = "ghcr.io/coder/coder-preview:main"
[env]
CODER_ACCESS_URL = "https://paris.fly.dev.coder.com"
CODER_HTTP_ADDRESS = "0.0.0.0:3000"
CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com"
CODER_WILDCARD_ACCESS_URL = "*--apps.paris.fly.dev.coder.com"
CODER_VERBOSE = "true"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
[[vm]]
cpu_kind = "shared"
cpus = 2
memory_mb = 512
@@ -0,0 +1,28 @@
app = "sao-paulo-coder"
primary_region = "gru"
[experimental]
entrypoint = ["/bin/sh", "-c", "CODER_DERP_SERVER_RELAY_URL=\"http://[${FLY_PRIVATE_IP}]:3000\" /opt/coder wsproxy server"]
auto_rollback = true
[build]
image = "ghcr.io/coder/coder-preview:main"
[env]
CODER_ACCESS_URL = "https://sao-paulo.fly.dev.coder.com"
CODER_HTTP_ADDRESS = "0.0.0.0:3000"
CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com"
CODER_WILDCARD_ACCESS_URL = "*--apps.sao-paulo.fly.dev.coder.com"
CODER_VERBOSE = "true"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
[[vm]]
cpu_kind = "shared"
cpus = 2
memory_mb = 512
+28
View File
@@ -0,0 +1,28 @@
app = "sydney-coder"
primary_region = "syd"
[experimental]
entrypoint = ["/bin/sh", "-c", "CODER_DERP_SERVER_RELAY_URL=\"http://[${FLY_PRIVATE_IP}]:3000\" /opt/coder wsproxy server"]
auto_rollback = true
[build]
image = "ghcr.io/coder/coder-preview:main"
[env]
CODER_ACCESS_URL = "https://sydney.fly.dev.coder.com"
CODER_HTTP_ADDRESS = "0.0.0.0:3000"
CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com"
CODER_WILDCARD_ACCESS_URL = "*--apps.sydney.fly.dev.coder.com"
CODER_VERBOSE = "true"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
[[vm]]
cpu_kind = "shared"
cpus = 2
memory_mb = 512
+13
View File
@@ -0,0 +1,13 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: pr${PR_NUMBER}-tls
namespace: pr-deployment-certs
spec:
secretName: pr${PR_NUMBER}-tls
issuerRef:
name: letsencrypt
kind: ClusterIssuer
dnsNames:
- "${PR_HOSTNAME}"
- "*.${PR_HOSTNAME}"
+31
View File
@@ -0,0 +1,31 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: coder-workspace-pr${PR_NUMBER}
namespace: pr${PR_NUMBER}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: coder-workspace-pr${PR_NUMBER}
namespace: pr${PR_NUMBER}
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: coder-workspace-pr${PR_NUMBER}
namespace: pr${PR_NUMBER}
subjects:
- kind: ServiceAccount
name: coder-workspace-pr${PR_NUMBER}
namespace: pr${PR_NUMBER}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: coder-workspace-pr${PR_NUMBER}
+314
View File
@@ -0,0 +1,314 @@
terraform {
required_providers {
coder = {
source = "coder/coder"
}
kubernetes = {
source = "hashicorp/kubernetes"
}
}
}
provider "coder" {
}
variable "namespace" {
type = string
description = "The Kubernetes namespace to create workspaces in (must exist prior to creating workspaces)"
}
data "coder_parameter" "cpu" {
name = "cpu"
display_name = "CPU"
description = "The number of CPU cores"
default = "2"
icon = "/icon/memory.svg"
mutable = true
option {
name = "2 Cores"
value = "2"
}
option {
name = "4 Cores"
value = "4"
}
option {
name = "6 Cores"
value = "6"
}
option {
name = "8 Cores"
value = "8"
}
}
data "coder_parameter" "memory" {
name = "memory"
display_name = "Memory"
description = "The amount of memory in GB"
default = "2"
icon = "/icon/memory.svg"
mutable = true
option {
name = "2 GB"
value = "2"
}
option {
name = "4 GB"
value = "4"
}
option {
name = "6 GB"
value = "6"
}
option {
name = "8 GB"
value = "8"
}
}
data "coder_parameter" "home_disk_size" {
name = "home_disk_size"
display_name = "Home disk size"
description = "The size of the home disk in GB"
default = "10"
type = "number"
icon = "/emojis/1f4be.png"
mutable = false
validation {
min = 1
max = 99999
}
}
provider "kubernetes" {
config_path = null
}
data "coder_workspace" "me" {}
resource "coder_agent" "main" {
os = "linux"
arch = "amd64"
startup_script_timeout = 180
startup_script = <<-EOT
set -e
# install and start code-server
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
EOT
# The following metadata blocks are optional. They are used to display
# information about your workspace in the dashboard. You can remove them
# if you don't want to display any information.
# For basic resources, you can use the `coder stat` command.
# If you need more control, you can write your own script.
metadata {
display_name = "CPU Usage"
key = "0_cpu_usage"
script = "coder stat cpu"
interval = 10
timeout = 1
}
metadata {
display_name = "RAM Usage"
key = "1_ram_usage"
script = "coder stat mem"
interval = 10
timeout = 1
}
metadata {
display_name = "Home Disk"
key = "3_home_disk"
script = "coder stat disk --path $${HOME}"
interval = 60
timeout = 1
}
metadata {
display_name = "CPU Usage (Host)"
key = "4_cpu_usage_host"
script = "coder stat cpu --host"
interval = 10
timeout = 1
}
metadata {
display_name = "Memory Usage (Host)"
key = "5_mem_usage_host"
script = "coder stat mem --host"
interval = 10
timeout = 1
}
metadata {
display_name = "Load Average (Host)"
key = "6_load_host"
# get load avg scaled by number of cores
script = <<EOT
echo "`cat /proc/loadavg | awk '{ print $1 }'` `nproc`" | awk '{ printf "%0.2f", $1/$2 }'
EOT
interval = 60
timeout = 1
}
}
# code-server
resource "coder_app" "code-server" {
agent_id = coder_agent.main.id
slug = "code-server"
display_name = "code-server"
icon = "/icon/code.svg"
url = "http://localhost:13337?folder=/home/coder"
subdomain = false
share = "owner"
healthcheck {
url = "http://localhost:13337/healthz"
interval = 3
threshold = 10
}
}
resource "kubernetes_persistent_volume_claim" "home" {
metadata {
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}-home"
namespace = var.namespace
labels = {
"app.kubernetes.io/name" = "coder-pvc"
"app.kubernetes.io/instance" = "coder-pvc-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
"app.kubernetes.io/part-of" = "coder"
//Coder-specific labels.
"com.coder.resource" = "true"
"com.coder.workspace.id" = data.coder_workspace.me.id
"com.coder.workspace.name" = data.coder_workspace.me.name
"com.coder.user.id" = data.coder_workspace.me.owner_id
"com.coder.user.username" = data.coder_workspace.me.owner
}
annotations = {
"com.coder.user.email" = data.coder_workspace.me.owner_email
}
}
wait_until_bound = false
spec {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
storage = "${data.coder_parameter.home_disk_size.value}Gi"
}
}
}
}
resource "kubernetes_deployment" "main" {
count = data.coder_workspace.me.start_count
depends_on = [
kubernetes_persistent_volume_claim.home
]
wait_for_rollout = false
metadata {
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
namespace = var.namespace
labels = {
"app.kubernetes.io/name" = "coder-workspace"
"app.kubernetes.io/instance" = "coder-workspace-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
"app.kubernetes.io/part-of" = "coder"
"com.coder.resource" = "true"
"com.coder.workspace.id" = data.coder_workspace.me.id
"com.coder.workspace.name" = data.coder_workspace.me.name
"com.coder.user.id" = data.coder_workspace.me.owner_id
"com.coder.user.username" = data.coder_workspace.me.owner
}
annotations = {
"com.coder.user.email" = data.coder_workspace.me.owner_email
}
}
spec {
replicas = 1
selector {
match_labels = {
"app.kubernetes.io/name" = "coder-workspace"
}
}
strategy {
type = "Recreate"
}
template {
metadata {
labels = {
"app.kubernetes.io/name" = "coder-workspace"
}
}
spec {
security_context {
run_as_user = 1000
fs_group = 1000
}
service_account_name = "coder-workspace-${var.namespace}"
container {
name = "dev"
image = "bencdr/devops-tools"
image_pull_policy = "Always"
command = ["sh", "-c", coder_agent.main.init_script]
security_context {
run_as_user = "1000"
}
env {
name = "CODER_AGENT_TOKEN"
value = coder_agent.main.token
}
resources {
requests = {
"cpu" = "250m"
"memory" = "512Mi"
}
limits = {
"cpu" = "${data.coder_parameter.cpu.value}"
"memory" = "${data.coder_parameter.memory.value}Gi"
}
}
volume_mount {
mount_path = "/home/coder"
name = "home"
read_only = false
}
}
volume {
name = "home"
persistent_volume_claim {
claim_name = kubernetes_persistent_volume_claim.home.metadata.0.name
read_only = false
}
}
affinity {
// This affinity attempts to spread out all workspace pods evenly across
// nodes.
pod_anti_affinity {
preferred_during_scheduling_ignored_during_execution {
weight = 1
pod_affinity_term {
topology_key = "kubernetes.io/hostname"
label_selector {
match_expressions {
key = "app.kubernetes.io/name"
operator = "In"
values = ["coder-workspace"]
}
}
}
}
}
}
}
}
}
}
+38
View File
@@ -0,0 +1,38 @@
coder:
image:
repo: "${REPO}"
tag: "pr${PR_NUMBER}"
pullPolicy: Always
service:
type: ClusterIP
ingress:
enable: true
className: traefik
host: "${PR_HOSTNAME}"
wildcardHost: "*.${PR_HOSTNAME}"
tls:
enable: true
secretName: "pr${PR_NUMBER}-tls"
wildcardSecretName: "pr${PR_NUMBER}-tls"
env:
- name: "CODER_ACCESS_URL"
value: "https://${PR_HOSTNAME}"
- name: "CODER_WILDCARD_ACCESS_URL"
value: "*.${PR_HOSTNAME}"
- name: "CODER_EXPERIMENTS"
value: "${EXPERIMENTS}"
- name: CODER_PG_CONNECTION_URL
valueFrom:
secretKeyRef:
name: coder-db-url
key: url
- name: "CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS"
value: "true"
- name: "CODER_OAUTH2_GITHUB_CLIENT_ID"
value: "${PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID}"
- name: "CODER_OAUTH2_GITHUB_CLIENT_SECRET"
value: "${PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET}"
- name: "CODER_OAUTH2_GITHUB_ALLOWED_ORGS"
value: "coder"
- name: "CODER_DERP_CONFIG_URL"
value: "https://controlplane.tailscale.com/derpmap/default"
+503 -192
View File
@@ -14,7 +14,7 @@ permissions:
contents: read
deployments: none
issues: none
packages: none
packages: write
pull-requests: none
repository-projects: none
security-events: none
@@ -24,21 +24,29 @@ permissions:
# additional changes
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
changes:
runs-on: ubuntu-latest
outputs:
docs-only: ${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }}
docs: ${{ steps.filter.outputs.docs }}
go: ${{ steps.filter.outputs.go }}
ts: ${{ steps.filter.outputs.ts }}
k8s: ${{ steps.filter.outputs.k8s }}
ci: ${{ steps.filter.outputs.ci }}
db: ${{ steps.filter.outputs.db }}
offlinedocs-only: ${{ steps.filter.outputs.offlinedocs_count == steps.filter.outputs.all_count }}
offlinedocs: ${{ steps.filter.outputs.offlinedocs }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
- name: check changed files
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
@@ -47,8 +55,12 @@ jobs:
docs:
- "docs/**"
- "README.md"
# For testing:
# - ".github/**"
- "examples/web-server/**"
- "examples/monitoring/**"
- "examples/lima/**"
db:
- "**.sql"
- "coderd/database/**"
go:
- "**.sql"
- "**.go"
@@ -70,7 +82,7 @@ jobs:
- "cmd/**"
- "coderd/**"
- "enterprise/**"
- "examples/**"
- "examples/*"
- "provisioner/**"
- "provisionerd/**"
- "provisionersdk/**"
@@ -87,20 +99,30 @@ jobs:
- "scripts/Dockerfile.base"
- "scripts/helm.sh"
ci:
- ".github/**"
- ".github/actions/**"
- ".github/workflows/ci.yaml"
offlinedocs:
- "offlinedocs/**"
- id: debug
run: |
echo "${{ toJSON(steps.filter )}}"
lint:
needs: changes
if: needs.changes.outputs.offlinedocs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ./.github/actions/setup-go
- name: Setup Node
uses: ./.github/actions/setup-node
- uses: ./.github/actions/setup-node
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Get golangci-lint cache dir
run: |
@@ -109,7 +131,7 @@ jobs:
echo "LINT_CACHE_DIR=$dir" >> $GITHUB_ENV
- name: golangci-lint cache
uses: buildjet/cache@v3
uses: buildjet/cache@v4
with:
path: |
${{ env.LINT_CACHE_DIR }}
@@ -119,7 +141,7 @@ jobs:
# Check for any typos
- name: Check for typos
uses: crate-ci/typos@v1.14.12
uses: crate-ci/typos@v1.18.0
with:
config: .github/workflows/typos.toml
@@ -146,14 +168,19 @@ jobs:
needs: changes
if: needs.changes.outputs.docs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/setup-go
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Install sqlc
run: |
curl -sSL https://github.com/kyleconroy/sqlc/releases/download/v1.17.2/sqlc_1.17.2_linux_amd64.tar.gz | sudo tar -C /usr/bin -xz sqlc
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Setup sqlc
uses: ./.github/actions/setup-sqlc
- name: go install tools
run: |
@@ -161,20 +188,17 @@ jobs:
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/mikefarah/yq/v4@v4.30.6
go install github.com/golang/mock/mockgen@v1.6.0
go install go.uber.org/mock/mockgen@v0.4.0
- name: Install Protoc
run: |
# protoc must be in lockstep with our dogfood Dockerfile or the
# version in the comments will differ. This is also defined in
# security.yaml
set -x
cd dogfood
DOCKER_BUILDKIT=1 docker build . --target proto -t protoc
protoc_path=/usr/local/bin/protoc
docker run --rm --entrypoint cat protoc /tmp/bin/protoc > $protoc_path
chmod +x $protoc_path
protoc --version
mkdir -p /tmp/proto
pushd /tmp/proto
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
unzip protoc.zip
cp -r ./bin/* /usr/local/bin
cp -r ./include /usr/local/bin/include
popd
- name: make gen
run: "make --output-sync -j -B gen"
@@ -183,27 +207,28 @@ jobs:
run: ./scripts/check_unstaged.sh
fmt:
needs: changes
if: needs.changes.outputs.offlinedocs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
timeout-minutes: 5
timeout-minutes: 7
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: buildjet/setup-node@v3
uses: actions/checkout@v4
with:
node-version: 16.16.0
fetch-depth: 1
- uses: buildjet/setup-go@v4
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup Go
uses: buildjet/setup-go@v5
with:
# This doesn't need caching. It's super fast anyways!
cache: false
go-version: 1.20.5
- name: Install prettier
run: npm install -g prettier
go-version: 1.21.5
- name: Install shfmt
run: go install mvdan.cc/sh/v3/cmd/shfmt@v3.5.0
run: go install mvdan.cc/sh/v3/cmd/shfmt@v3.7.0
- name: make fmt
run: |
@@ -214,25 +239,28 @@ jobs:
run: ./scripts/check_unstaged.sh
test-go:
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'buildjet-4vcpu-ubuntu-2204' || matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'macos-latest-xl' || matrix.os == 'windows-2019' && github.repository_owner == 'coder' && 'windows-latest-8-cores' || matrix.os }}
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'buildjet-4vcpu-ubuntu-2204' || matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'macos-latest-xlarge' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-16-cores' || matrix.os }}
needs: changes
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-2019
- windows-2022
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-go
- uses: hashicorp/setup-terraform@v2
- name: Checkout
uses: actions/checkout@v4
with:
terraform_version: 1.1.9
terraform_wrapper: false
fetch-depth: 1
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Setup Terraform
uses: ./.github/actions/setup-tf
- name: Test with Mock Database
id: test
@@ -248,27 +276,36 @@ jobs:
echo "cover=false" >> $GITHUB_OUTPUT
fi
# if macOS, install google-chrome for scaletests. As another concern,
# should we really have this kind of external dependency requirement
# on standard CI?
if [ "${{ matrix.os }}" == "macos-latest" ]; then
brew install google-chrome
fi
# By default Go will use the number of logical CPUs, which
# is a fine default.
PARALLEL_FLAG=""
# macOS will output "The default interactive shell is now zsh"
# intermittently in CI...
if [ "${{ matrix.os }}" == "macos-latest" ]; then
touch ~/.bash_profile && echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile
fi
export TS_DEBUG_DISCO=true
gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" \
--packages="./..." -- $PARALLEL_FLAG -short -failfast $COVERAGE_FLAGS
- name: Print test stats
if: success() || failure()
run: |
# Artifacts are not available after rerunning a job,
# so we need to print the test stats to the log.
go run ./scripts/ci-report/main.go gotests.json | tee gotests_stats.json
- uses: ./.github/actions/upload-datadog
- name: Upload test stats to Datadog
timeout-minutes: 1
continue-on-error: true
uses: ./.github/actions/upload-datadog
if: success() || failure()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
- uses: codecov/codecov-action@v3
- name: Check code coverage
uses: codecov/codecov-action@v4
# This action has a tendency to error out unexpectedly, it has
# the `fail_ci_if_error` option that defaults to `false`, but
# that is no guarantee, see:
@@ -282,7 +319,8 @@ jobs:
test-go-pg:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
needs: changes
needs:
- changes
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
# This timeout must be greater than the timeout set by `go test` in
# `make test-postgres` to ensure we receive a trace of running
@@ -290,33 +328,32 @@ jobs:
# even if some of the preceding steps are slow.
timeout-minutes: 25
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-go
- uses: hashicorp/setup-terraform@v2
- name: Checkout
uses: actions/checkout@v4
with:
terraform_version: 1.1.9
terraform_wrapper: false
fetch-depth: 1
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Setup Terraform
uses: ./.github/actions/setup-tf
- name: Test with PostgreSQL Database
run: |
export TS_DEBUG_DISCO=true
make test-postgres
- name: Print test stats
if: success() || failure()
run: |
# Artifacts are not available after rerunning a job,
# so we need to print the test stats to the log.
go run ./scripts/ci-report/main.go gotests.json | tee gotests_stats.json
- uses: ./.github/actions/upload-datadog
- name: Upload test stats to Datadog
timeout-minutes: 1
continue-on-error: true
uses: ./.github/actions/upload-datadog
if: success() || failure()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
- uses: codecov/codecov-action@v3
- name: Check code coverage
uses: codecov/codecov-action@v4
# This action has a tendency to error out unexpectedly, it has
# the `fail_ci_if_error` option that defaults to `false`, but
# that is no guarantee, see:
@@ -334,122 +371,48 @@ jobs:
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
timeout-minutes: 25
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ./.github/actions/setup-go
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Setup Terraform
uses: ./.github/actions/setup-tf
- name: Run Tests
run: |
gotestsum --junitfile="gotests.xml" -- -race ./...
- uses: ./.github/actions/upload-datadog
- name: Upload test stats to Datadog
timeout-minutes: 1
continue-on-error: true
uses: ./.github/actions/upload-datadog
if: always()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
deploy:
name: "deploy"
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
timeout-minutes: 30
needs: changes
if: |
github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
&& needs.changes.outputs.docs-only == 'false'
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/573722524737/locations/global/workloadIdentityPools/github/providers/github
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- uses: ./.github/actions/setup-go
- uses: ./.github/actions/setup-node
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Install nfpm
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.16.0
- name: Install zstd
run: sudo apt-get install -y zstd
- name: Build Release
run: |
set -euo pipefail
go mod download
version="$(./scripts/version.sh)"
make gen/mark-fresh
make -j \
build/coder_"$version"_windows_amd64.zip \
build/coder_"$version"_linux_amd64.{tar.gz,deb}
- name: Install Release
run: |
set -euo pipefail
regions=(
# gcp-region-id instance-name systemd-service-name
"us-central1-a coder coder"
"australia-southeast1-b coder-sydney coder-workspace-proxy"
"europe-west3-c coder-europe coder-workspace-proxy"
"southamerica-east1-b coder-brazil coder-workspace-proxy"
)
deb_pkg="./build/coder_$(./scripts/version.sh)_linux_amd64.deb"
if [ ! -f "$deb_pkg" ]; then
echo "deb package not found: $deb_pkg"
ls -l ./build
exit 1
fi
gcloud config set project coder-dogfood
for region in "${regions[@]}"; do
echo "::group::$region"
set -- $region
set -x
gcloud config set compute/zone "$1"
gcloud compute scp "$deb_pkg" "${2}:/tmp/coder.deb"
gcloud compute ssh "$2" -- /bin/sh -c "set -eux; sudo dpkg -i --force-confdef /tmp/coder.deb; sudo systemctl daemon-reload; sudo service '$3' restart"
set +x
echo "::endgroup::"
done
- uses: actions/upload-artifact@v3
with:
name: coder
path: |
./build/*.zip
./build/*.tar.gz
./build/*.deb
retention-days: 7
test-js:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
needs: changes
if: needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ./.github/actions/setup-node
- name: Setup Node
uses: ./.github/actions/setup-node
- run: yarn test:ci --max-workers $(nproc)
- run: pnpm test:ci --max-workers $(nproc)
working-directory: site
- uses: codecov/codecov-action@v3
- name: Check code coverage
uses: codecov/codecov-action@v4
# This action has a tendency to error out unexpectedly, it has
# the `fail_ci_if_error` option that defaults to `false`, but
# that is no guarantee, see:
@@ -462,72 +425,114 @@ jobs:
flags: unittest-js
test-e2e:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-16vcpu-ubuntu-2204' || 'ubuntu-latest' }}
needs: changes
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/setup-go
- uses: hashicorp/setup-terraform@v2
- name: Checkout
uses: actions/checkout@v4
with:
terraform_version: 1.1.9
terraform_wrapper: false
fetch-depth: 1
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Setup Terraform
uses: ./.github/actions/setup-tf
- name: go install tools
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/mikefarah/yq/v4@v4.30.6
go install go.uber.org/mock/mockgen@v0.4.0
- name: Install Protoc
run: |
mkdir -p /tmp/proto
pushd /tmp/proto
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
unzip protoc.zip
cp -r ./bin/* /usr/local/bin
cp -r ./include /usr/local/bin/include
popd
- name: Build
run: |
sudo npm install -g prettier
make -B site/out/index.html
- run: yarn playwright:install
- run: pnpm playwright:install
working-directory: site
- run: yarn playwright:test
- run: pnpm playwright:test --workers 1
env:
DEBUG: pw:api
working-directory: site
- name: Upload Playwright Failed Tests
if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: failed-test-videos
path: ./site/test-results/**/*.webm
retention-days: 7
- name: Upload pprof dumps
if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
uses: actions/upload-artifact@v4
with:
name: debug-pprof-dumps
path: ./site/test-results/**/debug-pprof-*.txt
retention-days: 7
chromatic:
# REMARK: this is only used to build storybook and deploy it to Chromatic.
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
if: needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true'
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
# Required by Chromatic for build-over-build history, otherwise we
# only get 1 commit on shallow checkout.
fetch-depth: 0
- uses: ./.github/actions/setup-node
- name: Setup Node
uses: ./.github/actions/setup-node
# This step is not meant for mainline because any detected changes to
# storybook snapshots will require manual approval/review in order for
# the check to pass. This is desired in PRs, but not in mainline.
- name: Publish to Chromatic (non-mainline)
if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder'
uses: chromaui/action@v1
uses: chromaui/action@v10
env:
NODE_OPTIONS: "--max_old_space_size=4096"
STORYBOOK: true
with:
buildScriptName: "storybook:build"
# Do a fast, testing build for change previews
buildScriptName: "storybook:ci"
exitOnceUploaded: true
# This will prevent CI from failing when Chromatic detects visual changes
exitZeroOnChanges: true
# Chromatic states its fine to make this token public. See:
# https://www.chromatic.com/docs/github-actions#forked-repositories
projectToken: 695c25b6cb65
workingDir: "./site"
storybookBaseDir: "./site"
# Prevent excessive build runs on minor version changes
skip: "@(renovate/**|dependabot/**)"
# Run TurboSnap to trace file dependencies to related stories
# and tell chromatic to only take snapshots of relevent stories
onlyChanged: true
# Avoid uploading single files, because that's very slow
zip: true
# This is a separate step for mainline only that auto accepts and changes
# instead of holding CI up. Since we squash/merge, this is defensive to
@@ -537,19 +542,94 @@ jobs:
# infinitely "in progress" in mainline unless we re-review each build.
- name: Publish to Chromatic (mainline)
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
uses: chromaui/action@v1
uses: chromaui/action@v10
env:
NODE_OPTIONS: "--max_old_space_size=4096"
STORYBOOK: true
with:
autoAcceptChanges: true
# This will prevent CI from failing when Chromatic detects visual changes
exitZeroOnChanges: true
# Do a full build with documentation for mainline builds
buildScriptName: "storybook:build"
projectToken: 695c25b6cb65
workingDir: "./site"
storybookBaseDir: "./site"
# Run TurboSnap to trace file dependencies to related stories
# and tell chromatic to only take snapshots of relevent stories
onlyChanged: true
# Avoid uploading single files, because that's very slow
zip: true
offlinedocs:
name: offlinedocs
needs: changes
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
if: needs.changes.outputs.offlinedocs == 'true' || needs.changes.outputs.ci == 'true' || needs.changes.outputs.docs == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# 0 is required here for version.sh to work.
fetch-depth: 0
- name: Setup Node
uses: ./.github/actions/setup-node
with:
directory: offlinedocs
- name: Install Protoc
run: |
mkdir -p /tmp/proto
pushd /tmp/proto
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
unzip protoc.zip
cp -r ./bin/* /usr/local/bin
cp -r ./include /usr/local/bin/include
popd
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Install go tools
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/mikefarah/yq/v4@v4.30.6
go install go.uber.org/mock/mockgen@v0.4.0
- name: Setup sqlc
uses: ./.github/actions/setup-sqlc
- name: Format
run: |
cd offlinedocs
pnpm format:check
- name: Lint
run: |
cd offlinedocs
pnpm lint
- name: Build
run: |
make -j build/coder_docs_"$(./scripts/version.sh)".tgz
required:
runs-on: ubuntu-latest
needs: [fmt, lint, gen, test-go, test-go-pg, test-go-race, test-js]
needs:
- fmt
- lint
- gen
- test-go
- test-go-pg
- test-go-race
- test-js
- test-e2e
- offlinedocs
- sqlc-vet
# Allow this job to run even if the needed jobs fail, are skipped or
# cancelled.
if: always()
@@ -564,6 +644,8 @@ jobs:
echo "- test-go-pg: ${{ needs.test-go-pg.result }}"
echo "- test-go-race: ${{ needs.test-go-race.result }}"
echo "- test-js: ${{ needs.test-js.result }}"
echo "- test-e2e: ${{ needs.test-e2e.result }}"
echo "- offlinedocs: ${{ needs.offlinedocs.result }}"
echo
# We allow skipped jobs to pass, but not failed or cancelled jobs.
@@ -573,3 +655,232 @@ jobs:
fi
echo "Required checks have passed"
build:
# This builds and publishes ghcr.io/coder/coder-preview:main for each commit
# to main branch. We are only building this for amd64 platform. (>95% pulls
# are for amd64)
needs: changes
if: needs.changes.outputs.docs-only == 'false' && !github.event.pull_request.head.repo.fork
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
outputs:
IMAGE: ghcr.io/coder/coder-preview:${{ steps.build-docker.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: GHCR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Install nfpm
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.35.1
- name: Install zstd
run: sudo apt-get install -y zstd
- name: Build
run: |
set -euxo pipefail
go mod download
version="$(./scripts/version.sh)"
tag="main-$(echo "$version" | sed 's/+/-/g')"
echo "tag=$tag" >> $GITHUB_OUTPUT
make gen/mark-fresh
make -j \
build/coder_linux_{amd64,arm64,armv7} \
build/coder_"$version"_windows_amd64.zip \
build/coder_"$version"_linux_amd64.{tar.gz,deb}
- name: Build Linux Docker images
id: build-docker
env:
CODER_IMAGE_BASE: ghcr.io/coder/coder-preview
CODER_IMAGE_TAG_PREFIX: main
DOCKER_CLI_EXPERIMENTAL: "enabled"
run: |
set -euxo pipefail
# build Docker images for each architecture
version="$(./scripts/version.sh)"
tag="main-$(echo "$version" | sed 's/+/-/g')"
echo "tag=$tag" >> $GITHUB_OUTPUT
# build images for each architecture
make -j build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
# only push if we are on main branch
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
# build and push multi-arch manifest, this depends on the other images
# being pushed so will automatically push them
make -j push/build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
# Define specific tags
tags=("$tag" "main" "latest")
# Create and push a multi-arch manifest for each tag
# we are adding `latest` tag and keeping `main` for backward
# compatibality
for t in "${tags[@]}"; do
./scripts/build_docker_multiarch.sh \
--push \
--target "ghcr.io/coder/coder-preview:$t" \
--version $version \
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
done
fi
- name: Prune old images
if: github.ref == 'refs/heads/main'
uses: vlaurin/action-ghcr-prune@v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
organization: coder
container: coder-preview
keep-younger-than: 7 # days
keep-tags: latest
keep-tags-regexes: ^pr
prune-tags-regexes: |
^main-
^v
prune-untagged: true
- name: Upload build artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: coder
path: |
./build/*.zip
./build/*.tar.gz
./build/*.deb
retention-days: 7
deploy:
name: "deploy"
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- changes
- build
if: |
github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
&& needs.changes.outputs.docs-only == 'false'
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/573722524737/locations/global/workloadIdentityPools/github/providers/github
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Set up Flux CLI
uses: fluxcd/flux2/action@main
with:
# Keep this up to date with the version of flux installed in dogfood cluster
version: "2.2.1"
- name: Get Cluster Credentials
uses: "google-github-actions/get-gke-credentials@v2"
with:
cluster_name: dogfood-v2
location: us-central1-a
project_id: coder-dogfood-v2
- name: Reconcile Flux
run: |
set -euxo pipefail
flux --namespace flux-system reconcile source git flux-system
flux --namespace flux-system reconcile source git coder-main
flux --namespace flux-system reconcile kustomization flux-system
flux --namespace flux-system reconcile kustomization coder
flux --namespace flux-system reconcile source chart coder-coder
flux --namespace flux-system reconcile source chart coder-coder-provisioner
flux --namespace coder reconcile helmrelease coder
flux --namespace coder reconcile helmrelease coder-provisioner
# Just updating Flux is usually not enough. The Helm release may get
# redeployed, but unless something causes the Deployment to update the
# pods won't be recreated. It's important that the pods get recreated,
# since we use `imagePullPolicy: Always` to ensure we're running the
# latest image.
- name: Rollout Deployment
run: |
set -euxo pipefail
kubectl --namespace coder rollout restart deployment/coder
kubectl --namespace coder rollout status deployment/coder
kubectl --namespace coder rollout restart deployment/coder-provisioner
kubectl --namespace coder rollout status deployment/coder-provisioner
deploy-wsproxies:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy workspace proxies
run: |
flyctl deploy --image "$IMAGE" --app paris-coder --config ./.github/fly-wsproxies/paris-coder.toml --env "CODER_PROXY_SESSION_TOKEN=$TOKEN_PARIS" --yes
flyctl deploy --image "$IMAGE" --app sydney-coder --config ./.github/fly-wsproxies/sydney-coder.toml --env "CODER_PROXY_SESSION_TOKEN=$TOKEN_SYDNEY" --yes
flyctl deploy --image "$IMAGE" --app sao-paulo-coder --config ./.github/fly-wsproxies/sao-paulo-coder.toml --env "CODER_PROXY_SESSION_TOKEN=$TOKEN_SAO_PAULO" --yes
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
IMAGE: ${{ needs.build.outputs.IMAGE }}
TOKEN_PARIS: ${{ secrets.FLY_PARIS_CODER_PROXY_SESSION_TOKEN }}
TOKEN_SYDNEY: ${{ secrets.FLY_SYDNEY_CODER_PROXY_SESSION_TOKEN }}
TOKEN_SAO_PAULO: ${{ secrets.FLY_SAO_PAULO_CODER_PROXY_SESSION_TOKEN }}
# sqlc-vet runs a postgres docker container, runs Coder migrations, and then
# runs sqlc-vet to ensure all queries are valid. This catches any mistakes
# in migrations or sqlc queries that makes a query unable to be prepared.
sqlc-vet:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
needs: changes
if: needs.changes.outputs.db == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# We need golang to run the migration main.go
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Setup sqlc
uses: ./.github/actions/setup-sqlc
- name: Setup and run sqlc vet
run: |
make sqlc-vet
+7 -4
View File
@@ -25,7 +25,8 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v3
- name: auto-approve dependabot
uses: hmarr/auto-approve-action@v4
if: github.actor == 'dependabot[bot]'
cla:
@@ -33,7 +34,7 @@ jobs:
steps:
- name: cla
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
uses: contributor-assistant/github-action@v2.3.0
uses: contributor-assistant/github-action@v2.3.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# the below token should have repo scope and must be manually added by you in the repository's secret
@@ -45,14 +46,16 @@ jobs:
path-to-document: "https://github.com/coder/cla/blob/main/README.md"
# branch should not be protected
branch: "main"
allowlist: dependabot*
# Some users have signed a corporate CLA with Coder so are exempt from signing our community one.
allowlist: "coryb,aaronlehmann,dependabot*"
release-labels:
runs-on: ubuntu-latest
# Skip tagging for draft PRs.
if: ${{ github.event_name == 'pull_request_target' && success() && !github.event.pull_request.draft }}
steps:
- uses: actions/github-script@v6
- name: release-labels
uses: actions/github-script@v7
with:
# This script ensures PR title and labels are in sync:
#
+3 -2
View File
@@ -31,10 +31,11 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'coder'
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- name: Docker login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
+65 -20
View File
@@ -7,20 +7,26 @@ on:
paths:
- "dogfood/**"
- ".github/workflows/dogfood.yaml"
# Uncomment these lines when testing with CI.
# pull_request:
# paths:
# - "dogfood/**"
# - ".github/workflows/dogfood.yaml"
- "flake.lock"
- "flake.nix"
pull_request:
paths:
- "dogfood/**"
- ".github/workflows/dogfood.yaml"
- "flake.lock"
- "flake.nix"
workflow_dispatch:
jobs:
deploy_image:
runs-on: buildjet-4vcpu-ubuntu-2204
build_image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6.5
uses: tj-actions/branch-names@v8
- name: "Branch name to Docker tag name"
id: docker-tag-name
@@ -30,42 +36,80 @@ jobs:
tag=${tag//\//--}
echo "tag=${tag}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v2
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
- name: Build and push Non-Nix image
uses: depot/build-push-action@v1
with:
project: b4q6ltmpzh
token: ${{ secrets.DEPOT_TOKEN }}
buildx-fallback: true
context: "{{defaultContext}}:dogfood"
push: true
pull: true
save: true
push: ${{ github.ref == 'refs/heads/main' }}
tags: "codercom/oss-dogfood:${{ steps.docker-tag-name.outputs.tag }},codercom/oss-dogfood:latest"
cache-from: type=registry,ref=codercom/oss-dogfood:latest
cache-to: type=inline
- name: Build and push Nix image
uses: depot/build-push-action@v1
with:
project: b4q6ltmpzh
token: ${{ secrets.DEPOT_TOKEN }}
buildx-fallback: true
context: "."
file: "dogfood/Dockerfile.nix"
pull: true
save: true
push: ${{ github.ref == 'refs/heads/main' }}
tags: "codercom/oss-dogfood-nix:${{ steps.docker-tag-name.outputs.tag }},codercom/oss-dogfood-nix:latest"
deploy_template:
needs: deploy_image
needs: build_image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Terraform
uses: ./.github/actions/setup-tf
- name: Terraform init and validate
run: |
cd dogfood
terraform init -upgrade
terraform validate
- name: Get short commit SHA
if: github.ref == 'refs/heads/main'
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get latest commit title
if: github.ref == 'refs/heads/main'
id: message
run: echo "pr_title=$(git log --format=%s -n 1 ${{ github.sha }})" >> $GITHUB_OUTPUT
- name: "Get latest Coder binary from the server"
if: github.ref == 'refs/heads/main'
run: |
curl -fsSL "https://dev.coder.com/bin/coder-linux-amd64" -o "./coder"
chmod +x "./coder"
- name: "Push template"
if: github.ref == 'refs/heads/main'
run: |
./coder templates push $CODER_TEMPLATE_NAME --directory $CODER_TEMPLATE_DIR --yes --name=$CODER_TEMPLATE_VERSION
./coder templates push $CODER_TEMPLATE_NAME --directory $CODER_TEMPLATE_DIR --yes --name=$CODER_TEMPLATE_VERSION --message="$CODER_TEMPLATE_MESSAGE" --variable jfrog_url=${{ secrets.JFROG_URL }}
env:
# Consumed by Coder CLI
CODER_URL: https://dev.coder.com
@@ -74,3 +118,4 @@ jobs:
CODER_TEMPLATE_NAME: ${{ secrets.CODER_TEMPLATE_NAME }}
CODER_TEMPLATE_VERSION: ${{ steps.vars.outputs.sha_short }}
CODER_TEMPLATE_DIR: ./dogfood
CODER_TEMPLATE_MESSAGE: ${{ steps.message.outputs.pr_title }}
+15 -10
View File
@@ -16,14 +16,14 @@ jobs:
# so 0.016 * 240 = 3.84 USD per run.
timeout-minutes: 240
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/setup-go
- name: Setup Go
uses: ./.github/actions/setup-go
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.1.9
terraform_wrapper: false
- name: Setup Terraform
uses: ./.github/actions/setup-tf
- name: Run Tests
run: |
@@ -32,7 +32,8 @@ jobs:
# impact.
gotestsum --junitfile="gotests.xml" -- -timeout=240m -count=10 -race ./...
- uses: ./.github/actions/upload-datadog
- name: Upload test results to DataDog
uses: ./.github/actions/upload-datadog
if: always()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
@@ -42,14 +43,18 @@ jobs:
runs-on: "buildjet-2vcpu-ubuntu-2204"
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- uses: ./.github/actions/setup-go
- name: Run Tests
run: |
gotestsum --junitfile="gotests.xml" -- --tags="timing" -p=1 -run='_Timing/' ./...
- uses: ./.github/actions/upload-datadog
- name: Upload test results to DataDog
uses: ./.github/actions/upload-datadog
if: always()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
+2 -1
View File
@@ -13,4 +13,5 @@ jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/auto-author-assign@v1.6.2
- name: Assign author
uses: toshimaru/auto-author-assign@v2.1.0
+73
View File
@@ -0,0 +1,73 @@
name: pr-cleanup
on:
pull_request:
types: closed
workflow_dispatch:
inputs:
pr_number:
description: "PR number"
required: true
permissions:
packages: write
jobs:
cleanup:
runs-on: "ubuntu-latest"
steps:
- name: Get PR number
id: pr_number
run: |
if [ -n "${{ github.event.pull_request.number }}" ]; then
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
echo "PR_NUMBER=${{ github.event.inputs.pr_number }}" >> $GITHUB_OUTPUT
fi
- name: Delete image
continue-on-error: true
uses: bots-house/ghcr-delete-image-action@v1.1.0
with:
owner: coder
name: coder-preview
token: ${{ secrets.GITHUB_TOKEN }}
tag: pr${{ steps.pr_number.outputs.PR_NUMBER }}
- name: Set up kubeconfig
run: |
set -euo pipefail
mkdir -p ~/.kube
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
export KUBECONFIG=~/.kube/config
- name: Delete helm release
run: |
set -euo pipefail
helm delete --namespace "pr${{ steps.pr_number.outputs.PR_NUMBER }}" "pr${{ steps.pr_number.outputs.PR_NUMBER }}" || echo "helm release not found"
- name: "Remove PR namespace"
run: |
kubectl delete namespace "pr${{ steps.pr_number.outputs.PR_NUMBER }}" || echo "namespace not found"
- name: "Remove DNS records"
run: |
set -euo pipefail
# Get identifier for the record
record_id=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/${{ secrets.PR_DEPLOYMENTS_ZONE_ID }}/dns_records?name=%2A.pr${{ steps.pr_number.outputs.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}" \
-H "Authorization: Bearer ${{ secrets.PR_DEPLOYMENTS_CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type:application/json" | jq -r '.result[0].id') || echo "DNS record not found"
echo "::add-mask::$record_id"
# Delete the record
(
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/${{ secrets.PR_DEPLOYMENTS_ZONE_ID }}/dns_records/$record_id" \
-H "Authorization: Bearer ${{ secrets.PR_DEPLOYMENTS_CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type:application/json" | jq -r '.success'
) || echo "DNS record not found"
- name: "Delete certificate"
if: ${{ github.event.pull_request.merged == true }}
run: |
set -euxo pipefail
kubectl delete certificate "pr${{ steps.pr_number.outputs.PR_NUMBER }}-tls" -n pr-deployment-certs || echo "certificate not found"
+467
View File
@@ -0,0 +1,467 @@
# This action will trigger when
# 1. when the workflow is manually triggered
# 2. ./scripts/deploy_pr.sh is run locally
# 3. when a PR is updated
name: Deploy PR
on:
push:
branches-ignore:
- main
workflow_dispatch:
inputs:
experiments:
description: "Experiments to enable"
required: false
type: string
default: "*"
build:
description: "Force new build"
required: false
type: boolean
default: false
deploy:
description: "Force new deployment"
required: false
type: boolean
default: false
env:
REPO: ghcr.io/coder/coder-preview
permissions:
contents: read
packages: write
pull-requests: write # needed for commenting on PRs
jobs:
check_pr:
runs-on: ubuntu-latest
outputs:
PR_OPEN: ${{ steps.check_pr.outputs.pr_open }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check if PR is open
id: check_pr
run: |
set -euo pipefail
pr_open=true
if [[ "$(gh pr view --json state | jq -r '.state')" != "OPEN" ]]; then
echo "PR doesn't exist or is closed."
pr_open=false
fi
echo "pr_open=$pr_open" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
get_info:
needs: check_pr
if: ${{ needs.check_pr.outputs.PR_OPEN == 'true' }}
outputs:
PR_NUMBER: ${{ steps.pr_info.outputs.PR_NUMBER }}
PR_TITLE: ${{ steps.pr_info.outputs.PR_TITLE }}
PR_URL: ${{ steps.pr_info.outputs.PR_URL }}
CODER_BASE_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}
CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}
NEW: ${{ steps.check_deployment.outputs.NEW }}
BUILD: ${{ steps.build_conditionals.outputs.first_or_force_build == 'true' || steps.build_conditionals.outputs.automatic_rebuild == 'true' }}
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get PR number, title, and branch name
id: pr_info
run: |
set -euo pipefail
PR_NUMBER=$(gh pr view --json number | jq -r '.number')
PR_TITLE=$(gh pr view --json title | jq -r '.title')
PR_URL=$(gh pr view --json url | jq -r '.url')
echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set required tags
id: set_tags
run: |
set -euo pipefail
echo "CODER_BASE_IMAGE_TAG=$CODER_BASE_IMAGE_TAG" >> $GITHUB_OUTPUT
echo "CODER_IMAGE_TAG=$CODER_IMAGE_TAG" >> $GITHUB_OUTPUT
env:
CODER_BASE_IMAGE_TAG: ghcr.io/coder/coder-preview-base:pr${{ steps.pr_info.outputs.PR_NUMBER }}
CODER_IMAGE_TAG: ghcr.io/coder/coder-preview:pr${{ steps.pr_info.outputs.PR_NUMBER }}
- name: Set up kubeconfig
run: |
set -euo pipefail
mkdir -p ~/.kube
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
chmod 644 ~/.kube/config
export KUBECONFIG=~/.kube/config
- name: Check if the helm deployment already exists
id: check_deployment
run: |
set -euo pipefail
if helm status "pr${{ steps.pr_info.outputs.PR_NUMBER }}" --namespace "pr${{ steps.pr_info.outputs.PR_NUMBER }}" > /dev/null 2>&1; then
echo "Deployment already exists. Skipping deployment."
NEW=false
else
echo "Deployment doesn't exist."
NEW=true
fi
echo "NEW=$NEW" >> $GITHUB_OUTPUT
- name: Check changed files
uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.ref }}
filters: |
all:
- "**"
ignored:
- "docs/**"
- "README.md"
- "examples/web-server/**"
- "examples/monitoring/**"
- "examples/lima/**"
- ".github/**"
- "offlinedocs/**"
- ".devcontainer/**"
- "helm/**"
- "*[^g][^o][^.][^s][^u][^m]*"
- "*[^g][^o][^.][^m][^o][^d]*"
- "*[^M][^a][^k][^e][^f][^i][^l][^e]*"
- "scripts/**/*[^D][^o][^c][^k][^e][^r][^f][^i][^l][^e]*"
- "scripts/**/*[^D][^o][^c][^k][^e][^r][^f][^i][^l][^e][.][b][^a][^s][^e]*"
- name: Print number of changed files
run: |
set -euo pipefail
echo "Total number of changed files: ${{ steps.filter.outputs.all_count }}"
echo "Number of ignored files: ${{ steps.filter.outputs.ignored_count }}"
- name: Build conditionals
id: build_conditionals
run: |
set -euo pipefail
# build if the workflow is manually triggered and the deployment doesn't exist (first build or force rebuild)
echo "first_or_force_build=${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || github.event.inputs.build == 'true' }}" >> $GITHUB_OUTPUT
# build if the deployment alreday exist and there are changes in the files that we care about (automatic updates)
echo "automatic_rebuild=${{ steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT
comment-pr:
needs: get_info
if: needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true'
runs-on: "ubuntu-latest"
steps:
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ needs.get_info.outputs.PR_NUMBER }}
comment-author: "github-actions[bot]"
body-includes: ":rocket:"
direction: last
- name: Comment on PR
id: comment_id
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ needs.get_info.outputs.PR_NUMBER }}
edit-mode: replace
body: |
---
:rocket: Deploying PR ${{ needs.get_info.outputs.PR_NUMBER }} ...
---
reactions: eyes
reactions-edit-mode: replace
build:
needs: get_info
# Run build job only if there are changes in the files that we care about or if the workflow is manually triggered with --build flag
if: needs.get_info.outputs.BUILD == 'true'
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
# This concurrency only cancels build jobs if a new build is triggred. It will avoid cancelling the current deployemtn in case of docs chnages.
concurrency:
group: build-${{ github.workflow }}-${{ github.ref }}-${{ needs.get_info.outputs.BUILD }}
cancel-in-progress: true
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
CODER_IMAGE_TAG: ${{ needs.get_info.outputs.CODER_IMAGE_TAG }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Setup sqlc
uses: ./.github/actions/setup-sqlc
- name: GHCR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Linux amd64 Docker image
run: |
set -euo pipefail
go mod download
make gen/mark-fresh
export DOCKER_IMAGE_NO_PREREQUISITES=true
version="$(./scripts/version.sh)"
export CODER_IMAGE_BUILD_BASE_TAG="$(CODER_IMAGE_BASE=coder-base ./scripts/image_tag.sh --version "$version")"
make -j build/coder_linux_amd64
./scripts/build_docker.sh \
--arch amd64 \
--target ${{ env.CODER_IMAGE_TAG }} \
--version $version \
--push \
build/coder_linux_amd64
deploy:
needs: [build, get_info]
# Run deploy job only if build job was successful or skipped
if: |
always() && (needs.build.result == 'success' || needs.build.result == 'skipped') &&
(needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true')
runs-on: "ubuntu-latest"
env:
CODER_IMAGE_TAG: ${{ needs.get_info.outputs.CODER_IMAGE_TAG }}
PR_NUMBER: ${{ needs.get_info.outputs.PR_NUMBER }}
PR_TITLE: ${{ needs.get_info.outputs.PR_TITLE }}
PR_URL: ${{ needs.get_info.outputs.PR_URL }}
PR_HOSTNAME: "pr${{ needs.get_info.outputs.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}"
steps:
- name: Set up kubeconfig
run: |
set -euo pipefail
mkdir -p ~/.kube
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
chmod 644 ~/.kube/config
export KUBECONFIG=~/.kube/config
- name: Check if image exists
run: |
set -euo pipefail
foundTag=$(
gh api /orgs/coder/packages/container/coder-preview/versions |
jq -r --arg tag "pr${{ env.PR_NUMBER }}" '.[] |
select(.metadata.container.tags == [$tag]) |
.metadata.container.tags[0]'
)
if [ -z "$foundTag" ]; then
echo "Image not found"
echo "${{ env.CODER_IMAGE_TAG }} not found in ghcr.io/coder/coder-preview"
exit 1
else
echo "Image found"
echo "$foundTag tag found in ghcr.io/coder/coder-preview"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add DNS record to Cloudflare
if: needs.get_info.outputs.NEW == 'true'
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.PR_DEPLOYMENTS_ZONE_ID }}/dns_records" \
-H "Authorization: Bearer ${{ secrets.PR_DEPLOYMENTS_CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type:application/json" \
--data '{"type":"CNAME","name":"*.${{ env.PR_HOSTNAME }}","content":"${{ env.PR_HOSTNAME }}","ttl":1,"proxied":false}'
- name: Create PR namespace
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
run: |
set -euo pipefail
# try to delete the namespace, but don't fail if it doesn't exist
kubectl delete namespace "pr${{ env.PR_NUMBER }}" || true
kubectl create namespace "pr${{ env.PR_NUMBER }}"
- name: Checkout
uses: actions/checkout@v4
- name: Check and Create Certificate
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
run: |
# Using kubectl to check if a Certificate resource already exists
# we are doing this to avoid letsenrypt rate limits
if ! kubectl get certificate pr${{ env.PR_NUMBER }}-tls -n pr-deployment-certs > /dev/null 2>&1; then
echo "Certificate doesn't exist. Creating a new one."
envsubst < ./.github/pr-deployments/certificate.yaml | kubectl apply -f -
else
echo "Certificate exists. Skipping certificate creation."
fi
echo "Copy certificate from pr-deployment-certs to pr${{ env.PR_NUMBER }} namespace"
until kubectl get secret pr${{ env.PR_NUMBER }}-tls -n pr-deployment-certs &> /dev/null
do
echo "Waiting for secret pr${{ env.PR_NUMBER }}-tls to be created..."
sleep 5
done
(
kubectl get secret pr${{ env.PR_NUMBER }}-tls -n pr-deployment-certs -o json |
jq 'del(.metadata.namespace,.metadata.creationTimestamp,.metadata.resourceVersion,.metadata.selfLink,.metadata.uid,.metadata.managedFields)' |
kubectl -n pr${{ env.PR_NUMBER }} apply -f -
)
- name: Set up PostgreSQL database
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install coder-db bitnami/postgresql \
--namespace pr${{ env.PR_NUMBER }} \
--set auth.username=coder \
--set auth.password=coder \
--set auth.database=coder \
--set persistence.size=10Gi
kubectl create secret generic coder-db-url -n pr${{ env.PR_NUMBER }} \
--from-literal=url="postgres://coder:coder@coder-db-postgresql.pr${{ env.PR_NUMBER }}.svc.cluster.local:5432/coder?sslmode=disable"
- name: Create a service account, role, and rolebinding for the PR namespace
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
run: |
set -euo pipefail
# Create service account, role, rolebinding
envsubst < ./.github/pr-deployments/rbac.yaml | kubectl apply -f -
- name: Create values.yaml
env:
EXPERIMENTS: ${{ github.event.inputs.experiments }}
PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_ID }}
PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET: ${{ secrets.PR_DEPLOYMENTS_GITHUB_OAUTH_CLIENT_SECRET }}
run: |
set -euo pipefail
envsubst < ./.github/pr-deployments/values.yaml > ./pr-deploy-values.yaml
- name: Install/Upgrade Helm chart
run: |
set -euo pipefail
helm dependency update --skip-refresh ./helm/coder
helm upgrade --install "pr${{ env.PR_NUMBER }}" ./helm/coder \
--namespace "pr${{ env.PR_NUMBER }}" \
--values ./pr-deploy-values.yaml \
--force
- name: Install coder-logstream-kube
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
run: |
helm repo add coder-logstream-kube https://helm.coder.com/logstream-kube
helm upgrade --install coder-logstream-kube coder-logstream-kube/coder-logstream-kube \
--namespace "pr${{ env.PR_NUMBER }}" \
--set url="https://${{ env.PR_HOSTNAME }}"
- name: Get Coder binary
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
run: |
set -euo pipefail
DEST="${HOME}/coder"
URL="https://${{ env.PR_HOSTNAME }}/bin/coder-linux-amd64"
mkdir -p "$(dirname ${DEST})"
COUNT=0
until $(curl --output /dev/null --silent --head --fail "$URL"); do
printf '.'
sleep 5
COUNT=$((COUNT+1))
if [ $COUNT -ge 60 ]; then
echo "Timed out waiting for URL to be available"
exit 1
fi
done
curl -fsSL "$URL" -o "${DEST}"
chmod +x "${DEST}"
"${DEST}" version
mv "${DEST}" /usr/local/bin/coder
- name: Create first user, template and workspace
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
id: setup_deployment
run: |
set -euo pipefail
# Create first user
# create a masked random password 12 characters long
password=$(openssl rand -base64 16 | tr -d "=+/" | cut -c1-12)
# add mask so that the password is not printed to the logs
echo "::add-mask::$password"
echo "password=$password" >> $GITHUB_OUTPUT
coder login \
--first-user-username coder \
--first-user-email pr${{ env.PR_NUMBER }}@coder.com \
--first-user-password $password \
--first-user-trial \
--use-token-as-session \
https://${{ env.PR_HOSTNAME }}
# Create template
cd ./.github/pr-deployments/template
coder templates push -y --variable namespace=pr${{ env.PR_NUMBER }} kubernetes
# Create workspace
coder create --template="kubernetes" kube --parameter cpu=2 --parameter memory=4 --parameter home_disk_size=2 -y
coder stop kube -y
- name: Send Slack notification
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
run: |
curl -s -o /dev/null -X POST -H 'Content-type: application/json' \
-d \
'{
"pr_number": "'"${{ env.PR_NUMBER }}"'",
"pr_url": "'"${{ env.PR_URL }}"'",
"pr_title": "'"${{ env.PR_TITLE }}"'",
"pr_access_url": "'"https://${{ env.PR_HOSTNAME }}"'",
"pr_username": "'"test"'",
"pr_email": "'"pr${{ env.PR_NUMBER }}@coder.com"'",
"pr_password": "'"${{ steps.setup_deployment.outputs.password }}"'",
"pr_actor": "'"${{ github.actor }}"'"
}' \
${{ secrets.PR_DEPLOYMENTS_SLACK_WEBHOOK }}
echo "Slack notification sent"
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ env.PR_NUMBER }}
comment-author: "github-actions[bot]"
body-includes: ":rocket:"
direction: last
- name: Comment on PR
uses: peter-evans/create-or-update-comment@v4
env:
STATUS: ${{ needs.get_info.outputs.NEW == 'true' && 'Created' || 'Updated' }}
with:
issue-number: ${{ env.PR_NUMBER }}
edit-mode: replace
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
---
:heavy_check_mark: PR ${{ env.PR_NUMBER }} ${{ env.STATUS }} successfully.
:rocket: Access the credentials [here](${{ secrets.PR_DEPLOYMENTS_SLACK_CHANNEL_URL }}).
---
cc: @${{ github.actor }}
reactions: rocket
reactions-edit-mode: replace
+145 -46
View File
@@ -28,10 +28,6 @@ env:
# https://github.blog/changelog/2022-06-10-github-actions-inputs-unified-across-manual-and-reusable-workflows/
CODER_RELEASE: ${{ !inputs.dry_run }}
CODER_DRY_RUN: ${{ inputs.dry_run }}
# For some reason, setup-go won't actually pick up a new patch version if
# it has an old one cached. We need to manually specify the versions so we
# can get the latest release. Never use "~1.xx" here!
CODER_GO_VERSION: "1.20.5"
jobs:
release:
@@ -43,7 +39,8 @@ jobs:
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
@@ -75,11 +72,11 @@ jobs:
set -euo pipefail
ref=HEAD
old_version="$(git describe --abbrev=0 "$ref^1")"
version="$(./scripts/version.sh)"
version="v$(./scripts/version.sh)"
# Generate notes.
release_notes_file="$(mktemp -t release_notes.XXXXXX)"
./scripts/release/generate_release_notes.sh --old-version "$old_version" --new-version "$version" --ref "$ref" >> "$release_notes_file"
./scripts/release/generate_release_notes.sh --check-for-changelog --old-version "$old_version" --new-version "$version" --ref "$ref" >> "$release_notes_file"
echo CODER_RELEASE_NOTES_FILE="$release_notes_file" >> $GITHUB_ENV
- name: Show release notes
@@ -88,24 +85,17 @@ jobs:
cat "$CODER_RELEASE_NOTES_FILE"
- name: Docker Login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-go
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Cache Node
id: cache-node
uses: buildjet/cache@v3
with:
path: |
**/node_modules
.eslintcache
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
js-${{ runner.os }}-
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Install nsis and zstd
run: sudo apt-get install -y nsis zstd
@@ -113,7 +103,7 @@ jobs:
- name: Install nfpm
run: |
set -euo pipefail
wget -O /tmp/nfpm.deb https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb
wget -O /tmp/nfpm.deb https://github.com/goreleaser/nfpm/releases/download/v2.35.1/nfpm_2.35.1_amd64.deb
sudo dpkg -i /tmp/nfpm.deb
rm /tmp/nfpm.deb
@@ -151,7 +141,8 @@ jobs:
build/coder_"$version"_linux_{amd64,armv7,arm64}.{tar.gz,apk,deb,rpm} \
build/coder_"$version"_{darwin,windows}_{amd64,arm64}.zip \
build/coder_"$version"_windows_amd64_installer.exe \
build/coder_helm_"$version".tgz
build/coder_helm_"$version".tgz \
build/provisioner_helm_"$version".tgz
env:
CODER_SIGN_DARWIN: "1"
AC_CERTIFICATE_FILE: /tmp/apple_cert.p12
@@ -257,6 +248,11 @@ jobs:
env:
CODER_BASE_IMAGE_TAG: ${{ steps.image-base-tag.outputs.tag }}
- name: Generate offline docs
run: |
version="$(./scripts/version.sh)"
make -j build/coder_docs_"$version".tgz
- name: ls build
run: ls -lh build
@@ -285,13 +281,13 @@ jobs:
CODER_GPG_RELEASE_KEY_BASE64: ${{ secrets.GPG_RELEASE_KEY_BASE64 }}
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_ID_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- name: Setup GCloud SDK
uses: "google-github-actions/setup-gcloud@v1"
uses: "google-github-actions/setup-gcloud@v2"
- name: Publish Helm Chart
if: ${{ !inputs.dry_run }}
@@ -300,15 +296,17 @@ jobs:
version="$(./scripts/version.sh)"
mkdir -p build/helm
cp "build/coder_helm_${version}.tgz" build/helm
cp "build/provisioner_helm_${version}.tgz" build/helm
gsutil cp gs://helm.coder.com/v2/index.yaml build/helm/index.yaml
helm repo index build/helm --url https://helm.coder.com/v2 --merge build/helm/index.yaml
gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/coder_helm_${version}.tgz gs://helm.coder.com/v2
gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/provisioner_helm_${version}.tgz gs://helm.coder.com/v2
gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/index.yaml gs://helm.coder.com/v2
gsutil -h "Cache-Control:no-cache,max-age=0" cp helm/artifacthub-repo.yml gs://helm.coder.com/v2
- name: Upload artifacts to actions (if dry-run)
if: ${{ inputs.dry_run }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: |
@@ -323,19 +321,100 @@ jobs:
- name: Start Packer builds
if: ${{ !inputs.dry_run }}
uses: peter-evans/repository-dispatch@v2
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.CDRCI_GITHUB_TOKEN }}
repository: coder/packages
event-type: coder-release
client-payload: '{"coder_version": "${{ steps.version.outputs.version }}"}'
publish-homebrew:
name: Publish to Homebrew tap
runs-on: ubuntu-latest
needs: release
if: ${{ !inputs.dry_run }}
steps:
# TODO: skip this if it's not a new release (i.e. a backport). This is
# fine right now because it just makes a PR that we can close.
- name: Update homebrew
env:
# Variables used by the `gh` command
GH_REPO: coder/homebrew-coder
GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}
run: |
# Keep version number around for reference, removing any potential leading v
coder_version="$(echo "${{ needs.release.outputs.version }}" | tr -d v)"
set -euxo pipefail
# Setup Git
git config --global user.email "ci@coder.com"
git config --global user.name "Coder CI"
git config --global credential.helper "store"
temp_dir="$(mktemp -d)"
cd "$temp_dir"
# Download checksums
checksums_url="$(gh release view --repo coder/coder "v$coder_version" --json assets \
| jq -r ".assets | map(.url) | .[]" \
| grep -e ".checksums.txt\$")"
wget "$checksums_url" -O checksums.txt
# Get the SHAs
darwin_arm_sha="$(cat checksums.txt | grep "darwin_arm64.zip" | awk '{ print $1 }')"
darwin_intel_sha="$(cat checksums.txt | grep "darwin_amd64.zip" | awk '{ print $1 }')"
linux_sha="$(cat checksums.txt | grep "linux_amd64.tar.gz" | awk '{ print $1 }')"
echo "macOS arm64: $darwin_arm_sha"
echo "macOS amd64: $darwin_intel_sha"
echo "Linux amd64: $linux_sha"
# Check out the homebrew repo
git clone "https://github.com/$GH_REPO" homebrew-coder
brew_branch="auto-release/$coder_version"
cd homebrew-coder
# Check if a PR already exists.
pr_count="$(gh pr list --search "head:$brew_branch" --json id,closed | jq -r ".[] | select(.closed == false) | .id" | wc -l)"
if [[ "$pr_count" > 0 ]]; then
echo "Bailing out as PR already exists" 2>&1
exit 0
fi
# Set up cdrci credentials for pushing to homebrew-coder
echo "https://x-access-token:$GH_TOKEN@github.com" >> ~/.git-credentials
# Update the formulae and push
git checkout -b "$brew_branch"
./scripts/update-v2.sh "$coder_version" "$darwin_arm_sha" "$darwin_intel_sha" "$linux_sha"
git add .
git commit -m "coder $coder_version"
git push -u origin -f "$brew_branch"
# Create PR
gh pr create \
-B master -H "$brew_branch" \
-t "coder $coder_version" \
-b "" \
-r "${{ github.actor }}" \
-a "${{ github.actor }}" \
-b "This automatic PR was triggered by the release of Coder v$coder_version"
publish-winget:
name: Publish to winget-pkgs
runs-on: windows-latest
needs: release
if: ${{ !inputs.dry_run }}
steps:
- uses: actions/checkout@v3
- name: Sync fork
run: gh repo sync cdrci/winget-pkgs -b master
env:
GH_TOKEN: ${{ secrets.WINGET_GH_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
@@ -360,33 +439,26 @@ jobs:
$release_assets = gh release view --repo coder/coder "v${version}" --json assets | `
ConvertFrom-Json
# Get the installer URL from the release assets.
$installer_url = $release_assets.assets | `
# Get the installer URLs from the release assets.
$amd64_installer_url = $release_assets.assets | `
Where-Object name -Match ".*_windows_amd64_installer.exe$" | `
Select -ExpandProperty url
$amd64_zip_url = $release_assets.assets | `
Where-Object name -Match ".*_windows_amd64.zip$" | `
Select -ExpandProperty url
$arm64_zip_url = $release_assets.assets | `
Where-Object name -Match ".*_windows_arm64.zip$" | `
Select -ExpandProperty url
echo "Installer URL: ${installer_url}"
echo "amd64 Installer URL: ${amd64_installer_url}"
echo "amd64 zip URL: ${amd64_zip_url}"
echo "arm64 zip URL: ${arm64_zip_url}"
echo "Package version: ${version}"
# Bail if dry-run.
if ($env:CODER_DRY_RUN -match "t") {
echo "Skipping submission due to dry-run."
exit 0
}
# The URL "|X64" suffix forces the architecture as it cannot be
# sniffed properly from the URL. wingetcreate checks both the URL and
# binary magic bytes for the architecture and they need to both match,
# but they only check for `x64`, `win64` and `_64` in the URL. Our URL
# contains `amd64` which doesn't match sadly.
#
# wingetcreate will still do the binary magic bytes check, so if we
# accidentally change the architecture of the installer, it will fail
# submission.
.\wingetcreate.exe update Coder.Coder `
--submit `
--version "${version}" `
--urls "${installer_url}|X64" `
--urls "${amd64_installer_url}" "${amd64_zip_url}" "${arm64_zip_url}" `
--token "$env:WINGET_GH_TOKEN"
env:
@@ -397,8 +469,9 @@ jobs:
WINGET_GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}
- name: Comment on PR
if: ${{ !inputs.dry_run }}
run: |
# wait 30 seconds
Start-Sleep -Seconds 30.0
# Find the PR that wingetcreate just made.
$version = "${{ needs.release.outputs.version }}".Trim('v')
$pr_list = gh pr list --repo microsoft/winget-pkgs --search "author:cdrci Coder.Coder version ${version}" --limit 1 --json number | `
@@ -411,3 +484,29 @@ jobs:
# For gh CLI. We need a real token since we're commenting on a PR in a
# different repo.
GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}
# publish-sqlc pushes the latest schema to sqlc cloud.
# At present these pushes cannot be tagged, so the last push is always the latest.
publish-sqlc:
name: "Publish to schema sqlc cloud"
runs-on: "ubuntu-latest"
needs: release
if: ${{ !inputs.dry_run }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# We need golang to run the migration main.go
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Setup sqlc
uses: ./.github/actions/setup-sqlc
- name: Push schema to sqlc cloud
# Don't block a release on this
continue-on-error: true
run: |
make sqlc-push
+22 -26
View File
@@ -8,6 +8,9 @@ permissions:
on:
workflow_dispatch:
# Uncomment when testing.
# pull_request:
schedule:
# Run every 6 hours Monday-Friday!
- cron: "0 0/6 * * 1-5"
@@ -18,21 +21,20 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-security
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CODER_GO_VERSION: "1.20.5"
jobs:
codeql:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: go, javascript
- uses: ./.github/actions/setup-go
- name: Setup Go
uses: ./.github/actions/setup-go
# Workaround to prevent CodeQL from building the dashboard.
- name: Remove Makefile
@@ -40,7 +42,7 @@ jobs:
rm Makefile
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
- name: Send Slack notification on failure
if: ${{ failure() }}
@@ -56,30 +58,24 @@ jobs:
trivy:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup-go
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Cache Node
id: cache-node
uses: buildjet/cache@v3
with:
path: |
**/node_modules
.eslintcache
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
js-${{ runner.os }}-
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup sqlc
uses: ./.github/actions/setup-sqlc
- name: Install sqlc
run: |
curl -sSL https://github.com/kyleconroy/sqlc/releases/download/v1.17.2/sqlc_1.17.2_linux_amd64.tar.gz | sudo tar -C /usr/bin -xz sqlc
- name: Install yq
run: go run github.com/mikefarah/yq/v4@v4.30.6
- name: Install mockgen
run: go install github.com/golang/mock/mockgen@v1.6.0
run: go install go.uber.org/mock/mockgen@v0.4.0
- name: Install protoc-gen-go
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
- name: Install protoc-gen-go-drpc
@@ -126,7 +122,7 @@ jobs:
image_name: ${{ steps.build.outputs.image }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@41f05d9ecffa2ed3f1580af306000f734b733e54
uses: aquasecurity/trivy-action@d43c1f16c00cfd3978dde6c07f4bbcf9eb6993ca
with:
image-ref: ${{ steps.build.outputs.image }}
format: sarif
@@ -134,13 +130,13 @@ jobs:
severity: "CRITICAL,HIGH"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results.sarif
category: "Trivy"
- name: Upload Trivy scan results as an artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: trivy
path: trivy-results.sarif
+72 -4
View File
@@ -1,4 +1,4 @@
name: Stale Issue and Branch Cleanup
name: Stale Issue, Banch and Old Workflows Cleanup
on:
schedule:
# Every day at midnight
@@ -10,12 +10,14 @@ jobs:
permissions:
issues: write
pull-requests: write
actions: write
steps:
- uses: actions/stale@v8.0.0
- name: stale
uses: actions/stale@v9.0.0
with:
stale-issue-label: "stale"
stale-pr-label: "stale"
days-before-stale: 90
days-before-stale: 180
# Pull Requests become stale more quickly due to merge conflicts.
# Also, we promote minimizing WIP.
days-before-pr-stale: 7
@@ -28,11 +30,57 @@ jobs:
operations-per-run: 60
# Start with the oldest issues, always.
ascending: true
- name: "Close old issues labeled likely-no"
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const thirtyDaysAgo = new Date(new Date().setDate(new Date().getDate() - 30));
console.log(`Looking for issues labeled with 'likely-no' more than 30 days ago, which is after ${thirtyDaysAgo.toISOString()}`);
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'likely-no',
state: 'open',
});
console.log(`Found ${issues.data.length} open issues labeled with 'likely-no'`);
for (const issue of issues.data) {
console.log(`Checking issue #${issue.number} created at ${issue.created_at}`);
const timeline = await github.rest.issues.listEventsForTimeline({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
});
const labelEvent = timeline.data.find(event => event.event === 'labeled' && event.label.name === 'likely-no');
if (labelEvent) {
console.log(`Issue #${issue.number} was labeled with 'likely-no' at ${labelEvent.created_at}`);
if (new Date(labelEvent.created_at) < thirtyDaysAgo) {
console.log(`Issue #${issue.number} is older than 30 days with 'likely-no' label, closing issue.`);
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed',
state_reason: 'not_planned'
});
}
} else {
console.log(`Issue #${issue.number} does not have a 'likely-no' label event in its timeline.`);
}
}
branches:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Run delete-old-branches-action
uses: beatlabs/delete-old-branches-action@v0.0.10
with:
@@ -42,3 +90,23 @@ jobs:
delete_tags: false
# extra_protected_branch_regex: ^(foo|bar)$
exclude_open_pr_branches: true
del_runs:
runs-on: ubuntu-latest
steps:
- name: Delete PR Cleanup workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 30
keep_minimum_runs: 30
delete_workflow_pattern: pr-cleanup.yaml
- name: Delete PR Deploy workflow skipped runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 30
keep_minimum_runs: 30
delete_workflow_pattern: pr-deploy.yaml
+16 -9
View File
@@ -4,6 +4,7 @@ Jetbrains = "JetBrains"
IST = "IST"
MacOS = "macOS"
AKS = "AKS"
O_WRONLY = "O_WRONLY"
[default.extend-words]
AKS = "AKS"
@@ -13,16 +14,22 @@ darcula = "darcula"
Hashi = "Hashi"
trialer = "trialer"
encrypter = "encrypter"
hel = "hel" # as in helsinki
[files]
extend-exclude = [
"**.svg",
"**.png",
"**.lock",
"go.sum",
"go.mod",
# These files contain base64 strings that confuse the detector
"**XService**.ts",
"**identity.go",
"scripts/ci-report/testdata/**",
"**.svg",
"**.png",
"**.lock",
"go.sum",
"go.mod",
# These files contain base64 strings that confuse the detector
"**XService**.ts",
"**identity.go",
"scripts/ci-report/testdata/**",
"**/*_test.go",
"**/*.test.tsx",
"**/pnpm-lock.yaml",
"tailnet/testdata/**",
"site/src/pages/SetupPage/countries.tsx",
]
+13 -5
View File
@@ -20,24 +20,23 @@ yarn-error.log
# Front-end ignore patterns.
.next/
site/**/*.typegen.ts
site/build-storybook.log
site/coverage/
site/storybook-static/
site/test-results/*
site/e2e/test-results/*
site/e2e/states/*.json
site/e2e/.auth.json
site/playwright-report/*
site/.swc
site/dist/
# Make target for updating golden files (any dir).
.gen-golden
# Build
/build/
/dist/
site/out/
build/
dist/
out/
# Bundle analysis
site/stats/
@@ -60,3 +59,12 @@ site/stats/
./scaletest/terraform/.terraform.lock.hcl
scaletest/terraform/secrets.tfvars
.terraform.tfstate.*
# Nix
result
# Data dumps from unit tests
**/*.test.sql
# Filebrowser.db
**/filebrowser.db
+27 -6
View File
@@ -2,8 +2,19 @@
# Over time we should try tightening some of these.
linters-settings:
dupl:
# goal: 100
threshold: 412
exhaustruct:
include:
# Gradually extend to cover more of the codebase.
- 'httpmw\.\w+'
# We want to enforce all values are specified when inserting or updating
# a database row. Ref: #9936
- 'github.com/coder/coder/v2/coderd/database\.[^G][^e][^t]\w+Params'
gocognit:
min-complexity: 46 # Min code complexity (def 30).
min-complexity: 300
goconst:
min-len: 4 # Min length of string consts (def 3).
@@ -114,9 +125,6 @@ linters-settings:
goimports:
local-prefixes: coder.com,cdr.dev,go.coder.com,github.com/cdr,github.com/coder
gocyclo:
min-complexity: 50
importas:
no-unaliased: true
@@ -126,7 +134,8 @@ linters-settings:
- trialer
nestif:
min-complexity: 4 # Min complexity of if statements (def 5, goal 4)
# goal: 10
min-complexity: 20
revive:
# see https://github.com/mgechev/revive#available-rules for details.
@@ -194,6 +203,10 @@ issues:
# We use assertions rather than explicitly checking errors in tests
- errcheck
- forcetypeassert
- exhaustruct # This is unhelpful in tests.
- path: scripts/*
linters:
- exhaustruct
fix: true
max-issues-per-linter: 0
@@ -202,6 +215,7 @@ issues:
run:
skip-dirs:
- node_modules
- .git
skip-files:
- scripts/rules.go
timeout: 10m
@@ -218,10 +232,16 @@ linters:
- errcheck
- errname
- errorlint
- exhaustruct
- exportloopref
- forcetypeassert
- gocritic
- gocyclo
# gocyclo is may be useful in the future when we start caring
# about testing complexity, but for the time being we should
# create a good culture around cognitive complexity.
# - gocyclo
- gocognit
- nestif
- goimports
- gomodguard
- gosec
@@ -257,3 +277,4 @@ linters:
- typecheck
- unconvert
- unused
- dupl
+24 -6
View File
@@ -23,24 +23,23 @@ yarn-error.log
# Front-end ignore patterns.
.next/
site/**/*.typegen.ts
site/build-storybook.log
site/coverage/
site/storybook-static/
site/test-results/*
site/e2e/test-results/*
site/e2e/states/*.json
site/e2e/.auth.json
site/playwright-report/*
site/.swc
site/dist/
# Make target for updating golden files (any dir).
.gen-golden
# Build
/build/
/dist/
site/out/
build/
dist/
out/
# Bundle analysis
site/stats/
@@ -63,10 +62,19 @@ site/stats/
./scaletest/terraform/.terraform.lock.hcl
scaletest/terraform/secrets.tfvars
.terraform.tfstate.*
# Nix
result
# Data dumps from unit tests
**/*.test.sql
# Filebrowser.db
**/filebrowser.db
# .prettierignore.include:
# Helm templates contain variables that are invalid YAML and can't be formatted
# by Prettier.
helm/templates/*.yaml
helm/**/templates/*.yaml
# Terraform state files used in tests, these are automatically generated.
# Example: provisioner/terraform/testdata/instance-id/instance-id.tfstate.json
@@ -74,3 +82,13 @@ helm/templates/*.yaml
# Testdata shouldn't be formatted.
scripts/apitypings/testdata/**/*.ts
enterprise/tailnet/testdata/*.golden.html
tailnet/testdata/*.golden.html
# Generated files shouldn't be formatted.
site/e2e/provisionerGenerated.ts
**/pnpm-lock.yaml
# Ignore generated JSON (e.g. examples/examples.gen.json).
**/*.gen.json
+11 -1
View File
@@ -1,6 +1,6 @@
# Helm templates contain variables that are invalid YAML and can't be formatted
# by Prettier.
helm/templates/*.yaml
helm/**/templates/*.yaml
# Terraform state files used in tests, these are automatically generated.
# Example: provisioner/terraform/testdata/instance-id/instance-id.tfstate.json
@@ -8,3 +8,13 @@ helm/templates/*.yaml
# Testdata shouldn't be formatted.
scripts/apitypings/testdata/**/*.ts
enterprise/tailnet/testdata/*.golden.html
tailnet/testdata/*.golden.html
# Generated files shouldn't be formatted.
site/e2e/provisionerGenerated.ts
**/pnpm-lock.yaml
# Ignore generated JSON (e.g. examples/examples.gen.json).
**/*.gen.json
+9 -7
View File
@@ -1,16 +1,18 @@
# This config file is used in conjunction with `.editorconfig` to specify
# formatting for prettier-supported files. See `.editorconfig` and
# `site/.editorconfig`for whitespace formatting options.
# `site/.editorconfig` for whitespace formatting options.
printWidth: 80
semi: false
proseWrap: always
trailingComma: all
useTabs: false
tabWidth: 2
overrides:
- files:
- README.md
- docs/api/**/*.md
- docs/cli/**/*.md
- docs/changelogs/*.md
- .github/**/*.{yaml,yml,toml}
- scripts/**/*.{yaml,yml,toml}
options:
proseWrap: preserve
- files:
- "site/**/*.yaml"
- "site/**/*.yml"
options:
proseWrap: always
+2 -2
View File
@@ -1,8 +1,8 @@
// Replace all NullTime with string
replace github.com/coder/coder/codersdk.NullTime string
replace github.com/coder/coder/v2/codersdk.NullTime string
// Prevent swaggo from rendering enums for time.Duration
replace time.Duration int64
// Do not expose "echo" provider
replace github.com/coder/coder/codersdk.ProvisionerType string
replace github.com/coder/coder/v2/codersdk.ProvisionerType string
// Do not render netip.Addr
replace netip.Addr string
+21 -18
View File
@@ -18,10 +18,11 @@
"coderdenttest",
"coderdtest",
"codersdk",
"contravariance",
"cronstrue",
"databasefake",
"dbfake",
"dbgen",
"dbmem",
"dbtype",
"DERP",
"derphttp",
@@ -39,6 +40,7 @@
"enterprisemeta",
"errgroup",
"eventsourcemock",
"externalauth",
"Failf",
"fatih",
"Formik",
@@ -58,6 +60,7 @@
"idtoken",
"Iflag",
"incpatch",
"initialisms",
"ipnstate",
"isatty",
"Jobf",
@@ -116,13 +119,13 @@
"stretchr",
"STTY",
"stuntest",
"tanstack",
"tailbroker",
"tailcfg",
"tailexchange",
"tailnet",
"tailnettest",
"Tailscale",
"tanstack",
"tbody",
"TCGETS",
"tcpip",
@@ -139,6 +142,7 @@
"tios",
"tmpdir",
"tokenconfig",
"Topbar",
"tparallel",
"trialer",
"trimprefix",
@@ -166,10 +170,10 @@
"workspaceapps",
"workspacebuilds",
"workspacename",
"wsconncache",
"wsjson",
"xerrors",
"xstate",
"xlarge",
"xsmall",
"yamux"
],
"cSpell.ignorePaths": ["site/package.json", ".vscode/settings.json"],
@@ -186,19 +190,25 @@
]
},
"eslint.workingDirectories": ["./site"],
"files.exclude": {
"**/node_modules": true
},
"search.exclude": {
"**.pb.go": true,
"**/*.gen.json": true,
"**/testdata/*": true,
"**Generated.ts": true,
"coderd/apidoc/**": true,
"docs/api/*.md": true,
"docs/templates/*.md": true,
"LICENSE": true,
"scripts/metricsdocgen/metrics": true,
"docs/api/*.md": true
"site/out/**": true,
"site/storybook-static/**": true,
"**.map": true,
"pnpm-lock.yaml": true
},
// Ensure files always have a newline.
"files.insertFinalNewline": true,
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.lintOnSave": "package",
"go.coverOnSave": true,
"go.coverageDecorator": {
"type": "gutter",
"coveredGutterStyle": "blockgreen",
@@ -211,12 +221,5 @@
"go.testFlags": ["-short", "-coverpkg=./..."],
// We often use a version of TypeScript that's ahead of the version shipped
// with VS Code.
"typescript.tsdk": "./site/node_modules/typescript/lib",
"grammarly.selectors": [
{
"language": "markdown",
"scheme": "file",
"pattern": "docs/contributing/frontend.md"
}
]
"typescript.tsdk": "./site/node_modules/typescript/lib"
}
+182 -48
View File
@@ -50,11 +50,11 @@ endif
# Note, all find statements should be written with `.` or `./path` as
# the search path so that these exclusions match.
FIND_EXCLUSIONS= \
-not \( \( -path '*/.git/*' -o -path './build/*' -o -path './vendor/*' -o -path './.coderv2/*' -o -path '*/node_modules/*' -o -path './site/out/*' -o -path './coderd/apidoc/*' \) -prune \)
-not \( \( -path '*/.git/*' -o -path './build/*' -o -path './vendor/*' -o -path './.coderv2/*' -o -path '*/node_modules/*' -o -path '*/out/*' -o -path './coderd/apidoc/*' -o -path '*/.next/*' -o -path '*/.terraform/*' \) -prune \)
# Source files used for make targets, evaluated on use.
GO_SRC_FILES = $(shell find . $(FIND_EXCLUSIONS) -type f -name '*.go')
GO_SRC_FILES := $(shell find . $(FIND_EXCLUSIONS) -type f -name '*.go' -not -name '*_test.go')
# All the shell files in the repo, excluding ignored files.
SHELL_SRC_FILES = $(shell find . $(FIND_EXCLUSIONS) -type f -name '*.sh')
SHELL_SRC_FILES := $(shell find . $(FIND_EXCLUSIONS) -type f -name '*.sh')
# All ${OS}_${ARCH} combos we build for. Windows binaries have the .exe suffix.
OS_ARCHES := \
@@ -107,9 +107,9 @@ endif
clean:
rm -rf build site/out
mkdir -p build site/out/bin
git restore site/out
rm -rf build/ site/build/ site/out/
mkdir -p build/ site/out/bin/
git restore site/out/
.PHONY: clean
build-slim: $(CODER_SLIM_BINARIES)
@@ -344,21 +344,33 @@ push/$(CODER_MAIN_IMAGE): $(CODER_MAIN_IMAGE)
docker manifest push "$$image_tag"
.PHONY: push/$(CODER_MAIN_IMAGE)
# Helm charts that are available
charts = coder provisioner
# Shortcut for Helm chart package.
build/coder_helm.tgz: build/coder_helm_$(VERSION).tgz
$(foreach chart,$(charts),build/$(chart)_helm.tgz): build/%_helm.tgz: build/%_helm_$(VERSION).tgz
rm -f "$@"
ln "$<" "$@"
# Helm chart package.
build/coder_helm_$(VERSION).tgz:
$(foreach chart,$(charts),build/$(chart)_helm_$(VERSION).tgz): build/%_helm_$(VERSION).tgz:
./scripts/helm.sh \
--version "$(VERSION)" \
--chart $* \
--output "$@"
site/out/index.html: site/package.json $(shell find ./site $(FIND_EXCLUSIONS) -type f \( -name '*.ts' -o -name '*.tsx' \))
./scripts/yarn_install.sh
cd site
yarn build
../scripts/pnpm_install.sh
pnpm build
offlinedocs/out/index.html: $(shell find ./offlinedocs $(FIND_EXCLUSIONS) -type f) $(shell find ./docs $(FIND_EXCLUSIONS) -type f | sed 's: :\\ :g')
cd offlinedocs
../scripts/pnpm_install.sh
pnpm export
build/coder_docs_$(VERSION).tgz: offlinedocs/out/index.html
tar -czf "$@" -C offlinedocs/out .
install: build/coder_$(VERSION)_$(GOOS)_$(GOARCH)$(GOOS_BIN_EXT)
install_dir="$$(go env GOPATH)/bin"
@@ -382,9 +394,9 @@ fmt/prettier:
cd site
# Avoid writing files in CI to reduce file write activity
ifdef CI
yarn run format:check
pnpm run format:check
else
yarn run format:write
pnpm run format:write
endif
.PHONY: fmt/prettier
@@ -402,17 +414,22 @@ else
endif
.PHONY: fmt/shfmt
lint: lint/shellcheck lint/go lint/ts lint/helm
lint: lint/shellcheck lint/go lint/ts lint/helm lint/site-icons
.PHONY: lint
lint/site-icons:
./scripts/check_site_icons.sh
.PHONY: lint/site-icons
lint/ts:
cd site
yarn && yarn lint
pnpm i && pnpm lint
.PHONY: lint/ts
lint/go:
./scripts/check_enterprise_imports.sh
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2
linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/Dockerfile | cut -d '=' -f 2)
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver
golangci-lint run
.PHONY: lint/go
@@ -427,13 +444,24 @@ lint/helm:
make lint
.PHONY: lint/helm
# All files generated by the database should be added here, and this can be used
# as a target for jobs that need to run after the database is generated.
DB_GEN_FILES := \
coderd/database/querier.go \
coderd/database/unique_constraint.go \
coderd/database/dbmem/dbmem.go \
coderd/database/dbmetrics/dbmetrics.go \
coderd/database/dbauthz/dbauthz.go \
coderd/database/dbmock/dbmock.go
# all gen targets should be added here and to gen/mark-fresh
gen: \
coderd/database/dump.sql \
coderd/database/querier.go \
coderd/database/dbmock/dbmock.go \
tailnet/proto/tailnet.pb.go \
agent/proto/agent.pb.go \
provisionersdk/proto/provisioner.pb.go \
provisionerd/proto/provisionerd.pb.go \
coderd/database/dump.sql \
$(DB_GEN_FILES) \
site/src/api/typesGenerated.ts \
coderd/rbac/object_gen.go \
docs/admin/prometheus.md \
@@ -444,18 +472,25 @@ gen: \
.prettierignore \
site/.prettierrc.yaml \
site/.prettierignore \
site/.eslintignore
site/.eslintignore \
site/e2e/provisionerGenerated.ts \
site/src/theme/icons.json \
examples/examples.gen.json \
tailnet/tailnettest/coordinatormock.go \
tailnet/tailnettest/coordinateemock.go \
tailnet/tailnettest/multiagentmock.go
.PHONY: gen
# Mark all generated files as fresh so make thinks they're up-to-date. This is
# used during releases so we don't run generation scripts.
gen/mark-fresh:
files="\
coderd/database/dump.sql \
coderd/database/querier.go \
coderd/database/dbmock/dbmock.go \
tailnet/proto/tailnet.pb.go \
agent/proto/agent.pb.go \
provisionersdk/proto/provisioner.pb.go \
provisionerd/proto/provisionerd.pb.go \
coderd/database/dump.sql \
$(DB_GEN_FILES) \
site/src/api/typesGenerated.ts \
coderd/rbac/object_gen.go \
docs/admin/prometheus.md \
@@ -467,6 +502,12 @@ gen/mark-fresh:
site/.prettierrc.yaml \
site/.prettierignore \
site/.eslintignore \
site/e2e/provisionerGenerated.ts \
site/src/theme/icons.json \
examples/examples.gen.json \
tailnet/tailnettest/coordinatormock.go \
tailnet/tailnettest/coordinateemock.go \
tailnet/tailnettest/multiagentmock.go \
"
for file in $$files; do
echo "$$file"
@@ -486,13 +527,33 @@ coderd/database/dump.sql: coderd/database/gen/dump/main.go $(wildcard coderd/dat
go run ./coderd/database/gen/dump/main.go
# Generates Go code for querying the database.
coderd/database/querier.go: coderd/database/sqlc.yaml coderd/database/dump.sql $(wildcard coderd/database/queries/*.sql) coderd/database/gen/enum/main.go coderd/database/gen/fake/main.go
# coderd/database/queries.sql.go
# coderd/database/models.go
coderd/database/querier.go: coderd/database/sqlc.yaml coderd/database/dump.sql $(wildcard coderd/database/queries/*.sql)
./coderd/database/generate.sh
coderd/database/dbmock/dbmock.go: coderd/database/db.go coderd/database/querier.go
go generate ./coderd/database/dbmock/
tailnet/tailnettest/coordinatormock.go tailnet/tailnettest/multiagentmock.go tailnet/tailnettest/coordinateemock.go: tailnet/coordinator.go tailnet/multiagent.go
go generate ./tailnet/tailnettest/
tailnet/proto/tailnet.pb.go: tailnet/proto/tailnet.proto
protoc \
--go_out=. \
--go_opt=paths=source_relative \
--go-drpc_out=. \
--go-drpc_opt=paths=source_relative \
./tailnet/proto/tailnet.proto
agent/proto/agent.pb.go: agent/proto/agent.proto
protoc \
--go_out=. \
--go_opt=paths=source_relative \
--go-drpc_out=. \
--go-drpc_opt=paths=source_relative \
./agent/proto/agent.proto
provisionersdk/proto/provisioner.pb.go: provisionersdk/proto/provisioner.proto
protoc \
--go_out=. \
@@ -509,46 +570,83 @@ provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
--go-drpc_opt=paths=source_relative \
./provisionerd/proto/provisionerd.proto
site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
go run scripts/apitypings/main.go > site/src/api/typesGenerated.ts
site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
go run ./scripts/apitypings/ > $@
pnpm run format:write:only "$@"
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
cd site
yarn run format:types
../scripts/pnpm_install.sh
pnpm run gen:provisioner
site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
go run ./scripts/gensite/ -icons "$@"
pnpm run format:write:only "$@"
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
go run ./scripts/examplegen/main.go > examples/examples.gen.json
coderd/rbac/object_gen.go: scripts/rbacgen/main.go coderd/rbac/object.go
go run scripts/rbacgen/main.go ./coderd/rbac > coderd/rbac/object_gen.go
docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
go run scripts/metricsdocgen/main.go
cd site
yarn run format:write:only ../docs/admin/prometheus.md
pnpm run format:write:only ./docs/admin/prometheus.md
docs/cli.md: scripts/clidocgen/main.go $(GO_SRC_FILES)
BASE_PATH="." go run ./scripts/clidocgen
cd site
yarn run format:write:only ../docs/cli.md ../docs/cli/*.md ../docs/manifest.json
docs/cli.md: scripts/clidocgen/main.go examples/examples.gen.json $(GO_SRC_FILES)
CI=true BASE_PATH="." go run ./scripts/clidocgen
pnpm run format:write:only ./docs/cli.md ./docs/cli/*.md ./docs/manifest.json
docs/admin/audit-logs.md: scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
docs/admin/audit-logs.md: coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
go run scripts/auditdocgen/main.go
cd site
yarn run format:write:only ../docs/admin/audit-logs.md
pnpm run format:write:only ./docs/admin/audit-logs.md
coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS) -type f) $(wildcard coderd/*.go) $(wildcard enterprise/coderd/*.go) $(wildcard codersdk/*.go) $(wildcard enterprise/wsproxy/wsproxysdk/*.go) coderd/database/querier.go .swaggo docs/manifest.json coderd/rbac/object_gen.go
coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS) -type f) $(wildcard coderd/*.go) $(wildcard enterprise/coderd/*.go) $(wildcard codersdk/*.go) $(wildcard enterprise/wsproxy/wsproxysdk/*.go) $(DB_GEN_FILES) .swaggo docs/manifest.json coderd/rbac/object_gen.go
./scripts/apidocgen/generate.sh
yarn run --cwd=site format:write:only ../docs/api ../docs/manifest.json ../coderd/apidoc/swagger.json
pnpm run format:write:only ./docs/api ./docs/manifest.json ./coderd/apidoc/swagger.json
update-golden-files: cli/testdata/.gen-golden helm/tests/testdata/.gen-golden scripts/ci-report/testdata/.gen-golden enterprise/cli/testdata/.gen-golden
update-golden-files: \
cli/testdata/.gen-golden \
helm/coder/tests/testdata/.gen-golden \
helm/provisioner/tests/testdata/.gen-golden \
scripts/ci-report/testdata/.gen-golden \
enterprise/cli/testdata/.gen-golden \
enterprise/tailnet/testdata/.gen-golden \
tailnet/testdata/.gen-golden \
coderd/.gen-golden \
provisioner/terraform/testdata/.gen-golden
.PHONY: update-golden-files
cli/testdata/.gen-golden: $(wildcard cli/testdata/*.golden) $(wildcard cli/*.tpl) $(GO_SRC_FILES)
cli/testdata/.gen-golden: $(wildcard cli/testdata/*.golden) $(wildcard cli/*.tpl) $(GO_SRC_FILES) $(wildcard cli/*_test.go)
go test ./cli -run="Test(CommandHelp|ServerYAML)" -update
touch "$@"
enterprise/cli/testdata/.gen-golden: $(wildcard enterprise/cli/testdata/*.golden) $(wildcard cli/*.tpl) $(GO_SRC_FILES)
enterprise/cli/testdata/.gen-golden: $(wildcard enterprise/cli/testdata/*.golden) $(wildcard cli/*.tpl) $(GO_SRC_FILES) $(wildcard enterprise/cli/*_test.go)
go test ./enterprise/cli -run="TestEnterpriseCommandHelp" -update
touch "$@"
helm/tests/testdata/.gen-golden: $(wildcard helm/tests/testdata/*.yaml) $(wildcard helm/tests/testdata/*.golden) $(GO_SRC_FILES)
go test ./helm/tests -run=TestUpdateGoldenFiles -update
tailnet/testdata/.gen-golden: $(wildcard tailnet/testdata/*.golden.html) $(GO_SRC_FILES) $(wildcard tailnet/*_test.go)
go test ./tailnet -run="TestDebugTemplate" -update
touch "$@"
enterprise/tailnet/testdata/.gen-golden: $(wildcard enterprise/tailnet/testdata/*.golden.html) $(GO_SRC_FILES) $(wildcard enterprise/tailnet/*_test.go)
go test ./enterprise/tailnet -run="TestDebugTemplate" -update
touch "$@"
helm/coder/tests/testdata/.gen-golden: $(wildcard helm/coder/tests/testdata/*.yaml) $(wildcard helm/coder/tests/testdata/*.golden) $(GO_SRC_FILES) $(wildcard helm/coder/tests/*_test.go)
go test ./helm/coder/tests -run=TestUpdateGoldenFiles -update
touch "$@"
helm/provisioner/tests/testdata/.gen-golden: $(wildcard helm/provisioner/tests/testdata/*.yaml) $(wildcard helm/provisioner/tests/testdata/*.golden) $(GO_SRC_FILES) $(wildcard helm/provisioner/tests/*_test.go)
go test ./helm/provisioner/tests -run=TestUpdateGoldenFiles -update
touch "$@"
coderd/.gen-golden: $(wildcard coderd/testdata/*/*.golden) $(GO_SRC_FILES) $(wildcard coderd/*_test.go)
go test ./coderd -run="Test.*Golden$$" -update
touch "$@"
provisioner/terraform/testdata/.gen-golden: $(wildcard provisioner/terraform/testdata/*/*.golden) $(GO_SRC_FILES) $(wildcard provisioner/terraform/*_test.go)
go test ./provisioner/terraform -run="Test.*Golden$$" -update
touch "$@"
scripts/ci-report/testdata/.gen-golden: $(wildcard scripts/ci-report/testdata/*) $(wildcard scripts/ci-report/*.go)
@@ -569,7 +667,7 @@ site/.prettierrc.yaml: .prettierrc.yaml
# - ./ -> ../
# - ./site -> ./
yq \
'.overrides[].files |= map(. | sub("^./"; "") | sub("^"; "../") | sub("../site/"; "./"))' \
'.overrides[].files |= map(. | sub("^./"; "") | sub("^"; "../") | sub("../site/"; "./") | sub("../!"; "!../"))' \
"$<" >> "$@"
# Combine .gitignore with .prettierignore.include to generate .prettierignore.
@@ -615,14 +713,41 @@ site/.eslintignore site/.prettierignore: .prettierignore Makefile
echo "$${ignore}$${rule}" >> "$@"
done < "$<"
test: test-clean
gotestsum --format standard-quiet -- -v -short ./...
test:
gotestsum --format standard-quiet -- -v -short -count=1 ./...
.PHONY: test
# sqlc-cloud-is-setup will fail if no SQLc auth token is set. Use this as a
# dependency for any sqlc-cloud related targets.
sqlc-cloud-is-setup:
if [[ "$(SQLC_AUTH_TOKEN)" == "" ]]; then
echo "ERROR: 'SQLC_AUTH_TOKEN' must be set to auth with sqlc cloud before running verify." 1>&2
exit 1
fi
.PHONY: sqlc-cloud-is-setup
sqlc-push: sqlc-cloud-is-setup test-postgres-docker
echo "--- sqlc push"
SQLC_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/$(shell go run scripts/migrate-ci/main.go)" \
sqlc push -f coderd/database/sqlc.yaml && echo "Passed sqlc push"
.PHONY: sqlc-push
sqlc-verify: sqlc-cloud-is-setup test-postgres-docker
echo "--- sqlc verify"
SQLC_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/$(shell go run scripts/migrate-ci/main.go)" \
sqlc verify -f coderd/database/sqlc.yaml && echo "Passed sqlc verify"
.PHONY: sqlc-verify
sqlc-vet: test-postgres-docker
echo "--- sqlc vet"
SQLC_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/$(shell go run scripts/migrate-ci/main.go)" \
sqlc vet -f coderd/database/sqlc.yaml && echo "Passed sqlc vet"
.PHONY: sqlc-vet
# When updating -timeout for this test, keep in sync with
# test-go-postgres (.github/workflows/coder.yaml).
# Do add coverage flags so that test caching works.
test-postgres: test-clean test-postgres-docker
test-postgres: test-postgres-docker
# The postgres test is prone to failure, so we limit parallelism for
# more consistent execution.
DB=ci DB_FROM=$(shell go run scripts/migrate-ci/main.go) gotestsum \
@@ -630,7 +755,8 @@ test-postgres: test-clean test-postgres-docker
--jsonfile="gotests.json" \
--packages="./..." -- \
-timeout=20m \
-failfast
-failfast \
-count=1
.PHONY: test-postgres
test-postgres-docker:
@@ -661,6 +787,14 @@ test-postgres-docker:
done
.PHONY: test-postgres-docker
# Make sure to keep this in sync with test-go-race from .github/workflows/ci.yaml.
test-race:
gotestsum --junitfile="gotests.xml" -- -race -count=1 ./...
.PHONY: test-race
# Note: we used to add this to the test target, but it's not necessary and we can
# achieve the desired result by specifying -count=1 in the go test invocation
# instead. Keeping it here for convenience.
test-clean:
go clean -testcache
.PHONY: test-clean
+7 -7
View File
@@ -7,7 +7,7 @@
</a>
<h1>
Self-Hosted Remote Development Environments
Self-Hosted Cloud Development Environments
</h1>
<a href="https://coder.com#gh-light-mode-only">
@@ -31,9 +31,9 @@
</div>
[Coder](https://coder.com) enables organizations to set up development environments in the cloud. Environments are defined with Terraform, connected through a secure high-speed Wireguard® tunnel, and are automatically shut down when not in use to save on costs. Coder gives engineering teams the flexibility to use the cloud for workloads that are most beneficial to them.
[Coder](https://coder.com) enables organizations to set up development environments in their public or private cloud infrastructure. Cloud development environments are defined with Terraform, connected through a secure high-speed Wireguard® tunnel, and are automatically shut down when not in use to save on costs. Coder gives engineering teams the flexibility to use the cloud for workloads that are most beneficial to them.
- Define development environments in Terraform
- Define cloud development environments in Terraform
- EC2 VMs, Kubernetes Pods, Docker Containers, etc.
- Automatically shutdown idle resources to save on costs
- Onboard developers in seconds instead of days
@@ -44,7 +44,7 @@
## Quickstart
The most convenient way to try Coder is to install it on your local machine and experiment with provisioning development environments using Docker (works on Linux, macOS, and Windows).
The most convenient way to try Coder is to install it on your local machine and experiment with provisioning cloud development environments using Docker (works on Linux, macOS, and Windows).
```
# First, install Coder
@@ -70,11 +70,11 @@ curl -L https://coder.com/install.sh | sh
You can run the install script with `--dry-run` to see the commands that will be used to install without executing them. You can modify the installation process by including flags. Run the install script with `--help` for reference.
> See [install](docs/install) for additional methods.
> See [install](https://coder.com/docs/v2/latest/install) for additional methods.
Once installed, you can start a production deployment<sup>1</sup> with a single command:
```console
```shell
# Automatically sets up an external access URL on *.try.coder.app
coder server
@@ -100,7 +100,7 @@ Browse our docs [here](https://coder.com/docs/v2) or visit a specific section be
Feel free to [open an issue](https://github.com/coder/coder/issues/new) if you have questions, run into bugs, or have a feature request.
[Join our Discord](https://discord.gg/coder) to provide feedback on in-progress features, and chat with the community using Coder!
[Join our Discord](https://discord.gg/coder) or [Slack](https://cdr.co/join-community) to provide feedback on in-progress features, and chat with the community using Coder!
## Contributing
+47 -39
View File
@@ -1,7 +1,7 @@
# Coder Security
Coder welcomes feedback from security researchers and the general public
to help improve our security. If you believe you have discovered a vulnerability,
Coder welcomes feedback from security researchers and the general public to help
improve our security. If you believe you have discovered a vulnerability,
privacy issue, exposed data, or other security issues in any of our assets, we
want to hear from you. This policy outlines steps for reporting vulnerabilities
to us, what we expect, what you can expect from us.
@@ -10,64 +10,72 @@ You can see the pretty version [here](https://coder.com/security/policy)
# Why Coder's security matters
If an attacker could fully compromise a Coder installation, they could spin
up expensive workstations, steal valuable credentials, or steal proprietary
source code. We take this risk very seriously and employ routine pen testing,
vulnerability scanning, and code reviews. We also welcome the contributions
from the community that helped make this product possible.
If an attacker could fully compromise a Coder installation, they could spin up
expensive workstations, steal valuable credentials, or steal proprietary source
code. We take this risk very seriously and employ routine pen testing,
vulnerability scanning, and code reviews. We also welcome the contributions from
the community that helped make this product possible.
# Where should I report security issues?
Please report security issues to security@coder.com, providing
all relevant information. The more details you provide, the easier it will be
for us to triage and fix the issue.
Please report security issues to security@coder.com, providing all relevant
information. The more details you provide, the easier it will be for us to
triage and fix the issue.
# Out of Scope
Our primary concern is around an abuse of the Coder application that allows
an attacker to gain access to another users workspace, or spin up unwanted
Our primary concern is around an abuse of the Coder application that allows an
attacker to gain access to another users workspace, or spin up unwanted
workspaces.
- DOS/DDOS attacks affecting availability --> While we do support rate limiting
of requests, we primarily leave this to the owner of the Coder installation. Our
rationale is that a DOS attack only affecting availability is not a valuable
target for attackers.
of requests, we primarily leave this to the owner of the Coder installation.
Our rationale is that a DOS attack only affecting availability is not a
valuable target for attackers.
- Abuse of a compromised user credential --> If a user credential is compromised
outside of the Coder ecosystem, then we consider it beyond the scope of our application.
However, if an unprivileged user could escalate their permissions or gain access
to another workspace, that is a cause for concern.
outside of the Coder ecosystem, then we consider it beyond the scope of our
application. However, if an unprivileged user could escalate their permissions
or gain access to another workspace, that is a cause for concern.
- Vulnerabilities in third party systems --> Vulnerabilities discovered in
out-of-scope systems should be reported to the appropriate vendor or applicable authority.
out-of-scope systems should be reported to the appropriate vendor or
applicable authority.
# Our Commitments
When working with us, according to this policy, you can expect us to:
- Respond to your report promptly, and work with you to understand and validate your report;
- Strive to keep you informed about the progress of a vulnerability as it is processed;
- Work to remediate discovered vulnerabilities in a timely manner, within our operational constraints; and
- Extend Safe Harbor for your vulnerability research that is related to this policy.
- Respond to your report promptly, and work with you to understand and validate
your report;
- Strive to keep you informed about the progress of a vulnerability as it is
processed;
- Work to remediate discovered vulnerabilities in a timely manner, within our
operational constraints; and
- Extend Safe Harbor for your vulnerability research that is related to this
policy.
# Our Expectations
In participating in our vulnerability disclosure program in good faith, we ask that you:
In participating in our vulnerability disclosure program in good faith, we ask
that you:
- Play by the rules, including following this policy and any other relevant agreements.
If there is any inconsistency between this policy and any other applicable terms, the
terms of this policy will prevail;
- Play by the rules, including following this policy and any other relevant
agreements. If there is any inconsistency between this policy and any other
applicable terms, the terms of this policy will prevail;
- Report any vulnerability youve discovered promptly;
- Avoid violating the privacy of others, disrupting our systems, destroying data, and/or
harming user experience;
- Avoid violating the privacy of others, disrupting our systems, destroying
data, and/or harming user experience;
- Use only the Official Channels to discuss vulnerability information with us;
- Provide us a reasonable amount of time (at least 90 days from the initial report) to
resolve the issue before you disclose it publicly;
- Perform testing only on in-scope systems, and respect systems and activities which
are out-of-scope;
- If a vulnerability provides unintended access to data: Limit the amount of data you
access to the minimum required for effectively demonstrating a Proof of Concept; and
cease testing and submit a report immediately if you encounter any user data during testing,
such as Personally Identifiable Information (PII), Personal Healthcare Information (PHI),
credit card data, or proprietary information;
- You should only interact with test accounts you own or with explicit permission from
- Provide us a reasonable amount of time (at least 90 days from the initial
report) to resolve the issue before you disclose it publicly;
- Perform testing only on in-scope systems, and respect systems and activities
which are out-of-scope;
- If a vulnerability provides unintended access to data: Limit the amount of
data you access to the minimum required for effectively demonstrating a Proof
of Concept; and cease testing and submit a report immediately if you encounter
any user data during testing, such as Personally Identifiable Information
(PII), Personal Healthcare Information (PHI), credit card data, or proprietary
information;
- You should only interact with test accounts you own or with explicit
permission from
- the account holder; and
- Do not engage in extortion.
+756 -657
View File
File diff suppressed because it is too large Load Diff
+1294 -844
View File
File diff suppressed because it is too large Load Diff
+5
View File
@@ -0,0 +1,5 @@
// Package agentproctest contains utility functions
// for testing process management in the agent.
package agentproctest
//go:generate mockgen -destination ./syscallermock.go -package agentproctest github.com/coder/coder/v2/agent/agentproc Syscaller
+49
View File
@@ -0,0 +1,49 @@
package agentproctest
import (
"fmt"
"testing"
"github.com/spf13/afero"
"github.com/stretchr/testify/require"
"github.com/coder/coder/v2/agent/agentproc"
"github.com/coder/coder/v2/cryptorand"
)
func GenerateProcess(t *testing.T, fs afero.Fs, muts ...func(*agentproc.Process)) agentproc.Process {
t.Helper()
pid, err := cryptorand.Intn(1<<31 - 1)
require.NoError(t, err)
arg1, err := cryptorand.String(5)
require.NoError(t, err)
arg2, err := cryptorand.String(5)
require.NoError(t, err)
arg3, err := cryptorand.String(5)
require.NoError(t, err)
cmdline := fmt.Sprintf("%s\x00%s\x00%s", arg1, arg2, arg3)
process := agentproc.Process{
CmdLine: cmdline,
PID: int32(pid),
}
for _, mut := range muts {
mut(&process)
}
process.Dir = fmt.Sprintf("%s/%d", "/proc", process.PID)
err = fs.MkdirAll(process.Dir, 0o555)
require.NoError(t, err)
err = afero.WriteFile(fs, fmt.Sprintf("%s/cmdline", process.Dir), []byte(process.CmdLine), 0o444)
require.NoError(t, err)
return process
}
@@ -0,0 +1,83 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/coder/coder/v2/agent/agentproc (interfaces: Syscaller)
//
// Generated by this command:
//
// mockgen -destination ./syscallermock.go -package agentproctest github.com/coder/coder/v2/agent/agentproc Syscaller
//
// Package agentproctest is a generated GoMock package.
package agentproctest
import (
reflect "reflect"
syscall "syscall"
gomock "go.uber.org/mock/gomock"
)
// MockSyscaller is a mock of Syscaller interface.
type MockSyscaller struct {
ctrl *gomock.Controller
recorder *MockSyscallerMockRecorder
}
// MockSyscallerMockRecorder is the mock recorder for MockSyscaller.
type MockSyscallerMockRecorder struct {
mock *MockSyscaller
}
// NewMockSyscaller creates a new mock instance.
func NewMockSyscaller(ctrl *gomock.Controller) *MockSyscaller {
mock := &MockSyscaller{ctrl: ctrl}
mock.recorder = &MockSyscallerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockSyscaller) EXPECT() *MockSyscallerMockRecorder {
return m.recorder
}
// GetPriority mocks base method.
func (m *MockSyscaller) GetPriority(arg0 int32) (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetPriority", arg0)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetPriority indicates an expected call of GetPriority.
func (mr *MockSyscallerMockRecorder) GetPriority(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPriority", reflect.TypeOf((*MockSyscaller)(nil).GetPriority), arg0)
}
// Kill mocks base method.
func (m *MockSyscaller) Kill(arg0 int32, arg1 syscall.Signal) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Kill", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// Kill indicates an expected call of Kill.
func (mr *MockSyscallerMockRecorder) Kill(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Kill", reflect.TypeOf((*MockSyscaller)(nil).Kill), arg0, arg1)
}
// SetPriority mocks base method.
func (m *MockSyscaller) SetPriority(arg0 int32, arg1 int) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetPriority", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// SetPriority indicates an expected call of SetPriority.
func (mr *MockSyscallerMockRecorder) SetPriority(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPriority", reflect.TypeOf((*MockSyscaller)(nil).SetPriority), arg0, arg1)
}
+3
View File
@@ -0,0 +1,3 @@
// Package agentproc contains logic for interfacing with local
// processes running in the same context as the agent.
package agentproc
+24
View File
@@ -0,0 +1,24 @@
//go:build !linux
// +build !linux
package agentproc
import (
"github.com/spf13/afero"
)
func (*Process) Niceness(Syscaller) (int, error) {
return 0, errUnimplemented
}
func (*Process) SetNiceness(Syscaller, int) error {
return errUnimplemented
}
func (*Process) Cmd() string {
return ""
}
func List(afero.Fs, Syscaller) ([]*Process, error) {
return nil, errUnimplemented
}
+166
View File
@@ -0,0 +1,166 @@
package agentproc_test
import (
"runtime"
"syscall"
"testing"
"github.com/spf13/afero"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"golang.org/x/xerrors"
"github.com/coder/coder/v2/agent/agentproc"
"github.com/coder/coder/v2/agent/agentproc/agentproctest"
)
func TestList(t *testing.T) {
t.Parallel()
if runtime.GOOS != "linux" {
t.Skipf("skipping non-linux environment")
}
t.Run("OK", func(t *testing.T) {
t.Parallel()
var (
fs = afero.NewMemMapFs()
sc = agentproctest.NewMockSyscaller(gomock.NewController(t))
expectedProcs = make(map[int32]agentproc.Process)
)
for i := 0; i < 4; i++ {
proc := agentproctest.GenerateProcess(t, fs)
expectedProcs[proc.PID] = proc
sc.EXPECT().
Kill(proc.PID, syscall.Signal(0)).
Return(nil)
}
actualProcs, err := agentproc.List(fs, sc)
require.NoError(t, err)
require.Len(t, actualProcs, len(expectedProcs))
for _, proc := range actualProcs {
expected, ok := expectedProcs[proc.PID]
require.True(t, ok)
require.Equal(t, expected.PID, proc.PID)
require.Equal(t, expected.CmdLine, proc.CmdLine)
require.Equal(t, expected.Dir, proc.Dir)
}
})
t.Run("FinishedProcess", func(t *testing.T) {
t.Parallel()
var (
fs = afero.NewMemMapFs()
sc = agentproctest.NewMockSyscaller(gomock.NewController(t))
expectedProcs = make(map[int32]agentproc.Process)
)
for i := 0; i < 3; i++ {
proc := agentproctest.GenerateProcess(t, fs)
expectedProcs[proc.PID] = proc
sc.EXPECT().
Kill(proc.PID, syscall.Signal(0)).
Return(nil)
}
// Create a process that's already finished. We're not adding
// it to the map because it should be skipped over.
proc := agentproctest.GenerateProcess(t, fs)
sc.EXPECT().
Kill(proc.PID, syscall.Signal(0)).
Return(xerrors.New("os: process already finished"))
actualProcs, err := agentproc.List(fs, sc)
require.NoError(t, err)
require.Len(t, actualProcs, len(expectedProcs))
for _, proc := range actualProcs {
expected, ok := expectedProcs[proc.PID]
require.True(t, ok)
require.Equal(t, expected.PID, proc.PID)
require.Equal(t, expected.CmdLine, proc.CmdLine)
require.Equal(t, expected.Dir, proc.Dir)
}
})
t.Run("NoSuchProcess", func(t *testing.T) {
t.Parallel()
var (
fs = afero.NewMemMapFs()
sc = agentproctest.NewMockSyscaller(gomock.NewController(t))
expectedProcs = make(map[int32]agentproc.Process)
)
for i := 0; i < 3; i++ {
proc := agentproctest.GenerateProcess(t, fs)
expectedProcs[proc.PID] = proc
sc.EXPECT().
Kill(proc.PID, syscall.Signal(0)).
Return(nil)
}
// Create a process that doesn't exist. We're not adding
// it to the map because it should be skipped over.
proc := agentproctest.GenerateProcess(t, fs)
sc.EXPECT().
Kill(proc.PID, syscall.Signal(0)).
Return(syscall.ESRCH)
actualProcs, err := agentproc.List(fs, sc)
require.NoError(t, err)
require.Len(t, actualProcs, len(expectedProcs))
for _, proc := range actualProcs {
expected, ok := expectedProcs[proc.PID]
require.True(t, ok)
require.Equal(t, expected.PID, proc.PID)
require.Equal(t, expected.CmdLine, proc.CmdLine)
require.Equal(t, expected.Dir, proc.Dir)
}
})
}
// These tests are not very interesting but they provide some modicum of
// confidence.
func TestProcess(t *testing.T) {
t.Parallel()
if runtime.GOOS != "linux" {
t.Skipf("skipping non-linux environment")
}
t.Run("SetNiceness", func(t *testing.T) {
t.Parallel()
var (
sc = agentproctest.NewMockSyscaller(gomock.NewController(t))
proc = &agentproc.Process{
PID: 32,
}
score = 20
)
sc.EXPECT().SetPriority(proc.PID, score).Return(nil)
err := proc.SetNiceness(sc, score)
require.NoError(t, err)
})
t.Run("Cmd", func(t *testing.T) {
t.Parallel()
var (
proc = &agentproc.Process{
CmdLine: "helloworld\x00--arg1\x00--arg2",
}
expectedName = "helloworld --arg1 --arg2"
)
require.Equal(t, expectedName, proc.Cmd())
})
}
+109
View File
@@ -0,0 +1,109 @@
//go:build linux
// +build linux
package agentproc
import (
"errors"
"path/filepath"
"strconv"
"strings"
"syscall"
"github.com/spf13/afero"
"golang.org/x/xerrors"
)
func List(fs afero.Fs, syscaller Syscaller) ([]*Process, error) {
d, err := fs.Open(defaultProcDir)
if err != nil {
return nil, xerrors.Errorf("open dir %q: %w", defaultProcDir, err)
}
defer d.Close()
entries, err := d.Readdirnames(0)
if err != nil {
return nil, xerrors.Errorf("readdirnames: %w", err)
}
processes := make([]*Process, 0, len(entries))
for _, entry := range entries {
pid, err := strconv.ParseInt(entry, 10, 32)
if err != nil {
continue
}
// Check that the process still exists.
exists, err := isProcessExist(syscaller, int32(pid))
if err != nil {
return nil, xerrors.Errorf("check process exists: %w", err)
}
if !exists {
continue
}
cmdline, err := afero.ReadFile(fs, filepath.Join(defaultProcDir, entry, "cmdline"))
if err != nil {
var errNo syscall.Errno
if xerrors.As(err, &errNo) && errNo == syscall.EPERM {
continue
}
return nil, xerrors.Errorf("read cmdline: %w", err)
}
processes = append(processes, &Process{
PID: int32(pid),
CmdLine: string(cmdline),
Dir: filepath.Join(defaultProcDir, entry),
})
}
return processes, nil
}
func isProcessExist(syscaller Syscaller, pid int32) (bool, error) {
err := syscaller.Kill(pid, syscall.Signal(0))
if err == nil {
return true, nil
}
if err.Error() == "os: process already finished" {
return false, nil
}
var errno syscall.Errno
if !errors.As(err, &errno) {
return false, err
}
switch errno {
case syscall.ESRCH:
return false, nil
case syscall.EPERM:
return true, nil
}
return false, xerrors.Errorf("kill: %w", err)
}
func (p *Process) Niceness(sc Syscaller) (int, error) {
nice, err := sc.GetPriority(p.PID)
if err != nil {
return 0, xerrors.Errorf("get priority for %q: %w", p.CmdLine, err)
}
return nice, nil
}
func (p *Process) SetNiceness(sc Syscaller, score int) error {
err := sc.SetPriority(p.PID, score)
if err != nil {
return xerrors.Errorf("set priority for %q: %w", p.CmdLine, err)
}
return nil
}
func (p *Process) Cmd() string {
return strings.Join(p.cmdLine(), " ")
}
func (p *Process) cmdLine() []string {
return strings.Split(p.CmdLine, "\x00")
}
+20
View File
@@ -0,0 +1,20 @@
package agentproc
import (
"syscall"
)
type Syscaller interface {
SetPriority(pid int32, priority int) error
GetPriority(pid int32) (int, error)
Kill(pid int32, sig syscall.Signal) error
}
// nolint: unused // used on some but no all platforms
const defaultProcDir = "/proc"
type Process struct {
Dir string
CmdLine string
PID int32
}
+30
View File
@@ -0,0 +1,30 @@
//go:build !linux
// +build !linux
package agentproc
import (
"syscall"
"golang.org/x/xerrors"
)
func NewSyscaller() Syscaller {
return nopSyscaller{}
}
var errUnimplemented = xerrors.New("unimplemented")
type nopSyscaller struct{}
func (nopSyscaller) SetPriority(int32, int) error {
return errUnimplemented
}
func (nopSyscaller) GetPriority(int32) (int, error) {
return 0, errUnimplemented
}
func (nopSyscaller) Kill(int32, syscall.Signal) error {
return errUnimplemented
}
+42
View File
@@ -0,0 +1,42 @@
//go:build linux
// +build linux
package agentproc
import (
"syscall"
"golang.org/x/sys/unix"
"golang.org/x/xerrors"
)
func NewSyscaller() Syscaller {
return UnixSyscaller{}
}
type UnixSyscaller struct{}
func (UnixSyscaller) SetPriority(pid int32, nice int) error {
err := unix.Setpriority(unix.PRIO_PROCESS, int(pid), nice)
if err != nil {
return xerrors.Errorf("set priority: %w", err)
}
return nil
}
func (UnixSyscaller) GetPriority(pid int32) (int, error) {
nice, err := unix.Getpriority(0, int(pid))
if err != nil {
return 0, xerrors.Errorf("get priority: %w", err)
}
return nice, nil
}
func (UnixSyscaller) Kill(pid int32, sig syscall.Signal) error {
err := syscall.Kill(int(pid), sig)
if err != nil {
return xerrors.Errorf("kill: %w", err)
}
return nil
}
+357
View File
@@ -0,0 +1,357 @@
package agentscripts
import (
"context"
"errors"
"fmt"
"io"
"os"
"os/exec"
"os/user"
"path/filepath"
"sync"
"sync/atomic"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/robfig/cron/v3"
"github.com/spf13/afero"
"golang.org/x/sync/errgroup"
"golang.org/x/xerrors"
"cdr.dev/slog"
"github.com/coder/coder/v2/agent/agentssh"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
)
var (
// ErrTimeout is returned when a script times out.
ErrTimeout = xerrors.New("script timed out")
// ErrOutputPipesOpen is returned when a script exits leaving the output
// pipe(s) (stdout, stderr) open. This happens because we set WaitDelay on
// the command, which gives us two things:
//
// 1. The ability to ensure that a script exits (this is important for e.g.
// blocking login, and avoiding doing so indefinitely)
// 2. Improved command cancellation on timeout
ErrOutputPipesOpen = xerrors.New("script exited without closing output pipes")
parser = cron.NewParser(cron.Second | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.DowOptional)
)
// Options are a set of options for the runner.
type Options struct {
LogDir string
Logger slog.Logger
SSHServer *agentssh.Server
Filesystem afero.Fs
PatchLogs func(ctx context.Context, req agentsdk.PatchLogs) error
}
// New creates a runner for the provided scripts.
func New(opts Options) *Runner {
cronCtx, cronCtxCancel := context.WithCancel(context.Background())
return &Runner{
Options: opts,
cronCtx: cronCtx,
cronCtxCancel: cronCtxCancel,
cron: cron.New(cron.WithParser(parser)),
closed: make(chan struct{}),
scriptsExecuted: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "agent",
Subsystem: "scripts",
Name: "executed_total",
}, []string{"success"}),
}
}
type Runner struct {
Options
cronCtx context.Context
cronCtxCancel context.CancelFunc
cmdCloseWait sync.WaitGroup
closed chan struct{}
closeMutex sync.Mutex
cron *cron.Cron
initialized atomic.Bool
scripts []codersdk.WorkspaceAgentScript
// scriptsExecuted includes all scripts executed by the workspace agent. Agents
// execute startup scripts, and scripts on a cron schedule. Both will increment
// this counter.
scriptsExecuted *prometheus.CounterVec
}
func (r *Runner) RegisterMetrics(reg prometheus.Registerer) {
if reg == nil {
// If no registry, do nothing.
return
}
reg.MustRegister(r.scriptsExecuted)
}
// Init initializes the runner with the provided scripts.
// It also schedules any scripts that have a schedule.
// This function must be called before Execute.
func (r *Runner) Init(scripts []codersdk.WorkspaceAgentScript) error {
if r.initialized.Load() {
return xerrors.New("init: already initialized")
}
r.initialized.Store(true)
r.scripts = scripts
r.Logger.Info(r.cronCtx, "initializing agent scripts", slog.F("script_count", len(scripts)), slog.F("log_dir", r.LogDir))
for _, script := range scripts {
if script.Cron == "" {
continue
}
script := script
_, err := r.cron.AddFunc(script.Cron, func() {
err := r.trackRun(r.cronCtx, script)
if err != nil {
r.Logger.Warn(context.Background(), "run agent script on schedule", slog.Error(err))
}
})
if err != nil {
return xerrors.Errorf("add schedule: %w", err)
}
}
return nil
}
// StartCron starts the cron scheduler.
// This is done async to allow for the caller to execute scripts prior.
func (r *Runner) StartCron() {
// cron.Start() and cron.Stop() does not guarantee that the cron goroutine
// has exited by the time the `cron.Stop()` context returns, so we need to
// track it manually.
err := r.trackCommandGoroutine(func() {
// Since this is run async, in quick unit tests, it is possible the
// Close() function gets called before we even start the cron.
// In these cases, the Run() will never end.
// So if we are closed, we just return, and skip the Run() entirely.
select {
case <-r.cronCtx.Done():
// The cronCtx is canceled before cron.Close() happens. So if the ctx is
// canceled, then Close() will be called, or it is about to be called.
// So do nothing!
default:
r.cron.Run()
}
})
if err != nil {
r.Logger.Warn(context.Background(), "start cron failed", slog.Error(err))
}
}
// Execute runs a set of scripts according to a filter.
func (r *Runner) Execute(ctx context.Context, filter func(script codersdk.WorkspaceAgentScript) bool) error {
if filter == nil {
// Execute em' all!
filter = func(script codersdk.WorkspaceAgentScript) bool {
return true
}
}
var eg errgroup.Group
for _, script := range r.scripts {
if !filter(script) {
continue
}
script := script
eg.Go(func() error {
err := r.trackRun(ctx, script)
if err != nil {
return xerrors.Errorf("run agent script %q: %w", script.LogSourceID, err)
}
return nil
})
}
return eg.Wait()
}
// trackRun wraps "run" with metrics.
func (r *Runner) trackRun(ctx context.Context, script codersdk.WorkspaceAgentScript) error {
err := r.run(ctx, script)
if err != nil {
r.scriptsExecuted.WithLabelValues("false").Add(1)
} else {
r.scriptsExecuted.WithLabelValues("true").Add(1)
}
return err
}
// run executes the provided script with the timeout.
// If the timeout is exceeded, the process is sent an interrupt signal.
// If the process does not exit after a few seconds, it is forcefully killed.
// This function immediately returns after a timeout, and does not wait for the process to exit.
func (r *Runner) run(ctx context.Context, script codersdk.WorkspaceAgentScript) error {
logPath := script.LogPath
if logPath == "" {
logPath = fmt.Sprintf("coder-script-%s.log", script.LogSourceID)
}
if logPath[0] == '~' {
// First we check the environment.
homeDir, err := os.UserHomeDir()
if err != nil {
u, err := user.Current()
if err != nil {
return xerrors.Errorf("current user: %w", err)
}
homeDir = u.HomeDir
}
logPath = filepath.Join(homeDir, logPath[1:])
}
logPath = os.ExpandEnv(logPath)
if !filepath.IsAbs(logPath) {
logPath = filepath.Join(r.LogDir, logPath)
}
logger := r.Logger.With(slog.F("log_path", logPath))
logger.Info(ctx, "running agent script", slog.F("script", script.Script))
fileWriter, err := r.Filesystem.OpenFile(logPath, os.O_CREATE|os.O_RDWR, 0o600)
if err != nil {
return xerrors.Errorf("open %s script log file: %w", logPath, err)
}
defer func() {
err := fileWriter.Close()
if err != nil {
logger.Warn(ctx, fmt.Sprintf("close %s script log file", logPath), slog.Error(err))
}
}()
var cmd *exec.Cmd
cmdCtx := ctx
if script.Timeout > 0 {
var ctxCancel context.CancelFunc
cmdCtx, ctxCancel = context.WithTimeout(ctx, script.Timeout)
defer ctxCancel()
}
cmdPty, err := r.SSHServer.CreateCommand(cmdCtx, script.Script, nil)
if err != nil {
return xerrors.Errorf("%s script: create command: %w", logPath, err)
}
cmd = cmdPty.AsExec()
cmd.SysProcAttr = cmdSysProcAttr()
cmd.WaitDelay = 10 * time.Second
cmd.Cancel = cmdCancel(cmd)
send, flushAndClose := agentsdk.LogsSender(script.LogSourceID, r.PatchLogs, logger)
// If ctx is canceled here (or in a writer below), we may be
// discarding logs, but that's okay because we're shutting down
// anyway. We could consider creating a new context here if we
// want better control over flush during shutdown.
defer func() {
if err := flushAndClose(ctx); err != nil {
logger.Warn(ctx, "flush startup logs failed", slog.Error(err))
}
}()
infoW := agentsdk.LogsWriter(ctx, send, script.LogSourceID, codersdk.LogLevelInfo)
defer infoW.Close()
errW := agentsdk.LogsWriter(ctx, send, script.LogSourceID, codersdk.LogLevelError)
defer errW.Close()
cmd.Stdout = io.MultiWriter(fileWriter, infoW)
cmd.Stderr = io.MultiWriter(fileWriter, errW)
start := time.Now()
defer func() {
end := time.Now()
execTime := end.Sub(start)
exitCode := 0
if err != nil {
exitCode = 255 // Unknown status.
var exitError *exec.ExitError
if xerrors.As(err, &exitError) {
exitCode = exitError.ExitCode()
}
logger.Warn(ctx, fmt.Sprintf("%s script failed", logPath), slog.F("execution_time", execTime), slog.F("exit_code", exitCode), slog.Error(err))
} else {
logger.Info(ctx, fmt.Sprintf("%s script completed", logPath), slog.F("execution_time", execTime), slog.F("exit_code", exitCode))
}
}()
err = cmd.Start()
if err != nil {
if errors.Is(err, context.DeadlineExceeded) {
return ErrTimeout
}
return xerrors.Errorf("%s script: start command: %w", logPath, err)
}
cmdDone := make(chan error, 1)
err = r.trackCommandGoroutine(func() {
cmdDone <- cmd.Wait()
})
if err != nil {
return xerrors.Errorf("%s script: track command goroutine: %w", logPath, err)
}
select {
case <-cmdCtx.Done():
// Wait for the command to drain!
select {
case <-cmdDone:
case <-time.After(10 * time.Second):
}
err = cmdCtx.Err()
case err = <-cmdDone:
}
switch {
case errors.Is(err, exec.ErrWaitDelay):
err = ErrOutputPipesOpen
message := fmt.Sprintf("script exited successfully, but output pipes were not closed after %s", cmd.WaitDelay)
details := fmt.Sprint(
"This usually means a child process was started with references to stdout or stderr. As a result, this " +
"process may now have been terminated. Consider redirecting the output or using a separate " +
"\"coder_script\" for the process, see " +
"https://coder.com/docs/v2/latest/templates/troubleshooting#startup-script-issues for more information.",
)
// Inform the user by propagating the message via log writers.
_, _ = fmt.Fprintf(cmd.Stderr, "WARNING: %s. %s\n", message, details)
// Also log to agent logs for ease of debugging.
r.Logger.Warn(ctx, message, slog.F("details", details), slog.Error(err))
case errors.Is(err, context.DeadlineExceeded):
err = ErrTimeout
}
return err
}
func (r *Runner) Close() error {
r.closeMutex.Lock()
defer r.closeMutex.Unlock()
if r.isClosed() {
return nil
}
close(r.closed)
// Must cancel the cron ctx BEFORE stopping the cron.
r.cronCtxCancel()
<-r.cron.Stop().Done()
r.cmdCloseWait.Wait()
return nil
}
func (r *Runner) trackCommandGoroutine(fn func()) error {
r.closeMutex.Lock()
defer r.closeMutex.Unlock()
if r.isClosed() {
return xerrors.New("track command goroutine: closed")
}
r.cmdCloseWait.Add(1)
go func() {
defer r.cmdCloseWait.Done()
fn()
}()
return nil
}
func (r *Runner) isClosed() bool {
select {
case <-r.closed:
return true
default:
return false
}
}
+20
View File
@@ -0,0 +1,20 @@
//go:build !windows
package agentscripts
import (
"os/exec"
"syscall"
)
func cmdSysProcAttr() *syscall.SysProcAttr {
return &syscall.SysProcAttr{
Setsid: true,
}
}
func cmdCancel(cmd *exec.Cmd) func() error {
return func() error {
return syscall.Kill(-cmd.Process.Pid, syscall.SIGHUP)
}
}
+89
View File
@@ -0,0 +1,89 @@
package agentscripts_test
import (
"context"
"testing"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/afero"
"github.com/stretchr/testify/require"
"go.uber.org/atomic"
"go.uber.org/goleak"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/v2/agent/agentscripts"
"github.com/coder/coder/v2/agent/agentssh"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
func TestExecuteBasic(t *testing.T) {
t.Parallel()
logs := make(chan agentsdk.PatchLogs, 1)
runner := setup(t, func(ctx context.Context, req agentsdk.PatchLogs) error {
logs <- req
return nil
})
defer runner.Close()
err := runner.Init([]codersdk.WorkspaceAgentScript{{
Script: "echo hello",
}})
require.NoError(t, err)
require.NoError(t, runner.Execute(context.Background(), func(script codersdk.WorkspaceAgentScript) bool {
return true
}))
log := <-logs
require.Equal(t, "hello", log.Logs[0].Output)
}
func TestTimeout(t *testing.T) {
t.Parallel()
runner := setup(t, nil)
defer runner.Close()
err := runner.Init([]codersdk.WorkspaceAgentScript{{
Script: "sleep infinity",
Timeout: time.Millisecond,
}})
require.NoError(t, err)
require.ErrorIs(t, runner.Execute(context.Background(), nil), agentscripts.ErrTimeout)
}
// TestCronClose exists because cron.Run() can happen after cron.Close().
// If this happens, there used to be a deadlock.
func TestCronClose(t *testing.T) {
t.Parallel()
runner := agentscripts.New(agentscripts.Options{})
runner.StartCron()
require.NoError(t, runner.Close(), "close runner")
}
func setup(t *testing.T, patchLogs func(ctx context.Context, req agentsdk.PatchLogs) error) *agentscripts.Runner {
t.Helper()
if patchLogs == nil {
// noop
patchLogs = func(ctx context.Context, req agentsdk.PatchLogs) error {
return nil
}
}
fs := afero.NewMemMapFs()
logger := slogtest.Make(t, nil)
s, err := agentssh.NewServer(context.Background(), logger, prometheus.NewRegistry(), fs, 0, "")
require.NoError(t, err)
s.AgentToken = func() string { return "" }
s.Manifest = atomic.NewPointer(&agentsdk.Manifest{})
t.Cleanup(func() {
_ = s.Close()
})
return agentscripts.New(agentscripts.Options{
LogDir: t.TempDir(),
Logger: logger,
SSHServer: s,
Filesystem: fs,
PatchLogs: patchLogs,
})
}
@@ -0,0 +1,17 @@
package agentscripts
import (
"os"
"os/exec"
"syscall"
)
func cmdSysProcAttr() *syscall.SysProcAttr {
return &syscall.SysProcAttr{}
}
func cmdCancel(cmd *exec.Cmd) func() error {
return func() error {
return cmd.Process.Signal(os.Interrupt)
}
}
+252 -70
View File
@@ -19,6 +19,8 @@ import (
"time"
"github.com/gliderlabs/ssh"
"github.com/google/uuid"
"github.com/kballard/go-shellquote"
"github.com/pkg/sftp"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/afero"
@@ -28,9 +30,10 @@ import (
"cdr.dev/slog"
"github.com/coder/coder/agent/usershell"
"github.com/coder/coder/codersdk/agentsdk"
"github.com/coder/coder/pty"
"github.com/coder/coder/v2/agent/usershell"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/coder/v2/pty"
)
const (
@@ -44,8 +47,12 @@ const (
MagicSessionTypeEnvironmentVariable = "CODER_SSH_SESSION_TYPE"
// MagicSessionTypeVSCode is set in the SSH config by the VS Code extension to identify itself.
MagicSessionTypeVSCode = "vscode"
// MagicSessionTypeJetBrains is set in the SSH config by the JetBrains extension to identify itself.
// MagicSessionTypeJetBrains is set in the SSH config by the JetBrains
// extension to identify itself.
MagicSessionTypeJetBrains = "jetbrains"
// MagicProcessCmdlineJetBrains is a string in a process's command line that
// uniquely identifies it as JetBrains software.
MagicProcessCmdlineJetBrains = "idea.vendor.name=JetBrains"
)
type Server struct {
@@ -63,9 +70,10 @@ type Server struct {
srv *ssh.Server
x11SocketDir string
Env map[string]string
AgentToken func() string
Manifest *atomic.Pointer[agentsdk.Manifest]
Env map[string]string
AgentToken func() string
Manifest *atomic.Pointer[agentsdk.Manifest]
ServiceBanner *atomic.Pointer[codersdk.ServiceBannerConfig]
connCountVSCode atomic.Int64
connCountJetBrains atomic.Int64
@@ -91,7 +99,7 @@ func NewServer(ctx context.Context, logger slog.Logger, prometheusRegistry *prom
}
forwardHandler := &ssh.ForwardedTCPHandler{}
unixForwardHandler := &forwardedUnixHandler{log: logger}
unixForwardHandler := newForwardedUnixHandler(logger)
metrics := newSSHServerMetrics(prometheusRegistry)
s := &Server{
@@ -105,23 +113,36 @@ func NewServer(ctx context.Context, logger slog.Logger, prometheusRegistry *prom
metrics: metrics,
}
s.srv = &ssh.Server{
srv := &ssh.Server{
ChannelHandlers: map[string]ssh.ChannelHandler{
"direct-tcpip": ssh.DirectTCPIPHandler,
"direct-tcpip": func(srv *ssh.Server, conn *gossh.ServerConn, newChan gossh.NewChannel, ctx ssh.Context) {
// Wrapper is designed to find and track JetBrains Gateway connections.
wrapped := NewJetbrainsChannelWatcher(ctx, s.logger, newChan, &s.connCountJetBrains)
ssh.DirectTCPIPHandler(srv, conn, wrapped, ctx)
},
"direct-streamlocal@openssh.com": directStreamLocalHandler,
"session": ssh.DefaultSessionHandler,
},
ConnectionFailedCallback: func(_ net.Conn, err error) {
s.logger.Warn(ctx, "ssh connection failed", slog.Error(err))
ConnectionFailedCallback: func(conn net.Conn, err error) {
s.logger.Warn(ctx, "ssh connection failed",
slog.F("remote_addr", conn.RemoteAddr()),
slog.F("local_addr", conn.LocalAddr()),
slog.Error(err))
metrics.failedConnectionsTotal.Add(1)
},
ConnectionCompleteCallback: func(conn *gossh.ServerConn, err error) {
s.logger.Info(ctx, "ssh connection complete",
slog.F("remote_addr", conn.RemoteAddr()),
slog.F("local_addr", conn.LocalAddr()),
slog.Error(err))
},
Handler: s.sessionHandler,
HostSigners: []ssh.Signer{randomSigner},
LocalPortForwardingCallback: func(ctx ssh.Context, destinationHost string, destinationPort uint32) bool {
// Allow local port forwarding all!
s.logger.Debug(ctx, "local port forward",
slog.F("destination-host", destinationHost),
slog.F("destination-port", destinationPort))
slog.F("destination_host", destinationHost),
slog.F("destination_port", destinationPort))
return true
},
PtyCallback: func(ctx ssh.Context, pty ssh.Pty) bool {
@@ -129,9 +150,9 @@ func NewServer(ctx context.Context, logger slog.Logger, prometheusRegistry *prom
},
ReversePortForwardingCallback: func(ctx ssh.Context, bindHost string, bindPort uint32) bool {
// Allow reverse port forwarding all!
s.logger.Debug(ctx, "local port forward",
slog.F("bind-host", bindHost),
slog.F("bind-port", bindPort))
s.logger.Debug(ctx, "reverse port forward",
slog.F("bind_host", bindHost),
slog.F("bind_port", bindPort))
return true
},
RequestHandlers: map[string]ssh.RequestHandler{
@@ -149,9 +170,19 @@ func NewServer(ctx context.Context, logger slog.Logger, prometheusRegistry *prom
SubsystemHandlers: map[string]ssh.SubsystemHandler{
"sftp": s.sessionHandler,
},
MaxTimeout: maxTimeout,
}
// The MaxTimeout functionality has been substituted with the introduction of the KeepAlive feature.
// In cases where very short timeouts are set, the SSH server will automatically switch to the connection timeout for both read and write operations.
if maxTimeout >= 3*time.Second {
srv.ClientAliveCountMax = 3
srv.ClientAliveInterval = maxTimeout / time.Duration(srv.ClientAliveCountMax)
srv.MaxTimeout = 0
} else {
srv.MaxTimeout = maxTimeout
}
s.srv = srv
return s, nil
}
@@ -170,21 +201,31 @@ func (s *Server) ConnStats() ConnStats {
}
func (s *Server) sessionHandler(session ssh.Session) {
ctx := session.Context()
logger := s.logger.With(
slog.F("remote_addr", session.RemoteAddr()),
slog.F("local_addr", session.LocalAddr()),
// Assigning a random uuid for each session is useful for tracking
// logs for the same ssh session.
slog.F("id", uuid.NewString()),
)
logger.Info(ctx, "handling ssh session")
if !s.trackSession(session, true) {
// See (*Server).Close() for why we call Close instead of Exit.
_ = session.Close()
logger.Info(ctx, "unable to accept new session, server is closing")
return
}
defer s.trackSession(session, false)
ctx := session.Context()
extraEnv := make([]string, 0)
x11, hasX11 := session.X11()
if hasX11 {
handled := s.x11Handler(session.Context(), x11)
if !handled {
_ = session.Exit(1)
logger.Error(ctx, "x11 handler failed")
return
}
extraEnv = append(extraEnv, fmt.Sprintf("DISPLAY=:%d.0", x11.ScreenNumber))
@@ -193,32 +234,54 @@ func (s *Server) sessionHandler(session ssh.Session) {
switch ss := session.Subsystem(); ss {
case "":
case "sftp":
s.sftpHandler(session)
s.sftpHandler(logger, session)
return
default:
s.logger.Debug(ctx, "unsupported subsystem", slog.F("subsystem", ss))
logger.Warn(ctx, "unsupported subsystem", slog.F("subsystem", ss))
_ = session.Exit(1)
return
}
err := s.sessionStart(session, extraEnv)
err := s.sessionStart(logger, session, extraEnv)
var exitError *exec.ExitError
if xerrors.As(err, &exitError) {
s.logger.Warn(ctx, "ssh session returned", slog.Error(exitError))
_ = session.Exit(exitError.ExitCode())
code := exitError.ExitCode()
if code == -1 {
// If we return -1 here, it will be transmitted as an
// uint32(4294967295). This exit code is nonsense, so
// instead we return 255 (same as OpenSSH). This is
// also the same exit code that the shell returns for
// -1.
//
// For signals, we could consider sending 128+signal
// instead (however, OpenSSH doesn't seem to do this).
code = 255
}
logger.Info(ctx, "ssh session returned",
slog.Error(exitError),
slog.F("process_exit_code", exitError.ExitCode()),
slog.F("exit_code", code),
)
// TODO(mafredri): For signal exit, there's also an "exit-signal"
// request (session.Exit sends "exit-status"), however, since it's
// not implemented on the session interface and not used by
// OpenSSH, we'll leave it for now.
_ = session.Exit(code)
return
}
if err != nil {
s.logger.Warn(ctx, "ssh session failed", slog.Error(err))
logger.Warn(ctx, "ssh session failed", slog.Error(err))
// This exit code is designed to be unlikely to be confused for a legit exit code
// from the process.
_ = session.Exit(MagicSessionErrorCode)
return
}
logger.Info(ctx, "normal ssh session exit")
_ = session.Exit(0)
}
func (s *Server) sessionStart(session ssh.Session, extraEnv []string) (retErr error) {
func (s *Server) sessionStart(logger slog.Logger, session ssh.Session, extraEnv []string) (retErr error) {
ctx := session.Context()
env := append(session.Environ(), extraEnv...)
var magicType string
@@ -226,21 +289,23 @@ func (s *Server) sessionStart(session ssh.Session, extraEnv []string) (retErr er
if !strings.HasPrefix(kv, MagicSessionTypeEnvironmentVariable) {
continue
}
magicType = strings.TrimPrefix(kv, MagicSessionTypeEnvironmentVariable+"=")
magicType = strings.ToLower(strings.TrimPrefix(kv, MagicSessionTypeEnvironmentVariable+"="))
env = append(env[:index], env[index+1:]...)
}
// Always force lowercase checking to be case-insensitive.
switch magicType {
case MagicSessionTypeVSCode:
s.connCountVSCode.Add(1)
defer s.connCountVSCode.Add(-1)
case MagicSessionTypeJetBrains:
s.connCountJetBrains.Add(1)
defer s.connCountJetBrains.Add(-1)
// Do nothing here because JetBrains launches hundreds of ssh sessions.
// We instead track JetBrains in the single persistent tcp forwarding channel.
case "":
s.connCountSSHSession.Add(1)
defer s.connCountSSHSession.Add(-1)
default:
s.logger.Warn(ctx, "invalid magic ssh session type specified", slog.F("type", magicType))
logger.Warn(ctx, "invalid magic ssh session type specified", slog.F("type", magicType))
}
magicTypeLabel := magicTypeMetricLabel(magicType)
@@ -273,12 +338,12 @@ func (s *Server) sessionStart(session ssh.Session, extraEnv []string) (retErr er
}
if isPty {
return s.startPTYSession(session, magicTypeLabel, cmd, sshPty, windowSize)
return s.startPTYSession(logger, session, magicTypeLabel, cmd, sshPty, windowSize)
}
return s.startNonPTYSession(session, magicTypeLabel, cmd.AsExec())
return s.startNonPTYSession(logger, session, magicTypeLabel, cmd.AsExec())
}
func (s *Server) startNonPTYSession(session ssh.Session, magicTypeLabel string, cmd *exec.Cmd) error {
func (s *Server) startNonPTYSession(logger slog.Logger, session ssh.Session, magicTypeLabel string, cmd *exec.Cmd) error {
s.metrics.sessionsTotal.WithLabelValues(magicTypeLabel, "no").Add(1)
cmd.Stdout = session
@@ -302,6 +367,17 @@ func (s *Server) startNonPTYSession(session ssh.Session, magicTypeLabel string,
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "no", "start_command").Add(1)
return xerrors.Errorf("start: %w", err)
}
sigs := make(chan ssh.Signal, 1)
session.Signals(sigs)
defer func() {
session.Signals(nil)
close(sigs)
}()
go func() {
for sig := range sigs {
s.handleSignal(logger, sig, cmd.Process, magicTypeLabel)
}
}()
return cmd.Wait()
}
@@ -312,9 +388,10 @@ type ptySession interface {
Context() ssh.Context
DisablePTYEmulation()
RawCommand() string
Signals(chan<- ssh.Signal)
}
func (s *Server) startPTYSession(session ptySession, magicTypeLabel string, cmd *pty.Cmd, sshPty ssh.Pty, windowSize <-chan ssh.Window) (retErr error) {
func (s *Server) startPTYSession(logger slog.Logger, session ptySession, magicTypeLabel string, cmd *pty.Cmd, sshPty ssh.Pty, windowSize <-chan ssh.Window) (retErr error) {
s.metrics.sessionsTotal.WithLabelValues(magicTypeLabel, "yes").Add(1)
ctx := session.Context()
@@ -322,16 +399,27 @@ func (s *Server) startPTYSession(session ptySession, magicTypeLabel string, cmd
// See https://github.com/coder/coder/issues/3371.
session.DisablePTYEmulation()
if !isQuietLogin(session.RawCommand()) {
if isLoginShell(session.RawCommand()) {
serviceBanner := s.ServiceBanner.Load()
if serviceBanner != nil {
err := showServiceBanner(session, serviceBanner)
if err != nil {
logger.Error(ctx, "agent failed to show service banner", slog.Error(err))
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "service_banner").Add(1)
}
}
}
if !isQuietLogin(s.fs, session.RawCommand()) {
manifest := s.Manifest.Load()
if manifest != nil {
err := showMOTD(session, manifest.MOTDFile)
err := showMOTD(s.fs, session, manifest.MOTDFile)
if err != nil {
s.logger.Error(ctx, "show MOTD", slog.Error(err))
logger.Error(ctx, "agent failed to show MOTD", slog.Error(err))
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "motd").Add(1)
}
} else {
s.logger.Warn(ctx, "metadata lookup failed, unable to show MOTD")
logger.Warn(ctx, "metadata lookup failed, unable to show MOTD")
}
}
@@ -340,7 +428,7 @@ func (s *Server) startPTYSession(session ptySession, magicTypeLabel string, cmd
// The pty package sets `SSH_TTY` on supported platforms.
ptty, process, err := pty.Start(cmd, pty.WithPTYOption(
pty.WithSSHRequest(sshPty),
pty.WithLogger(slog.Stdlib(ctx, s.logger, slog.LevelInfo)),
pty.WithLogger(slog.Stdlib(ctx, logger, slog.LevelInfo)),
))
if err != nil {
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "start_command").Add(1)
@@ -349,20 +437,43 @@ func (s *Server) startPTYSession(session ptySession, magicTypeLabel string, cmd
defer func() {
closeErr := ptty.Close()
if closeErr != nil {
s.logger.Warn(ctx, "failed to close tty", slog.Error(closeErr))
logger.Warn(ctx, "failed to close tty", slog.Error(closeErr))
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "close").Add(1)
if retErr == nil {
retErr = closeErr
}
}
}()
sigs := make(chan ssh.Signal, 1)
session.Signals(sigs)
defer func() {
session.Signals(nil)
close(sigs)
}()
go func() {
for win := range windowSize {
resizeErr := ptty.Resize(uint16(win.Height), uint16(win.Width))
// If the pty is closed, then command has exited, no need to log.
if resizeErr != nil && !errors.Is(resizeErr, pty.ErrClosed) {
s.logger.Warn(ctx, "failed to resize tty", slog.Error(resizeErr))
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "resize").Add(1)
for {
if sigs == nil && windowSize == nil {
return
}
select {
case sig, ok := <-sigs:
if !ok {
sigs = nil
continue
}
s.handleSignal(logger, sig, process, magicTypeLabel)
case win, ok := <-windowSize:
if !ok {
windowSize = nil
continue
}
resizeErr := ptty.Resize(uint16(win.Height), uint16(win.Width))
// If the pty is closed, then command has exited, no need to log.
if resizeErr != nil && !errors.Is(resizeErr, pty.ErrClosed) {
logger.Warn(ctx, "failed to resize tty", slog.Error(resizeErr))
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "resize").Add(1)
}
}
}
}()
@@ -383,7 +494,7 @@ func (s *Server) startPTYSession(session ptySession, magicTypeLabel string, cmd
// 2. The client hangs up, which cancels the command's Context, and go will
// kill the command's process. This then has the same effect as (1).
n, err := io.Copy(session, ptty.OutputReader())
s.logger.Debug(ctx, "copy output done", slog.F("bytes", n), slog.Error(err))
logger.Debug(ctx, "copy output done", slog.F("bytes", n), slog.Error(err))
if err != nil {
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "output_io_copy").Add(1)
return xerrors.Errorf("copy error: %w", err)
@@ -396,7 +507,7 @@ func (s *Server) startPTYSession(session ptySession, magicTypeLabel string, cmd
// ExitErrors just mean the command we run returned a non-zero exit code, which is normal
// and not something to be concerned about. But, if it's something else, we should log it.
if err != nil && !xerrors.As(err, &exitErr) {
s.logger.Warn(ctx, "wait error", slog.Error(err))
logger.Warn(ctx, "process wait exited with error", slog.Error(err))
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "wait").Add(1)
}
if err != nil {
@@ -405,7 +516,19 @@ func (s *Server) startPTYSession(session ptySession, magicTypeLabel string, cmd
return nil
}
func (s *Server) sftpHandler(session ssh.Session) {
func (s *Server) handleSignal(logger slog.Logger, ssig ssh.Signal, signaler interface{ Signal(os.Signal) error }, magicTypeLabel string) {
ctx := context.Background()
sig := osSignalFrom(ssig)
logger = logger.With(slog.F("ssh_signal", ssig), slog.F("signal", sig.String()))
logger.Info(ctx, "received signal from client")
err := signaler.Signal(sig)
if err != nil {
logger.Warn(ctx, "signaling the process failed", slog.Error(err))
s.metrics.sessionErrors.WithLabelValues(magicTypeLabel, "yes", "signal").Add(1)
}
}
func (s *Server) sftpHandler(logger slog.Logger, session ssh.Session) {
s.metrics.sftpConnectionsTotal.Add(1)
ctx := session.Context()
@@ -421,14 +544,14 @@ func (s *Server) sftpHandler(session ssh.Session) {
// directory so that SFTP connections land there.
homedir, err := userHomeDir()
if err != nil {
s.logger.Warn(ctx, "get sftp working directory failed, unable to get home dir", slog.Error(err))
logger.Warn(ctx, "get sftp working directory failed, unable to get home dir", slog.Error(err))
} else {
opts = append(opts, sftp.WithServerWorkingDirectory(homedir))
}
server, err := sftp.NewServer(session, opts...)
if err != nil {
s.logger.Debug(ctx, "initialize sftp server", slog.Error(err))
logger.Debug(ctx, "initialize sftp server", slog.Error(err))
return
}
defer server.Close()
@@ -446,7 +569,7 @@ func (s *Server) sftpHandler(session ssh.Session) {
_ = session.Exit(0)
return
}
s.logger.Warn(ctx, "sftp server closed with error", slog.Error(err))
logger.Warn(ctx, "sftp server closed with error", slog.Error(err))
s.metrics.sftpServerErrors.Add(1)
_ = session.Exit(1)
}
@@ -477,8 +600,32 @@ func (s *Server) CreateCommand(ctx context.Context, script string, env []string)
if runtime.GOOS == "windows" {
caller = "/c"
}
name := shell
args := []string{caller, script}
// A preceding space is generally not idiomatic for a shebang,
// but in Terraform it's quite standard to use <<EOF for a multi-line
// string which would indent with spaces, so we accept it for user-ease.
if strings.HasPrefix(strings.TrimSpace(script), "#!") {
// If the script starts with a shebang, we should
// execute it directly. This is useful for running
// scripts that aren't executable.
shebang := strings.SplitN(strings.TrimSpace(script), "\n", 2)[0]
shebang = strings.TrimSpace(shebang)
shebang = strings.TrimPrefix(shebang, "#!")
words, err := shellquote.Split(shebang)
if err != nil {
return nil, xerrors.Errorf("split shebang: %w", err)
}
name = words[0]
if len(words) > 1 {
args = words[1:]
} else {
args = []string{}
}
args = append(args, caller, script)
}
// gliderlabs/ssh returns a command slice of zero
// when a shell is requested.
if len(script) == 0 {
@@ -490,7 +637,7 @@ func (s *Server) CreateCommand(ctx context.Context, script string, env []string)
}
}
cmd := pty.CommandContext(ctx, shell, args...)
cmd := pty.CommandContext(ctx, name, args...)
cmd.Dir = manifest.Directory
// If the metadata directory doesn't exist, we run the command
@@ -512,6 +659,8 @@ func (s *Server) CreateCommand(ctx context.Context, script string, env []string)
// Set environment variables reliable detection of being inside a
// Coder workspace.
cmd.Env = append(cmd.Env, "CODER=true")
cmd.Env = append(cmd.Env, "CODER_WORKSPACE_NAME="+manifest.WorkspaceName)
cmd.Env = append(cmd.Env, "CODER_WORKSPACE_AGENT_NAME="+manifest.AgentName)
cmd.Env = append(cmd.Env, fmt.Sprintf("USER=%s", username))
// Git on Windows resolves with UNIX-style paths.
// If using backslashes, it's unable to find the executable.
@@ -532,7 +681,11 @@ func (s *Server) CreateCommand(ctx context.Context, script string, env []string)
// This adds the ports dialog to code-server that enables
// proxying a port dynamically.
cmd.Env = append(cmd.Env, fmt.Sprintf("VSCODE_PROXY_URI=%s", manifest.VSCodePortProxyURI))
// If this is empty string, do not set anything. Code-server auto defaults
// using its basepath to construct a path based port proxy.
if manifest.VSCodePortProxyURI != "" {
cmd.Env = append(cmd.Env, fmt.Sprintf("VSCODE_PROXY_URI=%s", manifest.VSCodePortProxyURI))
}
// Hide Coder message on code-server's "Getting Started" page
cmd.Env = append(cmd.Env, "CS_DISABLE_GETTING_STARTED_OVERRIDE=true")
@@ -555,7 +708,12 @@ func (s *Server) CreateCommand(ctx context.Context, script string, env []string)
return cmd, nil
}
func (s *Server) Serve(l net.Listener) error {
func (s *Server) Serve(l net.Listener) (retErr error) {
s.logger.Info(context.Background(), "started serving listener", slog.F("listen_addr", l.Addr()))
defer func() {
s.logger.Info(context.Background(), "stopped serving listener",
slog.F("listen_addr", l.Addr()), slog.Error(retErr))
}()
defer l.Close()
s.trackListener(l, true)
@@ -570,16 +728,21 @@ func (s *Server) Serve(l net.Listener) error {
}
func (s *Server) handleConn(l net.Listener, c net.Conn) {
logger := s.logger.With(
slog.F("remote_addr", c.RemoteAddr()),
slog.F("local_addr", c.LocalAddr()),
slog.F("listen_addr", l.Addr()))
defer c.Close()
if !s.trackConn(l, c, true) {
// Server is closed or we no longer want
// connections from this listener.
s.logger.Debug(context.Background(), "received connection after server closed")
logger.Info(context.Background(), "received connection after server closed")
return
}
defer s.trackConn(l, c, false)
logger.Info(context.Background(), "started serving connection")
// note: srv.ConnectionCompleteCallback logs completion of the connection
s.srv.HandleConn(c)
}
@@ -710,12 +873,16 @@ func (*Server) Shutdown(_ context.Context) error {
return nil
}
func isLoginShell(rawCommand string) bool {
return len(rawCommand) == 0
}
// isQuietLogin checks if the SSH server should perform a quiet login or not.
//
// https://github.com/openssh/openssh-portable/blob/25bd659cc72268f2858c5415740c442ee950049f/session.c#L816
func isQuietLogin(rawCommand string) bool {
func isQuietLogin(fs afero.Fs, rawCommand string) bool {
// We are always quiet unless this is a login shell.
if len(rawCommand) != 0 {
if !isLoginShell(rawCommand) {
return true
}
@@ -726,20 +893,32 @@ func isQuietLogin(rawCommand string) bool {
return false
}
_, err = os.Stat(filepath.Join(homedir, ".hushlogin"))
_, err = fs.Stat(filepath.Join(homedir, ".hushlogin"))
return err == nil
}
// showServiceBanner will write the service banner if enabled and not blank
// along with a blank line for spacing.
func showServiceBanner(session io.Writer, banner *codersdk.ServiceBannerConfig) error {
if banner.Enabled && banner.Message != "" {
// The banner supports Markdown so we might want to parse it but Markdown is
// still fairly readable in its raw form.
message := strings.TrimSpace(banner.Message) + "\n\n"
return writeWithCarriageReturn(strings.NewReader(message), session)
}
return nil
}
// showMOTD will output the message of the day from
// the given filename to dest, if the file exists.
//
// https://github.com/openssh/openssh-portable/blob/25bd659cc72268f2858c5415740c442ee950049f/session.c#L784
func showMOTD(dest io.Writer, filename string) error {
func showMOTD(fs afero.Fs, dest io.Writer, filename string) error {
if filename == "" {
return nil
}
f, err := os.Open(filename)
f, err := fs.Open(filename)
if err != nil {
if xerrors.Is(err, os.ErrNotExist) {
// This is not an error, there simply isn't a MOTD to show.
@@ -749,19 +928,22 @@ func showMOTD(dest io.Writer, filename string) error {
}
defer f.Close()
s := bufio.NewScanner(f)
return writeWithCarriageReturn(f, dest)
}
// writeWithCarriageReturn writes each line with a carriage return to ensure
// that each line starts at the beginning of the terminal.
func writeWithCarriageReturn(src io.Reader, dest io.Writer) error {
s := bufio.NewScanner(src)
for s.Scan() {
// Carriage return ensures each line starts
// at the beginning of the terminal.
_, err = fmt.Fprint(dest, s.Text()+"\r\n")
_, err := fmt.Fprint(dest, s.Text()+"\r\n")
if err != nil {
return xerrors.Errorf("write MOTD: %w", err)
return xerrors.Errorf("write line: %w", err)
}
}
if err := s.Err(); err != nil {
return xerrors.Errorf("read MOTD: %w", err)
return xerrors.Errorf("read line: %w", err)
}
return nil
}
+16 -3
View File
@@ -15,8 +15,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/coder/coder/pty"
"github.com/coder/coder/testutil"
"github.com/coder/coder/v2/pty"
"github.com/coder/coder/v2/testutil"
"cdr.dev/slog/sloggers/slogtest"
)
@@ -63,7 +63,7 @@ func Test_sessionStart_orphan(t *testing.T) {
// we don't really care what the error is here. In the larger scenario,
// the client has disconnected, so we can't return any error information
// to them.
_ = s.startPTYSession(sess, "ssh", cmd, ptyInfo, windowSize)
_ = s.startPTYSession(logger, sess, "ssh", cmd, ptyInfo, windowSize)
}()
readDone := make(chan struct{})
@@ -114,6 +114,11 @@ type testSSHContext struct {
context.Context
}
var (
_ gliderssh.Context = testSSHContext{}
_ ptySession = &testSession{}
)
func newTestSession(ctx context.Context) (toClient *io.PipeReader, fromClient *io.PipeWriter, s ptySession) {
toClient, fromPty := io.Pipe()
toPty, fromClient := io.Pipe()
@@ -144,6 +149,10 @@ func (s *testSession) Write(p []byte) (n int, err error) {
return s.fromPty.Write(p)
}
func (*testSession) Signals(_ chan<- gliderssh.Signal) {
// Not implemented, but will be called.
}
func (testSSHContext) Lock() {
panic("not implemented")
}
@@ -191,3 +200,7 @@ func (testSSHContext) Permissions() *gliderssh.Permissions {
func (testSSHContext) SetValue(_, _ interface{}) {
panic("not implemented")
}
func (testSSHContext) KeepAlive() *gliderssh.SessionKeepAlive {
panic("not implemented")
}
+198 -4
View File
@@ -3,9 +3,12 @@
package agentssh_test
import (
"bufio"
"bytes"
"context"
"fmt"
"net"
"runtime"
"strings"
"sync"
"testing"
@@ -20,9 +23,10 @@ import (
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/agent/agentssh"
"github.com/coder/coder/codersdk/agentsdk"
"github.com/coder/coder/pty/ptytest"
"github.com/coder/coder/v2/agent/agentssh"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/coder/v2/pty/ptytest"
"github.com/coder/coder/v2/testutil"
)
func TestMain(m *testing.M) {
@@ -56,8 +60,8 @@ func TestNewServer_ServeClient(t *testing.T) {
var b bytes.Buffer
sess, err := c.NewSession()
sess.Stdout = &b
require.NoError(t, err)
sess.Stdout = &b
err = sess.Start("echo hello")
require.NoError(t, err)
@@ -71,6 +75,42 @@ func TestNewServer_ServeClient(t *testing.T) {
<-done
}
func TestNewServer_ExecuteShebang(t *testing.T) {
t.Parallel()
if runtime.GOOS == "windows" {
t.Skip("bash doesn't exist on Windows")
}
ctx := context.Background()
logger := slogtest.Make(t, nil)
s, err := agentssh.NewServer(ctx, logger, prometheus.NewRegistry(), afero.NewMemMapFs(), 0, "")
require.NoError(t, err)
t.Cleanup(func() {
_ = s.Close()
})
s.AgentToken = func() string { return "" }
s.Manifest = atomic.NewPointer(&agentsdk.Manifest{})
t.Run("Basic", func(t *testing.T) {
t.Parallel()
cmd, err := s.CreateCommand(ctx, `#!/bin/bash
echo test`, nil)
require.NoError(t, err)
output, err := cmd.AsExec().CombinedOutput()
require.NoError(t, err)
require.Equal(t, "test\n", string(output))
})
t.Run("Args", func(t *testing.T) {
t.Parallel()
cmd, err := s.CreateCommand(ctx, `#!/usr/bin/env bash
echo test`, nil)
require.NoError(t, err)
output, err := cmd.AsExec().CombinedOutput()
require.NoError(t, err)
require.Equal(t, "test\n", string(output))
})
}
func TestNewServer_CloseActiveConnections(t *testing.T) {
t.Parallel()
@@ -102,6 +142,7 @@ func TestNewServer_CloseActiveConnections(t *testing.T) {
defer wg.Done()
c := sshClient(t, ln.Addr().String())
sess, err := c.NewSession()
assert.NoError(t, err)
sess.Stdin = pty.Input()
sess.Stdout = pty.Output()
sess.Stderr = pty.Output()
@@ -122,6 +163,159 @@ func TestNewServer_CloseActiveConnections(t *testing.T) {
wg.Wait()
}
func TestNewServer_Signal(t *testing.T) {
t.Parallel()
t.Run("Stdout", func(t *testing.T) {
t.Parallel()
ctx := context.Background()
logger := slogtest.Make(t, nil)
s, err := agentssh.NewServer(ctx, logger, prometheus.NewRegistry(), afero.NewMemMapFs(), 0, "")
require.NoError(t, err)
defer s.Close()
// The assumption is that these are set before serving SSH connections.
s.AgentToken = func() string { return "" }
s.Manifest = atomic.NewPointer(&agentsdk.Manifest{})
ln, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
done := make(chan struct{})
go func() {
defer close(done)
err := s.Serve(ln)
assert.Error(t, err) // Server is closed.
}()
defer func() {
err := s.Close()
require.NoError(t, err)
<-done
}()
c := sshClient(t, ln.Addr().String())
sess, err := c.NewSession()
require.NoError(t, err)
r, err := sess.StdoutPipe()
require.NoError(t, err)
// Perform multiple sleeps since the interrupt signal doesn't propagate to
// the process group, this lets us exit early.
sleeps := strings.Repeat("sleep 1 && ", int(testutil.WaitMedium.Seconds()))
err = sess.Start(fmt.Sprintf("echo hello && %s echo bye", sleeps))
require.NoError(t, err)
sc := bufio.NewScanner(r)
for sc.Scan() {
t.Log(sc.Text())
if strings.Contains(sc.Text(), "hello") {
break
}
}
require.NoError(t, sc.Err())
err = sess.Signal(ssh.SIGKILL)
require.NoError(t, err)
// Assumption, signal propagates and the command exists, closing stdout.
for sc.Scan() {
t.Log(sc.Text())
require.NotContains(t, sc.Text(), "bye")
}
require.NoError(t, sc.Err())
err = sess.Wait()
exitErr := &ssh.ExitError{}
require.ErrorAs(t, err, &exitErr)
wantCode := 255
if runtime.GOOS == "windows" {
wantCode = 1
}
require.Equal(t, wantCode, exitErr.ExitStatus())
})
t.Run("PTY", func(t *testing.T) {
t.Parallel()
ctx := context.Background()
logger := slogtest.Make(t, nil)
s, err := agentssh.NewServer(ctx, logger, prometheus.NewRegistry(), afero.NewMemMapFs(), 0, "")
require.NoError(t, err)
defer s.Close()
// The assumption is that these are set before serving SSH connections.
s.AgentToken = func() string { return "" }
s.Manifest = atomic.NewPointer(&agentsdk.Manifest{})
ln, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
done := make(chan struct{})
go func() {
defer close(done)
err := s.Serve(ln)
assert.Error(t, err) // Server is closed.
}()
defer func() {
err := s.Close()
require.NoError(t, err)
<-done
}()
c := sshClient(t, ln.Addr().String())
pty := ptytest.New(t)
sess, err := c.NewSession()
require.NoError(t, err)
r, err := sess.StdoutPipe()
require.NoError(t, err)
// Note, we request pty but don't use ptytest here because we can't
// easily test for no text before EOF.
sess.Stdin = pty.Input()
sess.Stderr = pty.Output()
err = sess.RequestPty("xterm", 80, 80, nil)
require.NoError(t, err)
// Perform multiple sleeps since the interrupt signal doesn't propagate to
// the process group, this lets us exit early.
sleeps := strings.Repeat("sleep 1 && ", int(testutil.WaitMedium.Seconds()))
err = sess.Start(fmt.Sprintf("echo hello && %s echo bye", sleeps))
require.NoError(t, err)
sc := bufio.NewScanner(r)
for sc.Scan() {
t.Log(sc.Text())
if strings.Contains(sc.Text(), "hello") {
break
}
}
require.NoError(t, sc.Err())
err = sess.Signal(ssh.SIGKILL)
require.NoError(t, err)
// Assumption, signal propagates and the command exists, closing stdout.
for sc.Scan() {
t.Log(sc.Text())
require.NotContains(t, sc.Text(), "bye")
}
require.NoError(t, sc.Err())
err = sess.Wait()
exitErr := &ssh.ExitError{}
require.ErrorAs(t, err, &exitErr)
wantCode := 255
if runtime.GOOS == "windows" {
wantCode = 1
}
require.Equal(t, wantCode, exitErr.ExitStatus())
})
}
func sshClient(t *testing.T, addr string) *ssh.Client {
conn, err := net.Dial("tcp", addr)
require.NoError(t, err)
+87 -38
View File
@@ -2,11 +2,14 @@ package agentssh
import (
"context"
"errors"
"fmt"
"io/fs"
"net"
"os"
"path/filepath"
"sync"
"syscall"
"github.com/gliderlabs/ssh"
gossh "golang.org/x/crypto/ssh"
@@ -33,70 +36,98 @@ type forwardedStreamLocalPayload struct {
type forwardedUnixHandler struct {
sync.Mutex
log slog.Logger
forwards map[string]net.Listener
forwards map[forwardKey]net.Listener
}
type forwardKey struct {
sessionID string
addr string
}
func newForwardedUnixHandler(log slog.Logger) *forwardedUnixHandler {
return &forwardedUnixHandler{
log: log,
forwards: make(map[forwardKey]net.Listener),
}
}
func (h *forwardedUnixHandler) HandleSSHRequest(ctx ssh.Context, _ *ssh.Server, req *gossh.Request) (bool, []byte) {
h.Lock()
if h.forwards == nil {
h.forwards = make(map[string]net.Listener)
}
h.Unlock()
h.log.Debug(ctx, "handling SSH unix forward")
conn, ok := ctx.Value(ssh.ContextKeyConn).(*gossh.ServerConn)
if !ok {
h.log.Warn(ctx, "SSH unix forward request from client with no gossh connection")
return false, nil
}
log := h.log.With(slog.F("session_id", ctx.SessionID()), slog.F("remote_addr", conn.RemoteAddr()))
switch req.Type {
case "streamlocal-forward@openssh.com":
var reqPayload streamLocalForwardPayload
err := gossh.Unmarshal(req.Payload, &reqPayload)
if err != nil {
h.log.Warn(ctx, "parse streamlocal-forward@openssh.com request payload from client", slog.Error(err))
h.log.Warn(ctx, "parse streamlocal-forward@openssh.com request (SSH unix forward) payload from client", slog.Error(err))
return false, nil
}
addr := reqPayload.SocketPath
log = log.With(slog.F("socket_path", addr))
log.Debug(ctx, "request begin SSH unix forward")
key := forwardKey{
sessionID: ctx.SessionID(),
addr: addr,
}
h.Lock()
_, ok := h.forwards[addr]
_, ok := h.forwards[key]
h.Unlock()
if ok {
h.log.Warn(ctx, "SSH unix forward request for socket path that is already being forwarded (maybe to another client?)",
slog.F("socket_path", addr),
)
return false, nil
// In cases where `ExitOnForwardFailure=yes` is set, returning false
// here will cause the connection to be closed. To avoid this, and
// to match OpenSSH behavior, we silently ignore the second forward
// request.
log.Warn(ctx, "SSH unix forward request for socket path that is already being forwarded on this session, ignoring")
return true, nil
}
// Create socket parent dir if not exists.
parentDir := filepath.Dir(addr)
err = os.MkdirAll(parentDir, 0o700)
if err != nil {
h.log.Warn(ctx, "create parent dir for SSH unix forward request",
log.Warn(ctx, "create parent dir for SSH unix forward request",
slog.F("parent_dir", parentDir),
slog.F("socket_path", addr),
slog.Error(err),
)
return false, nil
}
ln, err := net.Listen("unix", addr)
if err != nil {
h.log.Warn(ctx, "listen on Unix socket for SSH unix forward request",
slog.F("socket_path", addr),
slog.Error(err),
)
// Remove existing socket if it exists. We do not use os.Remove() here
// so that directories are kept. Note that it's possible that we will
// overwrite a regular file here. Both of these behaviors match OpenSSH,
// however, which is why we unlink.
err = unlink(addr)
if err != nil && !errors.Is(err, fs.ErrNotExist) {
log.Warn(ctx, "remove existing socket for SSH unix forward request", slog.Error(err))
return false, nil
}
lc := &net.ListenConfig{}
ln, err := lc.Listen(ctx, "unix", addr)
if err != nil {
log.Warn(ctx, "listen on Unix socket for SSH unix forward request", slog.Error(err))
return false, nil
}
log.Debug(ctx, "SSH unix forward listening on socket")
// The listener needs to successfully start before it can be added to
// the map, so we don't have to worry about checking for an existing
// listener.
//
// This is also what the upstream TCP version of this code does.
h.Lock()
h.forwards[addr] = ln
h.forwards[key] = ln
h.Unlock()
log.Debug(ctx, "SSH unix forward added to cache")
ctx, cancel := context.WithCancel(ctx)
go func() {
@@ -110,14 +141,13 @@ func (h *forwardedUnixHandler) HandleSSHRequest(ctx ssh.Context, _ *ssh.Server,
c, err := ln.Accept()
if err != nil {
if !xerrors.Is(err, net.ErrClosed) {
h.log.Warn(ctx, "accept on local Unix socket for SSH unix forward request",
slog.F("socket_path", addr),
slog.Error(err),
)
log.Warn(ctx, "accept on local Unix socket for SSH unix forward request", slog.Error(err))
}
// closed below
log.Debug(ctx, "SSH unix forward listener closed")
break
}
log.Debug(ctx, "accepted SSH unix forward connection")
payload := gossh.Marshal(&forwardedStreamLocalPayload{
SocketPath: addr,
})
@@ -125,10 +155,7 @@ func (h *forwardedUnixHandler) HandleSSHRequest(ctx ssh.Context, _ *ssh.Server,
go func() {
ch, reqs, err := conn.OpenChannel("forwarded-streamlocal@openssh.com", payload)
if err != nil {
h.log.Warn(ctx, "open SSH channel to forward Unix connection to client",
slog.F("socket_path", addr),
slog.Error(err),
)
h.log.Warn(ctx, "open SSH unix forward channel to client", slog.Error(err))
_ = c.Close()
return
}
@@ -138,11 +165,11 @@ func (h *forwardedUnixHandler) HandleSSHRequest(ctx ssh.Context, _ *ssh.Server,
}
h.Lock()
ln2, ok := h.forwards[addr]
if ok && ln2 == ln {
delete(h.forwards, addr)
if ln2, ok := h.forwards[key]; ok && ln2 == ln {
delete(h.forwards, key)
}
h.Unlock()
log.Debug(ctx, "SSH unix forward listener removed from cache")
_ = ln.Close()
}()
@@ -152,15 +179,25 @@ func (h *forwardedUnixHandler) HandleSSHRequest(ctx ssh.Context, _ *ssh.Server,
var reqPayload streamLocalForwardPayload
err := gossh.Unmarshal(req.Payload, &reqPayload)
if err != nil {
h.log.Warn(ctx, "parse cancel-streamlocal-forward@openssh.com request payload from client", slog.Error(err))
h.log.Warn(ctx, "parse cancel-streamlocal-forward@openssh.com (SSH unix forward) request payload from client", slog.Error(err))
return false, nil
}
h.Lock()
ln, ok := h.forwards[reqPayload.SocketPath]
h.Unlock()
if ok {
_ = ln.Close()
log.Debug(ctx, "request to cancel SSH unix forward", slog.F("socket_path", reqPayload.SocketPath))
key := forwardKey{
sessionID: ctx.SessionID(),
addr: reqPayload.SocketPath,
}
h.Lock()
ln, ok := h.forwards[key]
delete(h.forwards, key)
h.Unlock()
if !ok {
log.Warn(ctx, "SSH unix forward not found in cache")
return true, nil
}
_ = ln.Close()
return true, nil
default:
@@ -201,3 +238,15 @@ func directStreamLocalHandler(_ *ssh.Server, _ *gossh.ServerConn, newChan gossh.
Bicopy(ctx, ch, dconn)
}
// unlink removes files and unlike os.Remove, directories are kept.
func unlink(path string) error {
// Ignore EINTR like os.Remove, see ignoringEINTR in os/file_posix.go
// for more details.
for {
err := syscall.Unlink(path)
if !errors.Is(err, syscall.EINTR) {
return err
}
}
}
+97
View File
@@ -0,0 +1,97 @@
package agentssh
import (
"context"
"strings"
"sync"
"github.com/gliderlabs/ssh"
"go.uber.org/atomic"
gossh "golang.org/x/crypto/ssh"
"cdr.dev/slog"
)
// localForwardChannelData is copied from the ssh package.
type localForwardChannelData struct {
DestAddr string
DestPort uint32
OriginAddr string
OriginPort uint32
}
// JetbrainsChannelWatcher is used to track JetBrains port forwarded (Gateway)
// channels. If the port forward is something other than JetBrains, this struct
// is a noop.
type JetbrainsChannelWatcher struct {
gossh.NewChannel
jetbrainsCounter *atomic.Int64
logger slog.Logger
}
func NewJetbrainsChannelWatcher(ctx ssh.Context, logger slog.Logger, newChannel gossh.NewChannel, counter *atomic.Int64) gossh.NewChannel {
d := localForwardChannelData{}
if err := gossh.Unmarshal(newChannel.ExtraData(), &d); err != nil {
// If the data fails to unmarshal, do nothing.
logger.Warn(ctx, "failed to unmarshal port forward data", slog.Error(err))
return newChannel
}
// If we do get a port, we should be able to get the matching PID and from
// there look up the invocation.
cmdline, err := getListeningPortProcessCmdline(d.DestPort)
if err != nil {
logger.Warn(ctx, "failed to inspect port",
slog.F("destination_port", d.DestPort),
slog.Error(err))
return newChannel
}
// If this is not JetBrains, then we do not need to do anything special. We
// attempt to match on something that appears unique to JetBrains software.
if !strings.Contains(strings.ToLower(cmdline), strings.ToLower(MagicProcessCmdlineJetBrains)) {
return newChannel
}
logger.Debug(ctx, "discovered forwarded JetBrains process",
slog.F("destination_port", d.DestPort))
return &JetbrainsChannelWatcher{
NewChannel: newChannel,
jetbrainsCounter: counter,
logger: logger.With(slog.F("destination_port", d.DestPort)),
}
}
func (w *JetbrainsChannelWatcher) Accept() (gossh.Channel, <-chan *gossh.Request, error) {
c, r, err := w.NewChannel.Accept()
if err != nil {
return c, r, err
}
w.jetbrainsCounter.Add(1)
// nolint: gocritic // JetBrains is a proper noun and should be capitalized
w.logger.Debug(context.Background(), "JetBrains watcher accepted channel")
return &ChannelOnClose{
Channel: c,
done: func() {
w.jetbrainsCounter.Add(-1)
// nolint: gocritic // JetBrains is a proper noun and should be capitalized
w.logger.Debug(context.Background(), "JetBrains watcher channel closed")
},
}, r, err
}
type ChannelOnClose struct {
gossh.Channel
// once ensures close only decrements the counter once.
// Because close can be called multiple times.
once sync.Once
done func()
}
func (c *ChannelOnClose) Close() error {
c.once.Do(c.done)
return c.Channel.Close()
}
+4 -1
View File
@@ -1,6 +1,8 @@
package agentssh
import (
"strings"
"github.com/prometheus/client_golang/prometheus"
)
@@ -78,5 +80,6 @@ func magicTypeMetricLabel(magicType string) string {
default:
magicType = "unknown"
}
return magicType
// Always be case insensitive
return strings.ToLower(magicType)
}
@@ -0,0 +1,51 @@
//go:build linux
package agentssh
import (
"errors"
"fmt"
"os"
"github.com/cakturk/go-netstat/netstat"
"golang.org/x/xerrors"
)
func getListeningPortProcessCmdline(port uint32) (string, error) {
acceptFn := func(s *netstat.SockTabEntry) bool {
return s.LocalAddr != nil && uint32(s.LocalAddr.Port) == port
}
tabs4, err4 := netstat.TCPSocks(acceptFn)
tabs6, err6 := netstat.TCP6Socks(acceptFn)
// In the common case, we want to check ipv4 listening addresses. If this
// fails, we should return an error. We also need to check ipv6. The
// assumption is, if we have an err4, and 0 ipv6 addresses listed, then we are
// interested in the err4 (and vice versa). So return both errors (at least 1
// is non-nil) if the other list is empty.
if (err4 != nil && len(tabs6) == 0) || (err6 != nil && len(tabs4) == 0) {
return "", xerrors.Errorf("inspect port %d: %w", port, errors.Join(err4, err6))
}
var proc *netstat.Process
if len(tabs4) > 0 {
proc = tabs4[0].Process
} else if len(tabs6) > 0 {
proc = tabs6[0].Process
}
if proc == nil {
// Either nothing is listening on this port or we were unable to read the
// process details (permission issues reading /proc/$pid/* potentially).
// Or, perhaps /proc/net/tcp{,6} is not listing the port for some reason.
return "", nil
}
// The process name provided by go-netstat does not include the full command
// line so grab that instead.
pid := proc.Pid
data, err := os.ReadFile(fmt.Sprintf("/proc/%d/cmdline", pid))
if err != nil {
return "", xerrors.Errorf("read /proc/%d/cmdline: %w", pid, err)
}
return string(data), nil
}
@@ -0,0 +1,9 @@
//go:build !linux
package agentssh
func getListeningPortProcessCmdline(uint32) (string, error) {
// We are not worrying about other platforms at the moment because Gateway
// only supports Linux anyway.
return "", nil
}
+45
View File
@@ -0,0 +1,45 @@
//go:build !windows
package agentssh
import (
"os"
"github.com/gliderlabs/ssh"
"golang.org/x/sys/unix"
)
func osSignalFrom(sig ssh.Signal) os.Signal {
switch sig {
case ssh.SIGABRT:
return unix.SIGABRT
case ssh.SIGALRM:
return unix.SIGALRM
case ssh.SIGFPE:
return unix.SIGFPE
case ssh.SIGHUP:
return unix.SIGHUP
case ssh.SIGILL:
return unix.SIGILL
case ssh.SIGINT:
return unix.SIGINT
case ssh.SIGKILL:
return unix.SIGKILL
case ssh.SIGPIPE:
return unix.SIGPIPE
case ssh.SIGQUIT:
return unix.SIGQUIT
case ssh.SIGSEGV:
return unix.SIGSEGV
case ssh.SIGTERM:
return unix.SIGTERM
case ssh.SIGUSR1:
return unix.SIGUSR1
case ssh.SIGUSR2:
return unix.SIGUSR2
// Unhandled, use sane fallback.
default:
return unix.SIGKILL
}
}
+15
View File
@@ -0,0 +1,15 @@
package agentssh
import (
"os"
"github.com/gliderlabs/ssh"
)
func osSignalFrom(sig ssh.Signal) os.Signal {
switch sig {
// Signals are not supported on Windows.
default:
return os.Kill
}
}
+194 -2
View File
@@ -6,6 +6,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"io"
"net"
"os"
"path/filepath"
@@ -141,7 +142,7 @@ func addXauthEntry(ctx context.Context, fs afero.Fs, host string, display string
}
// Open or create the Xauthority file
file, err := fs.OpenFile(xauthPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0o600)
file, err := fs.OpenFile(xauthPath, os.O_RDWR|os.O_CREATE, 0o600)
if err != nil {
return xerrors.Errorf("failed to open Xauthority file: %w", err)
}
@@ -153,7 +154,105 @@ func addXauthEntry(ctx context.Context, fs afero.Fs, host string, display string
return xerrors.Errorf("failed to decode auth cookie: %w", err)
}
// Write Xauthority entry
// Read the Xauthority file and look for an existing entry for the host,
// display, and auth protocol. If an entry is found, overwrite the auth
// cookie (if it fits). Otherwise, mark the entry for deletion.
type deleteEntry struct {
start, end int
}
var deleteEntries []deleteEntry
pos := 0
updated := false
for {
entry, err := readXauthEntry(file)
if err != nil {
if errors.Is(err, io.EOF) {
break
}
return xerrors.Errorf("failed to read Xauthority entry: %w", err)
}
nextPos := pos + entry.Len()
cookieStartPos := nextPos - len(entry.authCookie)
if entry.family == 0x0100 && entry.address == host && entry.display == display && entry.authProtocol == authProtocol {
if !updated && len(entry.authCookie) == len(authCookieBytes) {
// Overwrite the auth cookie
_, err := file.WriteAt(authCookieBytes, int64(cookieStartPos))
if err != nil {
return xerrors.Errorf("failed to write auth cookie: %w", err)
}
updated = true
} else {
// Mark entry for deletion.
if len(deleteEntries) > 0 && deleteEntries[len(deleteEntries)-1].end == pos {
deleteEntries[len(deleteEntries)-1].end = nextPos
} else {
deleteEntries = append(deleteEntries, deleteEntry{
start: pos,
end: nextPos,
})
}
}
}
pos = nextPos
}
// In case the magic cookie changed, or we've previously bloated the
// Xauthority file, we may have to delete entries.
if len(deleteEntries) > 0 {
// Read the entire file into memory. This is not ideal, but it's the
// simplest way to delete entries from the middle of the file. The
// Xauthority file is small, so this should be fine.
_, err = file.Seek(0, io.SeekStart)
if err != nil {
return xerrors.Errorf("failed to seek Xauthority file: %w", err)
}
data, err := io.ReadAll(file)
if err != nil {
return xerrors.Errorf("failed to read Xauthority file: %w", err)
}
// Delete the entries in reverse order.
for i := len(deleteEntries) - 1; i >= 0; i-- {
entry := deleteEntries[i]
// Safety check: ensure the entry is still there.
if entry.start > len(data) || entry.end > len(data) {
continue
}
data = append(data[:entry.start], data[entry.end:]...)
}
// Write the data back to the file.
_, err = file.Seek(0, io.SeekStart)
if err != nil {
return xerrors.Errorf("failed to seek Xauthority file: %w", err)
}
_, err = file.Write(data)
if err != nil {
return xerrors.Errorf("failed to write Xauthority file: %w", err)
}
// Truncate the file.
err = file.Truncate(int64(len(data)))
if err != nil {
return xerrors.Errorf("failed to truncate Xauthority file: %w", err)
}
}
// Return if we've already updated the entry.
if updated {
return nil
}
// Ensure we're at the end (append).
_, err = file.Seek(0, io.SeekEnd)
if err != nil {
return xerrors.Errorf("failed to seek Xauthority file: %w", err)
}
// Append Xauthority entry.
family := uint16(0x0100) // FamilyLocal
err = binary.Write(file, binary.BigEndian, family)
if err != nil {
@@ -198,3 +297,96 @@ func addXauthEntry(ctx context.Context, fs afero.Fs, host string, display string
return nil
}
// xauthEntry is an representation of an Xauthority entry.
//
// The Xauthority file format is as follows:
//
// - 16-bit family
// - 16-bit address length
// - address
// - 16-bit display length
// - display
// - 16-bit auth protocol length
// - auth protocol
// - 16-bit auth cookie length
// - auth cookie
type xauthEntry struct {
family uint16
address string
display string
authProtocol string
authCookie []byte
}
func (e xauthEntry) Len() int {
// 5 * uint16 = 10 bytes for the family/length fields.
return 2*5 + len(e.address) + len(e.display) + len(e.authProtocol) + len(e.authCookie)
}
func readXauthEntry(r io.Reader) (xauthEntry, error) {
var entry xauthEntry
// Read family
err := binary.Read(r, binary.BigEndian, &entry.family)
if err != nil {
return xauthEntry{}, xerrors.Errorf("failed to read family: %w", err)
}
// Read address
var addressLength uint16
err = binary.Read(r, binary.BigEndian, &addressLength)
if err != nil {
return xauthEntry{}, xerrors.Errorf("failed to read address length: %w", err)
}
addressBytes := make([]byte, addressLength)
_, err = r.Read(addressBytes)
if err != nil {
return xauthEntry{}, xerrors.Errorf("failed to read address: %w", err)
}
entry.address = string(addressBytes)
// Read display
var displayLength uint16
err = binary.Read(r, binary.BigEndian, &displayLength)
if err != nil {
return xauthEntry{}, xerrors.Errorf("failed to read display length: %w", err)
}
displayBytes := make([]byte, displayLength)
_, err = r.Read(displayBytes)
if err != nil {
return xauthEntry{}, xerrors.Errorf("failed to read display: %w", err)
}
entry.display = string(displayBytes)
// Read auth protocol
var authProtocolLength uint16
err = binary.Read(r, binary.BigEndian, &authProtocolLength)
if err != nil {
return xauthEntry{}, xerrors.Errorf("failed to read auth protocol length: %w", err)
}
authProtocolBytes := make([]byte, authProtocolLength)
_, err = r.Read(authProtocolBytes)
if err != nil {
return xauthEntry{}, xerrors.Errorf("failed to read auth protocol: %w", err)
}
entry.authProtocol = string(authProtocolBytes)
// Read auth cookie
var authCookieLength uint16
err = binary.Read(r, binary.BigEndian, &authCookieLength)
if err != nil {
return xauthEntry{}, xerrors.Errorf("failed to read auth cookie length: %w", err)
}
entry.authCookie = make([]byte, authCookieLength)
_, err = r.Read(entry.authCookie)
if err != nil {
return xauthEntry{}, xerrors.Errorf("failed to read auth cookie: %w", err)
}
return entry, nil
}
+254
View File
@@ -0,0 +1,254 @@
package agentssh
import (
"context"
"os"
"path/filepath"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/spf13/afero"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_addXauthEntry(t *testing.T) {
t.Parallel()
type testEntry struct {
address string
display string
authProtocol string
authCookie string
}
tests := []struct {
name string
authFile []byte
wantAuthFile []byte
entries []testEntry
}{
{
name: "add entry",
authFile: nil,
wantAuthFile: []byte{
// w/unix:0 MIT-MAGIC-COOKIE-1 00
//
// 00000000: 0100 0001 7700 0130 0012 4d49 542d 4d41 ....w..0..MIT-MA
// 00000010: 4749 432d 434f 4f4b 4945 2d31 0001 00 GIC-COOKIE-1...
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x30,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0x00,
},
entries: []testEntry{
{
address: "w",
display: "0",
authProtocol: "MIT-MAGIC-COOKIE-1",
authCookie: "00",
},
},
},
{
name: "add two entries",
authFile: []byte{},
wantAuthFile: []byte{
// w/unix:0 MIT-MAGIC-COOKIE-1 00
// w/unix:1 MIT-MAGIC-COOKIE-1 11
//
// 00000000: 0100 0001 7700 0130 0012 4d49 542d 4d41 ....w..0..MIT-MA
// 00000010: 4749 432d 434f 4f4b 4945 2d31 0001 0001 GIC-COOKIE-1....
// 00000020: 0000 0177 0001 3100 124d 4954 2d4d 4147 ...w..1..MIT-MAG
// 00000030: 4943 2d43 4f4f 4b49 452d 3100 0111 IC-COOKIE-1...
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x30,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0x00,
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x31,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0x11,
},
entries: []testEntry{
{
address: "w",
display: "0",
authProtocol: "MIT-MAGIC-COOKIE-1",
authCookie: "00",
},
{
address: "w",
display: "1",
authProtocol: "MIT-MAGIC-COOKIE-1",
authCookie: "11",
},
},
},
{
name: "update entry with new auth cookie length",
authFile: []byte{
// w/unix:0 MIT-MAGIC-COOKIE-1 00
// w/unix:1 MIT-MAGIC-COOKIE-1 11
//
// 00000000: 0100 0001 7700 0130 0012 4d49 542d 4d41 ....w..0..MIT-MA
// 00000010: 4749 432d 434f 4f4b 4945 2d31 0001 0001 GIC-COOKIE-1....
// 00000020: 0000 0177 0001 3100 124d 4954 2d4d 4147 ...w..1..MIT-MAG
// 00000030: 4943 2d43 4f4f 4b49 452d 3100 0111 IC-COOKIE-1...
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x30,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0x00,
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x31,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0x11,
},
wantAuthFile: []byte{
// The order changed, due to new length of auth cookie resulting
// in remove + append, we verify that the implementation is
// behaving as expected (changing the order is not a requirement,
// simply an implementation detail).
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x31,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0x11,
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x30,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x02, 0xff, 0xff,
},
entries: []testEntry{
{
address: "w",
display: "0",
authProtocol: "MIT-MAGIC-COOKIE-1",
authCookie: "ffff",
},
},
},
{
name: "update entry",
authFile: []byte{
// 00000000: 0100 0001 7700 0130 0012 4d49 542d 4d41 ....w..0..MIT-MA
// 00000010: 4749 432d 434f 4f4b 4945 2d31 0001 0001 GIC-COOKIE-1....
// 00000020: 0000 0177 0001 3100 124d 4954 2d4d 4147 ...w..1..MIT-MAG
// 00000030: 4943 2d43 4f4f 4b49 452d 3100 0111 IC-COOKIE-1...
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x30,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0x00,
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x31,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0x11,
},
wantAuthFile: []byte{
// 00000000: 0100 0001 7700 0130 0012 4d49 542d 4d41 ....w..0..MIT-MA
// 00000010: 4749 432d 434f 4f4b 4945 2d31 0001 0001 GIC-COOKIE-1....
// 00000020: 0000 0177 0001 3100 124d 4954 2d4d 4147 ...w..1..MIT-MAG
// 00000030: 4943 2d43 4f4f 4b49 452d 3100 0111 IC-COOKIE-1...
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x30,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0xff,
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x31,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x01, 0x11,
},
entries: []testEntry{
{
address: "w",
display: "0",
authProtocol: "MIT-MAGIC-COOKIE-1",
authCookie: "ff",
},
},
},
{
name: "clean up old entries",
authFile: []byte{
// w/unix:0 MIT-MAGIC-COOKIE-1 80507df050756cdefa504b65adb3bcfb
// w/unix:0 MIT-MAGIC-COOKIE-1 267b37f6cbc11b97beb826bb1aab8570
// w/unix:0 MIT-MAGIC-COOKIE-1 516e22e2b11d1bd0115dff09c028ca5c
//
// 00000000: 0100 0001 7700 0130 0012 4d49 542d 4d41 ....w..0..MIT-MA
// 00000010: 4749 432d 434f 4f4b 4945 2d31 0010 8050 GIC-COOKIE-1...P
// 00000020: 7df0 5075 6cde fa50 4b65 adb3 bcfb 0100 }.Pul..PKe......
// 00000030: 0001 7700 0130 0012 4d49 542d 4d41 4749 ..w..0..MIT-MAGI
// 00000040: 432d 434f 4f4b 4945 2d31 0010 267b 37f6 C-COOKIE-1..&{7.
// 00000050: cbc1 1b97 beb8 26bb 1aab 8570 0100 0001 ......&....p....
// 00000060: 7700 0130 0012 4d49 542d 4d41 4749 432d w..0..MIT-MAGIC-
// 00000070: 434f 4f4b 4945 2d31 0010 516e 22e2 b11d COOKIE-1..Qn"...
// 00000080: 1bd0 115d ff09 c028 ca5c ...]...(.\
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x30,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x10, 0x80, 0x50,
0x7d, 0xf0, 0x50, 0x75, 0x6c, 0xde, 0xfa, 0x50,
0x4b, 0x65, 0xad, 0xb3, 0xbc, 0xfb, 0x01, 0x00,
0x00, 0x01, 0x77, 0x00, 0x01, 0x30, 0x00, 0x12,
0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41, 0x47, 0x49,
0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b, 0x49, 0x45,
0x2d, 0x31, 0x00, 0x10, 0x26, 0x7b, 0x37, 0xf6,
0xcb, 0xc1, 0x1b, 0x97, 0xbe, 0xb8, 0x26, 0xbb,
0x1a, 0xab, 0x85, 0x70, 0x01, 0x00, 0x00, 0x01,
0x77, 0x00, 0x01, 0x30, 0x00, 0x12, 0x4d, 0x49,
0x54, 0x2d, 0x4d, 0x41, 0x47, 0x49, 0x43, 0x2d,
0x43, 0x4f, 0x4f, 0x4b, 0x49, 0x45, 0x2d, 0x31,
0x00, 0x10, 0x51, 0x6e, 0x22, 0xe2, 0xb1, 0x1d,
0x1b, 0xd0, 0x11, 0x5d, 0xff, 0x09, 0xc0, 0x28,
0xca, 0x5c,
},
wantAuthFile: []byte{
// w/unix:0 MIT-MAGIC-COOKIE-1 516e5bc892b7162b844abd1fc1a7c16e
//
// 00000000: 0100 0001 7700 0130 0012 4d49 542d 4d41 ....w..0..MIT-MA
// 00000010: 4749 432d 434f 4f4b 4945 2d31 0010 516e GIC-COOKIE-1..Qn
// 00000020: 5bc8 92b7 162b 844a bd1f c1a7 c16e [....+.J.....n
0x01, 0x00, 0x00, 0x01, 0x77, 0x00, 0x01, 0x30,
0x00, 0x12, 0x4d, 0x49, 0x54, 0x2d, 0x4d, 0x41,
0x47, 0x49, 0x43, 0x2d, 0x43, 0x4f, 0x4f, 0x4b,
0x49, 0x45, 0x2d, 0x31, 0x00, 0x10, 0x51, 0x6e,
0x5b, 0xc8, 0x92, 0xb7, 0x16, 0x2b, 0x84, 0x4a,
0xbd, 0x1f, 0xc1, 0xa7, 0xc1, 0x6e,
},
entries: []testEntry{
{
address: "w",
display: "0",
authProtocol: "MIT-MAGIC-COOKIE-1",
authCookie: "516e5bc892b7162b844abd1fc1a7c16e",
},
},
},
}
homedir, err := os.UserHomeDir()
require.NoError(t, err)
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
fs := afero.NewMemMapFs()
if tt.authFile != nil {
err := afero.WriteFile(fs, filepath.Join(homedir, ".Xauthority"), tt.authFile, 0o600)
require.NoError(t, err)
}
for _, entry := range tt.entries {
err := addXauthEntry(context.Background(), fs, entry.address, entry.display, entry.authProtocol, entry.authCookie)
require.NoError(t, err)
}
gotAuthFile, err := afero.ReadFile(fs, filepath.Join(homedir, ".Xauthority"))
require.NoError(t, err)
if diff := cmp.Diff(tt.wantAuthFile, gotAuthFile); diff != "" {
assert.Failf(t, "addXauthEntry() mismatch", "(-want +got):\n%s", diff)
}
})
}
}
+3 -3
View File
@@ -19,9 +19,9 @@ import (
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/agent/agentssh"
"github.com/coder/coder/codersdk/agentsdk"
"github.com/coder/coder/testutil"
"github.com/coder/coder/v2/agent/agentssh"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/coder/v2/testutil"
)
func TestServer_X11(t *testing.T) {
+57
View File
@@ -0,0 +1,57 @@
package agenttest
import (
"context"
"net/url"
"testing"
"github.com/stretchr/testify/assert"
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/v2/agent"
"github.com/coder/coder/v2/codersdk/agentsdk"
)
// New starts a new agent for use in tests.
// The agent will use the provided coder URL and session token.
// The options passed to agent.New() can be modified by passing an optional
// variadic func(*agent.Options).
// Returns the agent. Closing the agent is handled by the test cleanup.
// It is the responsibility of the caller to call coderdtest.AwaitWorkspaceAgents
// to ensure agent is connected.
func New(t testing.TB, coderURL *url.URL, agentToken string, opts ...func(*agent.Options)) agent.Agent {
t.Helper()
var o agent.Options
log := slogtest.Make(t, nil).Leveled(slog.LevelDebug).Named("agent")
o.Logger = log
for _, opt := range opts {
opt(&o)
}
if o.Client == nil {
agentClient := agentsdk.New(coderURL)
agentClient.SetSessionToken(agentToken)
agentClient.SDK.SetLogger(log)
o.Client = agentClient
}
if o.ExchangeToken == nil {
o.ExchangeToken = func(_ context.Context) (string, error) {
return agentToken, nil
}
}
if o.LogDir == "" {
o.LogDir = t.TempDir()
}
agt := agent.New(o)
t.Cleanup(func() {
assert.NoError(t, agt.Close(), "failed to close agent during cleanup")
})
return agt
}
+304
View File
@@ -0,0 +1,304 @@
package agenttest
import (
"context"
"io"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/google/uuid"
"github.com/stretchr/testify/require"
"golang.org/x/exp/maps"
"golang.org/x/xerrors"
"storj.io/drpc"
"storj.io/drpc/drpcmux"
"storj.io/drpc/drpcserver"
"tailscale.com/tailcfg"
"cdr.dev/slog"
agentproto "github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
drpcsdk "github.com/coder/coder/v2/codersdk/drpc"
"github.com/coder/coder/v2/tailnet"
"github.com/coder/coder/v2/tailnet/proto"
"github.com/coder/coder/v2/testutil"
)
func NewClient(t testing.TB,
logger slog.Logger,
agentID uuid.UUID,
manifest agentsdk.Manifest,
statsChan chan *agentsdk.Stats,
coordinator tailnet.Coordinator,
) *Client {
if manifest.AgentID == uuid.Nil {
manifest.AgentID = agentID
}
coordPtr := atomic.Pointer[tailnet.Coordinator]{}
coordPtr.Store(&coordinator)
mux := drpcmux.New()
derpMapUpdates := make(chan *tailcfg.DERPMap)
drpcService := &tailnet.DRPCService{
CoordPtr: &coordPtr,
Logger: logger,
DerpMapUpdateFrequency: time.Microsecond,
DerpMapFn: func() *tailcfg.DERPMap { return <-derpMapUpdates },
}
err := proto.DRPCRegisterTailnet(mux, drpcService)
require.NoError(t, err)
mp, err := agentsdk.ProtoFromManifest(manifest)
require.NoError(t, err)
fakeAAPI := NewFakeAgentAPI(t, logger, mp)
err = agentproto.DRPCRegisterAgent(mux, fakeAAPI)
require.NoError(t, err)
server := drpcserver.NewWithOptions(mux, drpcserver.Options{
Log: func(err error) {
if xerrors.Is(err, io.EOF) {
return
}
logger.Debug(context.Background(), "drpc server error", slog.Error(err))
},
})
return &Client{
t: t,
logger: logger.Named("client"),
agentID: agentID,
statsChan: statsChan,
coordinator: coordinator,
server: server,
fakeAgentAPI: fakeAAPI,
derpMapUpdates: derpMapUpdates,
}
}
type Client struct {
t testing.TB
logger slog.Logger
agentID uuid.UUID
metadata map[string]agentsdk.Metadata
statsChan chan *agentsdk.Stats
coordinator tailnet.Coordinator
server *drpcserver.Server
fakeAgentAPI *FakeAgentAPI
LastWorkspaceAgent func()
PatchWorkspaceLogs func() error
mu sync.Mutex // Protects following.
lifecycleStates []codersdk.WorkspaceAgentLifecycle
logs []agentsdk.Log
derpMapUpdates chan *tailcfg.DERPMap
derpMapOnce sync.Once
}
func (*Client) RewriteDERPMap(*tailcfg.DERPMap) {}
func (c *Client) Close() {
c.derpMapOnce.Do(func() { close(c.derpMapUpdates) })
}
func (c *Client) ConnectRPC(ctx context.Context) (drpc.Conn, error) {
conn, lis := drpcsdk.MemTransportPipe()
c.LastWorkspaceAgent = func() {
_ = conn.Close()
_ = lis.Close()
}
c.t.Cleanup(c.LastWorkspaceAgent)
serveCtx, cancel := context.WithCancel(ctx)
c.t.Cleanup(cancel)
auth := tailnet.AgentTunnelAuth{}
streamID := tailnet.StreamID{
Name: "agenttest",
ID: c.agentID,
Auth: auth,
}
serveCtx = tailnet.WithStreamID(serveCtx, streamID)
go func() {
_ = c.server.Serve(serveCtx, lis)
}()
return conn, nil
}
func (c *Client) ReportStats(ctx context.Context, _ slog.Logger, statsChan <-chan *agentsdk.Stats, setInterval func(time.Duration)) (io.Closer, error) {
doneCh := make(chan struct{})
ctx, cancel := context.WithCancel(ctx)
go func() {
defer close(doneCh)
setInterval(500 * time.Millisecond)
for {
select {
case <-ctx.Done():
return
case stat := <-statsChan:
select {
case c.statsChan <- stat:
case <-ctx.Done():
return
default:
// We don't want to send old stats.
continue
}
}
}
}()
return closeFunc(func() error {
cancel()
<-doneCh
close(c.statsChan)
return nil
}), nil
}
func (c *Client) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle {
c.mu.Lock()
defer c.mu.Unlock()
return c.lifecycleStates
}
func (c *Client) PostLifecycle(ctx context.Context, req agentsdk.PostLifecycleRequest) error {
c.mu.Lock()
defer c.mu.Unlock()
c.lifecycleStates = append(c.lifecycleStates, req.State)
c.logger.Debug(ctx, "post lifecycle", slog.F("req", req))
return nil
}
func (c *Client) GetStartup() <-chan *agentproto.Startup {
return c.fakeAgentAPI.startupCh
}
func (c *Client) GetMetadata() map[string]agentsdk.Metadata {
c.mu.Lock()
defer c.mu.Unlock()
return maps.Clone(c.metadata)
}
func (c *Client) PostMetadata(ctx context.Context, req agentsdk.PostMetadataRequest) error {
c.mu.Lock()
defer c.mu.Unlock()
if c.metadata == nil {
c.metadata = make(map[string]agentsdk.Metadata)
}
for _, md := range req.Metadata {
c.metadata[md.Key] = md
c.logger.Debug(ctx, "post metadata", slog.F("key", md.Key), slog.F("md", md))
}
return nil
}
func (c *Client) GetStartupLogs() []agentsdk.Log {
c.mu.Lock()
defer c.mu.Unlock()
return c.logs
}
func (c *Client) PatchLogs(ctx context.Context, logs agentsdk.PatchLogs) error {
c.mu.Lock()
defer c.mu.Unlock()
if c.PatchWorkspaceLogs != nil {
return c.PatchWorkspaceLogs()
}
c.logs = append(c.logs, logs.Logs...)
c.logger.Debug(ctx, "patch startup logs", slog.F("req", logs))
return nil
}
func (c *Client) SetServiceBannerFunc(f func() (codersdk.ServiceBannerConfig, error)) {
c.fakeAgentAPI.SetServiceBannerFunc(f)
}
func (c *Client) PushDERPMapUpdate(update *tailcfg.DERPMap) error {
timer := time.NewTimer(testutil.WaitShort)
defer timer.Stop()
select {
case c.derpMapUpdates <- update:
case <-timer.C:
return xerrors.New("timeout waiting to push derp map update")
}
return nil
}
type closeFunc func() error
func (c closeFunc) Close() error {
return c()
}
type FakeAgentAPI struct {
sync.Mutex
t testing.TB
logger slog.Logger
manifest *agentproto.Manifest
startupCh chan *agentproto.Startup
getServiceBannerFunc func() (codersdk.ServiceBannerConfig, error)
}
func (f *FakeAgentAPI) GetManifest(context.Context, *agentproto.GetManifestRequest) (*agentproto.Manifest, error) {
return f.manifest, nil
}
func (f *FakeAgentAPI) SetServiceBannerFunc(fn func() (codersdk.ServiceBannerConfig, error)) {
f.Lock()
defer f.Unlock()
f.getServiceBannerFunc = fn
f.logger.Info(context.Background(), "updated ServiceBannerFunc")
}
func (f *FakeAgentAPI) GetServiceBanner(context.Context, *agentproto.GetServiceBannerRequest) (*agentproto.ServiceBanner, error) {
f.Lock()
defer f.Unlock()
if f.getServiceBannerFunc == nil {
return &agentproto.ServiceBanner{}, nil
}
sb, err := f.getServiceBannerFunc()
if err != nil {
return nil, err
}
return agentsdk.ProtoFromServiceBanner(sb), nil
}
func (*FakeAgentAPI) UpdateStats(context.Context, *agentproto.UpdateStatsRequest) (*agentproto.UpdateStatsResponse, error) {
// TODO implement me
panic("implement me")
}
func (*FakeAgentAPI) UpdateLifecycle(context.Context, *agentproto.UpdateLifecycleRequest) (*agentproto.Lifecycle, error) {
// TODO implement me
panic("implement me")
}
func (f *FakeAgentAPI) BatchUpdateAppHealths(ctx context.Context, req *agentproto.BatchUpdateAppHealthRequest) (*agentproto.BatchUpdateAppHealthResponse, error) {
f.logger.Debug(ctx, "batch update app health", slog.F("req", req))
return &agentproto.BatchUpdateAppHealthResponse{}, nil
}
func (f *FakeAgentAPI) UpdateStartup(_ context.Context, req *agentproto.UpdateStartupRequest) (*agentproto.Startup, error) {
f.startupCh <- req.GetStartup()
return req.GetStartup(), nil
}
func (*FakeAgentAPI) BatchUpdateMetadata(context.Context, *agentproto.BatchUpdateMetadataRequest) (*agentproto.BatchUpdateMetadataResponse, error) {
// TODO implement me
panic("implement me")
}
func (*FakeAgentAPI) BatchCreateLogs(context.Context, *agentproto.BatchCreateLogsRequest) (*agentproto.BatchCreateLogsResponse, error) {
// TODO implement me
panic("implement me")
}
func NewFakeAgentAPI(t testing.TB, logger slog.Logger, manifest *agentproto.Manifest) *FakeAgentAPI {
return &FakeAgentAPI{
t: t,
logger: logger.Named("FakeAgentAPI"),
manifest: manifest,
startupCh: make(chan *agentproto.Startup, 100),
}
}
+21 -8
View File
@@ -5,10 +5,10 @@ import (
"sync"
"time"
"github.com/go-chi/chi"
"github.com/go-chi/chi/v5"
"github.com/coder/coder/coderd/httpapi"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/v2/coderd/httpapi"
"github.com/coder/coder/v2/codersdk"
)
func (a *agent) apiHandler() http.Handler {
@@ -26,17 +26,30 @@ func (a *agent) apiHandler() http.Handler {
cpy[k] = b
}
lp := &listeningPortsHandler{ignorePorts: cpy}
cacheDuration := 1 * time.Second
if a.portCacheDuration > 0 {
cacheDuration = a.portCacheDuration
}
lp := &listeningPortsHandler{
ignorePorts: cpy,
cacheDuration: cacheDuration,
}
r.Get("/api/v0/listening-ports", lp.handler)
return r
}
type listeningPortsHandler struct {
mut sync.Mutex
ports []codersdk.WorkspaceAgentListeningPort
mtime time.Time
ignorePorts map[int]string
ignorePorts map[int]string
cacheDuration time.Duration
//nolint: unused // used on some but not all platforms
mut sync.Mutex
//nolint: unused // used on some but not all platforms
ports []codersdk.WorkspaceAgentListeningPort
//nolint: unused // used on some but not all platforms
mtime time.Time
}
// handler returns a list of listening ports. This is tested by coderd's
+2 -2
View File
@@ -10,8 +10,8 @@ import (
"golang.org/x/xerrors"
"cdr.dev/slog"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/codersdk/agentsdk"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/retry"
)
+5 -5
View File
@@ -13,11 +13,11 @@ import (
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/agent"
"github.com/coder/coder/coderd/httpapi"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/codersdk/agentsdk"
"github.com/coder/coder/testutil"
"github.com/coder/coder/v2/agent"
"github.com/coder/coder/v2/coderd/httpapi"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/coder/v2/testutil"
)
func TestAppHealth_Healthy(t *testing.T) {
+13 -1
View File
@@ -11,12 +11,15 @@ import (
"cdr.dev/slog"
"github.com/coder/coder/codersdk/agentsdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
)
type agentMetrics struct {
connectionsTotal prometheus.Counter
reconnectingPTYErrors *prometheus.CounterVec
// startupScriptSeconds is the time in seconds that the start script(s)
// took to run. This is reported once per agent.
startupScriptSeconds *prometheus.GaugeVec
}
func newAgentMetrics(registerer prometheus.Registerer) *agentMetrics {
@@ -35,9 +38,18 @@ func newAgentMetrics(registerer prometheus.Registerer) *agentMetrics {
)
registerer.MustRegister(reconnectingPTYErrors)
startupScriptSeconds := prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "coderd",
Subsystem: "agentstats",
Name: "startup_script_seconds",
Help: "Amount of time taken to run the startup script in seconds.",
}, []string{"success"})
registerer.MustRegister(startupScriptSeconds)
return &agentMetrics{
connectionsTotal: connectionsTotal,
reconnectingPTYErrors: reconnectingPTYErrors,
startupScriptSeconds: startupScriptSeconds,
}
}
+2 -2
View File
@@ -8,14 +8,14 @@ import (
"github.com/cakturk/go-netstat/netstat"
"golang.org/x/xerrors"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/v2/codersdk"
)
func (lp *listeningPortsHandler) getListeningPorts() ([]codersdk.WorkspaceAgentListeningPort, error) {
lp.mut.Lock()
defer lp.mut.Unlock()
if time.Since(lp.mtime) < time.Second {
if time.Since(lp.mtime) < lp.cacheDuration {
// copy
ports := make([]codersdk.WorkspaceAgentListeningPort, len(lp.ports))
copy(ports, lp.ports)
+2 -2
View File
@@ -2,9 +2,9 @@
package agent
import "github.com/coder/coder/codersdk"
import "github.com/coder/coder/v2/codersdk"
func (lp *listeningPortsHandler) getListeningPorts() ([]codersdk.WorkspaceAgentListeningPort, error) {
func (*listeningPortsHandler) getListeningPorts() ([]codersdk.WorkspaceAgentListeningPort, error) {
// Can't scan for ports on non-linux or non-windows_amd64 systems at the
// moment. The UI will not show any "no ports found" message to the user, so
// the user won't suspect a thing.
File diff suppressed because it is too large Load Diff
+261
View File
@@ -0,0 +1,261 @@
syntax = "proto3";
option go_package = "github.com/coder/coder/v2/agent/proto";
package coder.agent.v2;
import "tailnet/proto/tailnet.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
message WorkspaceApp {
bytes id = 1;
string url = 2;
bool external = 3;
string slug = 4;
string display_name = 5;
string command = 6;
string icon = 7;
bool subdomain = 8;
string subdomain_name = 9;
enum SharingLevel {
SHARING_LEVEL_UNSPECIFIED = 0;
OWNER = 1;
AUTHENTICATED = 2;
PUBLIC = 3;
}
SharingLevel sharing_level = 10;
message Healthcheck {
string url = 1;
google.protobuf.Duration interval = 2;
int32 threshold = 3;
}
Healthcheck healthcheck = 11;
enum Health {
HEALTH_UNSPECIFIED = 0;
DISABLED = 1;
INITIALIZING = 2;
HEALTHY = 3;
UNHEALTHY = 4;
}
Health health = 12;
}
message WorkspaceAgentScript {
bytes log_source_id = 1;
string log_path = 2;
string script = 3;
string cron = 4;
bool run_on_start = 5;
bool run_on_stop = 6;
bool start_blocks_login = 7;
google.protobuf.Duration timeout = 8;
}
message WorkspaceAgentMetadata {
message Result {
google.protobuf.Timestamp collected_at = 1;
int64 age = 2;
string value = 3;
string error = 4;
}
Result result = 1;
message Description {
string display_name = 1;
string key = 2;
string script = 3;
google.protobuf.Duration interval = 4;
google.protobuf.Duration timeout = 5;
}
Description description = 2;
}
message Manifest {
bytes agent_id = 1;
string agent_name = 15;
string owner_username = 13;
bytes workspace_id = 14;
string workspace_name = 16;
uint32 git_auth_configs = 2;
map<string, string> environment_variables = 3;
string directory = 4;
string vs_code_port_proxy_uri = 5;
string motd_path = 6;
bool disable_direct_connections = 7;
bool derp_force_websockets = 8;
coder.tailnet.v2.DERPMap derp_map = 9;
repeated WorkspaceAgentScript scripts = 10;
repeated WorkspaceApp apps = 11;
repeated WorkspaceAgentMetadata.Description metadata = 12;
}
message GetManifestRequest {}
message ServiceBanner {
bool enabled = 1;
string message = 2;
string background_color = 3;
}
message GetServiceBannerRequest {}
message Stats {
// ConnectionsByProto is a count of connections by protocol.
map<string, int64> connections_by_proto = 1;
// ConnectionCount is the number of connections received by an agent.
int64 connection_count = 2;
// ConnectionMedianLatencyMS is the median latency of all connections in milliseconds.
double connection_median_latency_ms = 3;
// RxPackets is the number of received packets.
int64 rx_packets = 4;
// RxBytes is the number of received bytes.
int64 rx_bytes = 5;
// TxPackets is the number of transmitted bytes.
int64 tx_packets = 6;
// TxBytes is the number of transmitted bytes.
int64 tx_bytes = 7;
// SessionCountVSCode is the number of connections received by an agent
// that are from our VS Code extension.
int64 session_count_vscode = 8;
// SessionCountJetBrains is the number of connections received by an agent
// that are from our JetBrains extension.
int64 session_count_jetbrains = 9;
// SessionCountReconnectingPTY is the number of connections received by an agent
// that are from the reconnecting web terminal.
int64 session_count_reconnecting_pty = 10;
// SessionCountSSH is the number of connections received by an agent
// that are normal, non-tagged SSH sessions.
int64 session_count_ssh = 11;
message Metric {
string name = 1;
enum Type {
TYPE_UNSPECIFIED = 0;
COUNTER = 1;
GAUGE = 2;
}
Type type = 2;
double value = 3;
message Label {
string name = 1;
string value = 2;
}
repeated Label labels = 4;
}
repeated Metric metrics = 12;
}
message UpdateStatsRequest{
Stats stats = 1;
}
message UpdateStatsResponse {
google.protobuf.Duration report_interval = 1;
}
message Lifecycle {
enum State {
STATE_UNSPECIFIED = 0;
CREATED = 1;
STARTING = 2;
START_TIMEOUT = 3;
START_ERROR = 4;
READY = 5;
SHUTTING_DOWN = 6;
SHUTDOWN_TIMEOUT = 7;
SHUTDOWN_ERROR = 8;
OFF = 9;
}
State state = 1;
google.protobuf.Timestamp changed_at = 2;
}
message UpdateLifecycleRequest {
Lifecycle lifecycle = 1;
}
enum AppHealth {
APP_HEALTH_UNSPECIFIED = 0;
DISABLED = 1;
INITIALIZING = 2;
HEALTHY = 3;
UNHEALTHY = 4;
}
message BatchUpdateAppHealthRequest {
message HealthUpdate {
bytes id = 1;
AppHealth health = 2;
}
repeated HealthUpdate updates = 1;
}
message BatchUpdateAppHealthResponse {}
message Startup {
string version = 1;
string expanded_directory = 2;
enum Subsystem {
SUBSYSTEM_UNSPECIFIED = 0;
ENVBOX = 1;
ENVBUILDER = 2;
EXECTRACE = 3;
}
repeated Subsystem subsystems = 3;
}
message UpdateStartupRequest{
Startup startup = 1;
}
message Metadata {
string key = 1;
WorkspaceAgentMetadata.Result result = 2;
}
message BatchUpdateMetadataRequest {
repeated Metadata metadata = 2;
}
message BatchUpdateMetadataResponse {}
message Log {
google.protobuf.Timestamp created_at = 1;
string output = 2;
enum Level {
LEVEL_UNSPECIFIED = 0;
TRACE = 1;
DEBUG = 2;
INFO = 3;
WARN = 4;
ERROR = 5;
}
Level level = 3;
}
message BatchCreateLogsRequest {
bytes log_source_id = 1;
repeated Log logs = 2;
}
message BatchCreateLogsResponse {}
service Agent {
rpc GetManifest(GetManifestRequest) returns (Manifest);
rpc GetServiceBanner(GetServiceBannerRequest) returns (ServiceBanner);
rpc UpdateStats(UpdateStatsRequest) returns (UpdateStatsResponse);
rpc UpdateLifecycle(UpdateLifecycleRequest) returns (Lifecycle);
rpc BatchUpdateAppHealths(BatchUpdateAppHealthRequest) returns (BatchUpdateAppHealthResponse);
rpc UpdateStartup(UpdateStartupRequest) returns (Startup);
rpc BatchUpdateMetadata(BatchUpdateMetadataRequest) returns (BatchUpdateMetadataResponse);
rpc BatchCreateLogs(BatchCreateLogsRequest) returns (BatchCreateLogsResponse);
}
+391
View File
@@ -0,0 +1,391 @@
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.33
// source: agent/proto/agent.proto
package proto
import (
context "context"
errors "errors"
protojson "google.golang.org/protobuf/encoding/protojson"
proto "google.golang.org/protobuf/proto"
drpc "storj.io/drpc"
drpcerr "storj.io/drpc/drpcerr"
)
type drpcEncoding_File_agent_proto_agent_proto struct{}
func (drpcEncoding_File_agent_proto_agent_proto) Marshal(msg drpc.Message) ([]byte, error) {
return proto.Marshal(msg.(proto.Message))
}
func (drpcEncoding_File_agent_proto_agent_proto) MarshalAppend(buf []byte, msg drpc.Message) ([]byte, error) {
return proto.MarshalOptions{}.MarshalAppend(buf, msg.(proto.Message))
}
func (drpcEncoding_File_agent_proto_agent_proto) Unmarshal(buf []byte, msg drpc.Message) error {
return proto.Unmarshal(buf, msg.(proto.Message))
}
func (drpcEncoding_File_agent_proto_agent_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
return protojson.Marshal(msg.(proto.Message))
}
func (drpcEncoding_File_agent_proto_agent_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
return protojson.Unmarshal(buf, msg.(proto.Message))
}
type DRPCAgentClient interface {
DRPCConn() drpc.Conn
GetManifest(ctx context.Context, in *GetManifestRequest) (*Manifest, error)
GetServiceBanner(ctx context.Context, in *GetServiceBannerRequest) (*ServiceBanner, error)
UpdateStats(ctx context.Context, in *UpdateStatsRequest) (*UpdateStatsResponse, error)
UpdateLifecycle(ctx context.Context, in *UpdateLifecycleRequest) (*Lifecycle, error)
BatchUpdateAppHealths(ctx context.Context, in *BatchUpdateAppHealthRequest) (*BatchUpdateAppHealthResponse, error)
UpdateStartup(ctx context.Context, in *UpdateStartupRequest) (*Startup, error)
BatchUpdateMetadata(ctx context.Context, in *BatchUpdateMetadataRequest) (*BatchUpdateMetadataResponse, error)
BatchCreateLogs(ctx context.Context, in *BatchCreateLogsRequest) (*BatchCreateLogsResponse, error)
}
type drpcAgentClient struct {
cc drpc.Conn
}
func NewDRPCAgentClient(cc drpc.Conn) DRPCAgentClient {
return &drpcAgentClient{cc}
}
func (c *drpcAgentClient) DRPCConn() drpc.Conn { return c.cc }
func (c *drpcAgentClient) GetManifest(ctx context.Context, in *GetManifestRequest) (*Manifest, error) {
out := new(Manifest)
err := c.cc.Invoke(ctx, "/coder.agent.v2.Agent/GetManifest", drpcEncoding_File_agent_proto_agent_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcAgentClient) GetServiceBanner(ctx context.Context, in *GetServiceBannerRequest) (*ServiceBanner, error) {
out := new(ServiceBanner)
err := c.cc.Invoke(ctx, "/coder.agent.v2.Agent/GetServiceBanner", drpcEncoding_File_agent_proto_agent_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcAgentClient) UpdateStats(ctx context.Context, in *UpdateStatsRequest) (*UpdateStatsResponse, error) {
out := new(UpdateStatsResponse)
err := c.cc.Invoke(ctx, "/coder.agent.v2.Agent/UpdateStats", drpcEncoding_File_agent_proto_agent_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcAgentClient) UpdateLifecycle(ctx context.Context, in *UpdateLifecycleRequest) (*Lifecycle, error) {
out := new(Lifecycle)
err := c.cc.Invoke(ctx, "/coder.agent.v2.Agent/UpdateLifecycle", drpcEncoding_File_agent_proto_agent_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcAgentClient) BatchUpdateAppHealths(ctx context.Context, in *BatchUpdateAppHealthRequest) (*BatchUpdateAppHealthResponse, error) {
out := new(BatchUpdateAppHealthResponse)
err := c.cc.Invoke(ctx, "/coder.agent.v2.Agent/BatchUpdateAppHealths", drpcEncoding_File_agent_proto_agent_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcAgentClient) UpdateStartup(ctx context.Context, in *UpdateStartupRequest) (*Startup, error) {
out := new(Startup)
err := c.cc.Invoke(ctx, "/coder.agent.v2.Agent/UpdateStartup", drpcEncoding_File_agent_proto_agent_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcAgentClient) BatchUpdateMetadata(ctx context.Context, in *BatchUpdateMetadataRequest) (*BatchUpdateMetadataResponse, error) {
out := new(BatchUpdateMetadataResponse)
err := c.cc.Invoke(ctx, "/coder.agent.v2.Agent/BatchUpdateMetadata", drpcEncoding_File_agent_proto_agent_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcAgentClient) BatchCreateLogs(ctx context.Context, in *BatchCreateLogsRequest) (*BatchCreateLogsResponse, error) {
out := new(BatchCreateLogsResponse)
err := c.cc.Invoke(ctx, "/coder.agent.v2.Agent/BatchCreateLogs", drpcEncoding_File_agent_proto_agent_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
type DRPCAgentServer interface {
GetManifest(context.Context, *GetManifestRequest) (*Manifest, error)
GetServiceBanner(context.Context, *GetServiceBannerRequest) (*ServiceBanner, error)
UpdateStats(context.Context, *UpdateStatsRequest) (*UpdateStatsResponse, error)
UpdateLifecycle(context.Context, *UpdateLifecycleRequest) (*Lifecycle, error)
BatchUpdateAppHealths(context.Context, *BatchUpdateAppHealthRequest) (*BatchUpdateAppHealthResponse, error)
UpdateStartup(context.Context, *UpdateStartupRequest) (*Startup, error)
BatchUpdateMetadata(context.Context, *BatchUpdateMetadataRequest) (*BatchUpdateMetadataResponse, error)
BatchCreateLogs(context.Context, *BatchCreateLogsRequest) (*BatchCreateLogsResponse, error)
}
type DRPCAgentUnimplementedServer struct{}
func (s *DRPCAgentUnimplementedServer) GetManifest(context.Context, *GetManifestRequest) (*Manifest, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCAgentUnimplementedServer) GetServiceBanner(context.Context, *GetServiceBannerRequest) (*ServiceBanner, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCAgentUnimplementedServer) UpdateStats(context.Context, *UpdateStatsRequest) (*UpdateStatsResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCAgentUnimplementedServer) UpdateLifecycle(context.Context, *UpdateLifecycleRequest) (*Lifecycle, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCAgentUnimplementedServer) BatchUpdateAppHealths(context.Context, *BatchUpdateAppHealthRequest) (*BatchUpdateAppHealthResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCAgentUnimplementedServer) UpdateStartup(context.Context, *UpdateStartupRequest) (*Startup, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCAgentUnimplementedServer) BatchUpdateMetadata(context.Context, *BatchUpdateMetadataRequest) (*BatchUpdateMetadataResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCAgentUnimplementedServer) BatchCreateLogs(context.Context, *BatchCreateLogsRequest) (*BatchCreateLogsResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
type DRPCAgentDescription struct{}
func (DRPCAgentDescription) NumMethods() int { return 8 }
func (DRPCAgentDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n {
case 0:
return "/coder.agent.v2.Agent/GetManifest", drpcEncoding_File_agent_proto_agent_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAgentServer).
GetManifest(
ctx,
in1.(*GetManifestRequest),
)
}, DRPCAgentServer.GetManifest, true
case 1:
return "/coder.agent.v2.Agent/GetServiceBanner", drpcEncoding_File_agent_proto_agent_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAgentServer).
GetServiceBanner(
ctx,
in1.(*GetServiceBannerRequest),
)
}, DRPCAgentServer.GetServiceBanner, true
case 2:
return "/coder.agent.v2.Agent/UpdateStats", drpcEncoding_File_agent_proto_agent_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAgentServer).
UpdateStats(
ctx,
in1.(*UpdateStatsRequest),
)
}, DRPCAgentServer.UpdateStats, true
case 3:
return "/coder.agent.v2.Agent/UpdateLifecycle", drpcEncoding_File_agent_proto_agent_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAgentServer).
UpdateLifecycle(
ctx,
in1.(*UpdateLifecycleRequest),
)
}, DRPCAgentServer.UpdateLifecycle, true
case 4:
return "/coder.agent.v2.Agent/BatchUpdateAppHealths", drpcEncoding_File_agent_proto_agent_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAgentServer).
BatchUpdateAppHealths(
ctx,
in1.(*BatchUpdateAppHealthRequest),
)
}, DRPCAgentServer.BatchUpdateAppHealths, true
case 5:
return "/coder.agent.v2.Agent/UpdateStartup", drpcEncoding_File_agent_proto_agent_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAgentServer).
UpdateStartup(
ctx,
in1.(*UpdateStartupRequest),
)
}, DRPCAgentServer.UpdateStartup, true
case 6:
return "/coder.agent.v2.Agent/BatchUpdateMetadata", drpcEncoding_File_agent_proto_agent_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAgentServer).
BatchUpdateMetadata(
ctx,
in1.(*BatchUpdateMetadataRequest),
)
}, DRPCAgentServer.BatchUpdateMetadata, true
case 7:
return "/coder.agent.v2.Agent/BatchCreateLogs", drpcEncoding_File_agent_proto_agent_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAgentServer).
BatchCreateLogs(
ctx,
in1.(*BatchCreateLogsRequest),
)
}, DRPCAgentServer.BatchCreateLogs, true
default:
return "", nil, nil, nil, false
}
}
func DRPCRegisterAgent(mux drpc.Mux, impl DRPCAgentServer) error {
return mux.Register(impl, DRPCAgentDescription{})
}
type DRPCAgent_GetManifestStream interface {
drpc.Stream
SendAndClose(*Manifest) error
}
type drpcAgent_GetManifestStream struct {
drpc.Stream
}
func (x *drpcAgent_GetManifestStream) SendAndClose(m *Manifest) error {
if err := x.MsgSend(m, drpcEncoding_File_agent_proto_agent_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCAgent_GetServiceBannerStream interface {
drpc.Stream
SendAndClose(*ServiceBanner) error
}
type drpcAgent_GetServiceBannerStream struct {
drpc.Stream
}
func (x *drpcAgent_GetServiceBannerStream) SendAndClose(m *ServiceBanner) error {
if err := x.MsgSend(m, drpcEncoding_File_agent_proto_agent_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCAgent_UpdateStatsStream interface {
drpc.Stream
SendAndClose(*UpdateStatsResponse) error
}
type drpcAgent_UpdateStatsStream struct {
drpc.Stream
}
func (x *drpcAgent_UpdateStatsStream) SendAndClose(m *UpdateStatsResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_agent_proto_agent_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCAgent_UpdateLifecycleStream interface {
drpc.Stream
SendAndClose(*Lifecycle) error
}
type drpcAgent_UpdateLifecycleStream struct {
drpc.Stream
}
func (x *drpcAgent_UpdateLifecycleStream) SendAndClose(m *Lifecycle) error {
if err := x.MsgSend(m, drpcEncoding_File_agent_proto_agent_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCAgent_BatchUpdateAppHealthsStream interface {
drpc.Stream
SendAndClose(*BatchUpdateAppHealthResponse) error
}
type drpcAgent_BatchUpdateAppHealthsStream struct {
drpc.Stream
}
func (x *drpcAgent_BatchUpdateAppHealthsStream) SendAndClose(m *BatchUpdateAppHealthResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_agent_proto_agent_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCAgent_UpdateStartupStream interface {
drpc.Stream
SendAndClose(*Startup) error
}
type drpcAgent_UpdateStartupStream struct {
drpc.Stream
}
func (x *drpcAgent_UpdateStartupStream) SendAndClose(m *Startup) error {
if err := x.MsgSend(m, drpcEncoding_File_agent_proto_agent_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCAgent_BatchUpdateMetadataStream interface {
drpc.Stream
SendAndClose(*BatchUpdateMetadataResponse) error
}
type drpcAgent_BatchUpdateMetadataStream struct {
drpc.Stream
}
func (x *drpcAgent_BatchUpdateMetadataStream) SendAndClose(m *BatchUpdateMetadataResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_agent_proto_agent_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCAgent_BatchCreateLogsStream interface {
drpc.Stream
SendAndClose(*BatchCreateLogsResponse) error
}
type drpcAgent_BatchCreateLogsStream struct {
drpc.Stream
}
func (x *drpcAgent_BatchCreateLogsStream) SendAndClose(m *BatchCreateLogsResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_agent_proto_agent_proto{}); err != nil {
return err
}
return x.CloseSend()
}
+26
View File
@@ -0,0 +1,26 @@
package proto
func LabelsEqual(a, b []*Stats_Metric_Label) bool {
am := make(map[string]string, len(a))
for _, lbl := range a {
v := lbl.GetValue()
if v == "" {
// Prometheus considers empty labels as equivalent to being absent
continue
}
am[lbl.GetName()] = lbl.GetValue()
}
lenB := 0
for _, lbl := range b {
v := lbl.GetValue()
if v == "" {
// Prometheus considers empty labels as equivalent to being absent
continue
}
lenB++
if am[lbl.GetName()] != v {
return false
}
}
return len(am) == lenB
}
+77
View File
@@ -0,0 +1,77 @@
package proto_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/coder/coder/v2/agent/proto"
)
func TestLabelsEqual(t *testing.T) {
t.Parallel()
for _, tc := range []struct {
name string
a []*proto.Stats_Metric_Label
b []*proto.Stats_Metric_Label
eq bool
}{
{
name: "mainlineEq",
a: []*proto.Stats_Metric_Label{
{Name: "credulity", Value: "sus"},
{Name: "color", Value: "aquamarine"},
},
b: []*proto.Stats_Metric_Label{
{Name: "credulity", Value: "sus"},
{Name: "color", Value: "aquamarine"},
},
eq: true,
},
{
name: "emptyValue",
a: []*proto.Stats_Metric_Label{
{Name: "credulity", Value: "sus"},
{Name: "color", Value: "aquamarine"},
{Name: "singularity", Value: ""},
},
b: []*proto.Stats_Metric_Label{
{Name: "credulity", Value: "sus"},
{Name: "color", Value: "aquamarine"},
},
eq: true,
},
{
name: "extra",
a: []*proto.Stats_Metric_Label{
{Name: "credulity", Value: "sus"},
{Name: "color", Value: "aquamarine"},
{Name: "opacity", Value: "seyshells"},
},
b: []*proto.Stats_Metric_Label{
{Name: "credulity", Value: "sus"},
{Name: "color", Value: "aquamarine"},
},
eq: false,
},
{
name: "different",
a: []*proto.Stats_Metric_Label{
{Name: "credulity", Value: "sus"},
{Name: "color", Value: "aquamarine"},
},
b: []*proto.Stats_Metric_Label{
{Name: "credulity", Value: "legit"},
{Name: "color", Value: "aquamarine"},
},
eq: false,
},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
require.Equal(t, tc.eq, proto.LabelsEqual(tc.a, tc.b))
require.Equal(t, tc.eq, proto.LabelsEqual(tc.b, tc.a))
})
}
}
+10
View File
@@ -0,0 +1,10 @@
package proto
import (
"github.com/coder/coder/v2/tailnet/proto"
)
// CurrentVersion is the current version of the agent API. It is tied to the
// tailnet API version to avoid confusion, since agents connect to the tailnet
// API over the same websocket.
var CurrentVersion = proto.CurrentVersion
+2 -2
View File
@@ -14,8 +14,8 @@ import (
"github.com/hashicorp/go-reap"
"github.com/stretchr/testify/require"
"github.com/coder/coder/agent/reaper"
"github.com/coder/coder/testutil"
"github.com/coder/coder/v2/agent/reaper"
"github.com/coder/coder/v2/testutil"
)
// TestReap checks that's the reaper is successfully reaping
+241
View File
@@ -0,0 +1,241 @@
package reconnectingpty
import (
"context"
"errors"
"io"
"net"
"time"
"github.com/armon/circbuf"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slices"
"golang.org/x/xerrors"
"cdr.dev/slog"
"github.com/coder/coder/v2/pty"
)
// bufferedReconnectingPTY provides a reconnectable PTY by using a ring buffer to store
// scrollback.
type bufferedReconnectingPTY struct {
command *pty.Cmd
activeConns map[string]net.Conn
circularBuffer *circbuf.Buffer
ptty pty.PTYCmd
process pty.Process
metrics *prometheus.CounterVec
state *ptyState
// timer will close the reconnecting pty when it expires. The timer will be
// reset as long as there are active connections.
timer *time.Timer
timeout time.Duration
}
// newBuffered starts the buffered pty. If the context ends the process will be
// killed.
func newBuffered(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.Logger) *bufferedReconnectingPTY {
rpty := &bufferedReconnectingPTY{
activeConns: map[string]net.Conn{},
command: cmd,
metrics: options.Metrics,
state: newState(),
timeout: options.Timeout,
}
// Default to buffer 64KiB.
circularBuffer, err := circbuf.NewBuffer(64 << 10)
if err != nil {
rpty.state.setState(StateDone, xerrors.Errorf("create circular buffer: %w", err))
return rpty
}
rpty.circularBuffer = circularBuffer
// Add TERM then start the command with a pty. pty.Cmd duplicates Path as the
// first argument so remove it.
cmdWithEnv := pty.CommandContext(ctx, cmd.Path, cmd.Args[1:]...)
cmdWithEnv.Env = append(rpty.command.Env, "TERM=xterm-256color")
cmdWithEnv.Dir = rpty.command.Dir
ptty, process, err := pty.Start(cmdWithEnv)
if err != nil {
rpty.state.setState(StateDone, xerrors.Errorf("start pty: %w", err))
return rpty
}
rpty.ptty = ptty
rpty.process = process
go rpty.lifecycle(ctx, logger)
// Multiplex the output onto the circular buffer and each active connection.
// We do not need to separately monitor for the process exiting. When it
// exits, our ptty.OutputReader() will return EOF after reading all process
// output.
go func() {
buffer := make([]byte, 1024)
for {
read, err := ptty.OutputReader().Read(buffer)
if err != nil {
// When the PTY is closed, this is triggered.
// Error is typically a benign EOF, so only log for debugging.
if errors.Is(err, io.EOF) {
logger.Debug(ctx, "unable to read pty output, command might have exited", slog.Error(err))
} else {
logger.Warn(ctx, "unable to read pty output, command might have exited", slog.Error(err))
rpty.metrics.WithLabelValues("output_reader").Add(1)
}
// Could have been killed externally or failed to start at all (command
// not found for example).
// TODO: Should we check the process's exit code in case the command was
// invalid?
rpty.Close(nil)
break
}
part := buffer[:read]
rpty.state.cond.L.Lock()
_, err = rpty.circularBuffer.Write(part)
if err != nil {
logger.Error(ctx, "write to circular buffer", slog.Error(err))
rpty.metrics.WithLabelValues("write_buffer").Add(1)
}
// TODO: Instead of ranging over a map, could we send the output to a
// channel and have each individual Attach read from that?
for cid, conn := range rpty.activeConns {
_, err = conn.Write(part)
if err != nil {
logger.Warn(ctx,
"error writing to active connection",
slog.F("connection_id", cid),
slog.Error(err),
)
rpty.metrics.WithLabelValues("write").Add(1)
}
}
rpty.state.cond.L.Unlock()
}
}()
return rpty
}
// lifecycle manages the lifecycle of the reconnecting pty. If the context ends
// or the reconnecting pty closes the pty will be shut down.
func (rpty *bufferedReconnectingPTY) lifecycle(ctx context.Context, logger slog.Logger) {
rpty.timer = time.AfterFunc(attachTimeout, func() {
rpty.Close(xerrors.New("reconnecting pty timeout"))
})
logger.Debug(ctx, "reconnecting pty ready")
rpty.state.setState(StateReady, nil)
state, reasonErr := rpty.state.waitForStateOrContext(ctx, StateClosing)
if state < StateClosing {
// If we have not closed yet then the context is what unblocked us (which
// means the agent is shutting down) so move into the closing phase.
rpty.Close(reasonErr)
}
rpty.timer.Stop()
rpty.state.cond.L.Lock()
// Log these closes only for debugging since the connections or processes
// might have already closed on their own.
for _, conn := range rpty.activeConns {
err := conn.Close()
if err != nil {
logger.Debug(ctx, "closed conn with error", slog.Error(err))
}
}
// Connections get removed once they close but it is possible there is still
// some data that will be written before that happens so clear the map now to
// avoid writing to closed connections.
rpty.activeConns = map[string]net.Conn{}
rpty.state.cond.L.Unlock()
// Log close/kill only for debugging since the process might have already
// closed on its own.
err := rpty.ptty.Close()
if err != nil {
logger.Debug(ctx, "closed ptty with error", slog.Error(err))
}
err = rpty.process.Kill()
if err != nil {
logger.Debug(ctx, "killed process with error", slog.Error(err))
}
logger.Info(ctx, "closed reconnecting pty")
rpty.state.setState(StateDone, reasonErr)
}
func (rpty *bufferedReconnectingPTY) Attach(ctx context.Context, connID string, conn net.Conn, height, width uint16, logger slog.Logger) error {
logger.Info(ctx, "attach to reconnecting pty")
// This will kill the heartbeat once we hit EOF or an error.
ctx, cancel := context.WithCancel(ctx)
defer cancel()
err := rpty.doAttach(connID, conn)
if err != nil {
return err
}
defer func() {
rpty.state.cond.L.Lock()
defer rpty.state.cond.L.Unlock()
delete(rpty.activeConns, connID)
}()
state, err := rpty.state.waitForStateOrContext(ctx, StateReady)
if state != StateReady {
return err
}
go heartbeat(ctx, rpty.timer, rpty.timeout)
// Resize the PTY to initial height + width.
err = rpty.ptty.Resize(height, width)
if err != nil {
// We can continue after this, it's not fatal!
logger.Warn(ctx, "reconnecting PTY initial resize failed, but will continue", slog.Error(err))
rpty.metrics.WithLabelValues("resize").Add(1)
}
// Pipe conn -> pty and block. pty -> conn is handled in newBuffered().
readConnLoop(ctx, conn, rpty.ptty, rpty.metrics, logger)
return nil
}
// doAttach adds the connection to the map and replays the buffer. It exists
// separately only for convenience to defer the mutex unlock which is not
// possible in Attach since it blocks.
func (rpty *bufferedReconnectingPTY) doAttach(connID string, conn net.Conn) error {
rpty.state.cond.L.Lock()
defer rpty.state.cond.L.Unlock()
// Write any previously stored data for the TTY. Since the command might be
// short-lived and have already exited, make sure we always at least output
// the buffer before returning, mostly just so tests pass.
prevBuf := slices.Clone(rpty.circularBuffer.Bytes())
_, err := conn.Write(prevBuf)
if err != nil {
rpty.metrics.WithLabelValues("write").Add(1)
return xerrors.Errorf("write buffer to conn: %w", err)
}
rpty.activeConns[connID] = conn
return nil
}
func (rpty *bufferedReconnectingPTY) Wait() {
_, _ = rpty.state.waitForState(StateClosing)
}
func (rpty *bufferedReconnectingPTY) Close(error error) {
// The closing state change will be handled by the lifecycle.
rpty.state.setState(StateClosing, error)
}
+226
View File
@@ -0,0 +1,226 @@
package reconnectingpty
import (
"context"
"encoding/json"
"io"
"net"
"os/exec"
"runtime"
"sync"
"time"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/xerrors"
"cdr.dev/slog"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/pty"
)
// attachTimeout is the initial timeout for attaching and will probably be far
// shorter than the reconnect timeout in most cases; in tests it might be
// longer. It should be at least long enough for the first screen attach to be
// able to start up the daemon and for the buffered pty to start.
const attachTimeout = 30 * time.Second
// Options allows configuring the reconnecting pty.
type Options struct {
// Timeout describes how long to keep the pty alive without any connections.
// Once elapsed the pty will be killed.
Timeout time.Duration
// Metrics tracks various error counters.
Metrics *prometheus.CounterVec
}
// ReconnectingPTY is a pty that can be reconnected within a timeout and to
// simultaneous connections. The reconnecting pty can be backed by screen if
// installed or a (buggy) buffer replay fallback.
type ReconnectingPTY interface {
// Attach pipes the connection and pty, spawning it if necessary, replays
// history, then blocks until EOF, an error, or the context's end. The
// connection is expected to send JSON-encoded messages and accept raw output
// from the ptty. If the context ends or the process dies the connection will
// be detached.
Attach(ctx context.Context, connID string, conn net.Conn, height, width uint16, logger slog.Logger) error
// Wait waits for the reconnecting pty to close. The underlying process might
// still be exiting.
Wait()
// Close kills the reconnecting pty process.
Close(err error)
}
// New sets up a new reconnecting pty that wraps the provided command. Any
// errors with starting are returned on Attach(). The reconnecting pty will
// close itself (and all connections to it) if nothing is attached for the
// duration of the timeout, if the context ends, or the process exits (buffered
// backend only).
func New(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.Logger) ReconnectingPTY {
if options.Timeout == 0 {
options.Timeout = 5 * time.Minute
}
// Screen seems flaky on Darwin. Locally the tests pass 100% of the time (100
// runs) but in CI screen often incorrectly claims the session name does not
// exist even though screen -list shows it. For now, restrict screen to
// Linux.
backendType := "buffered"
if runtime.GOOS == "linux" {
_, err := exec.LookPath("screen")
if err == nil {
backendType = "screen"
}
}
logger.Info(ctx, "start reconnecting pty", slog.F("backend_type", backendType))
switch backendType {
case "screen":
return newScreen(ctx, cmd, options, logger)
default:
return newBuffered(ctx, cmd, options, logger)
}
}
// heartbeat resets timer before timeout elapses and blocks until ctx ends.
func heartbeat(ctx context.Context, timer *time.Timer, timeout time.Duration) {
// Reset now in case it is near the end.
timer.Reset(timeout)
// Reset when the context ends to ensure the pty stays up for the full
// timeout.
defer timer.Reset(timeout)
heartbeat := time.NewTicker(timeout / 2)
defer heartbeat.Stop()
for {
select {
case <-ctx.Done():
return
case <-heartbeat.C:
timer.Reset(timeout)
}
}
}
// State represents the current state of the reconnecting pty. States are
// sequential and will only move forward.
type State int
const (
// StateStarting is the default/start state. Attaching will block until the
// reconnecting pty becomes ready.
StateStarting = iota
// StateReady means the reconnecting pty is ready to be attached.
StateReady
// StateClosing means the reconnecting pty has begun closing. The underlying
// process may still be exiting. Attaching will result in an error.
StateClosing
// StateDone means the reconnecting pty has completely shut down and the
// process has exited. Attaching will result in an error.
StateDone
)
// ptyState is a helper for tracking the reconnecting PTY's state.
type ptyState struct {
// cond broadcasts state changes and any accompanying errors.
cond *sync.Cond
// error describes the error that caused the state change, if there was one.
// It is not safe to access outside of cond.L.
error error
// state holds the current reconnecting pty state. It is not safe to access
// this outside of cond.L.
state State
}
func newState() *ptyState {
return &ptyState{
cond: sync.NewCond(&sync.Mutex{}),
state: StateStarting,
}
}
// setState sets and broadcasts the provided state if it is greater than the
// current state and the error if one has not already been set.
func (s *ptyState) setState(state State, err error) {
s.cond.L.Lock()
defer s.cond.L.Unlock()
// Cannot regress states. For example, trying to close after the process is
// done should leave us in the done state and not the closing state.
if state <= s.state {
return
}
s.error = err
s.state = state
s.cond.Broadcast()
}
// waitForState blocks until the state or a greater one is reached.
func (s *ptyState) waitForState(state State) (State, error) {
s.cond.L.Lock()
defer s.cond.L.Unlock()
for state > s.state {
s.cond.Wait()
}
return s.state, s.error
}
// waitForStateOrContext blocks until the state or a greater one is reached or
// the provided context ends.
func (s *ptyState) waitForStateOrContext(ctx context.Context, state State) (State, error) {
s.cond.L.Lock()
defer s.cond.L.Unlock()
nevermind := make(chan struct{})
defer close(nevermind)
go func() {
select {
case <-ctx.Done():
// Wake up when the context ends.
s.cond.Broadcast()
case <-nevermind:
}
}()
for ctx.Err() == nil && state > s.state {
s.cond.Wait()
}
if ctx.Err() != nil {
return s.state, ctx.Err()
}
return s.state, s.error
}
// readConnLoop reads messages from conn and writes to ptty as needed. Blocks
// until EOF or an error writing to ptty or reading from conn.
func readConnLoop(ctx context.Context, conn net.Conn, ptty pty.PTYCmd, metrics *prometheus.CounterVec, logger slog.Logger) {
decoder := json.NewDecoder(conn)
for {
var req codersdk.ReconnectingPTYRequest
err := decoder.Decode(&req)
if xerrors.Is(err, io.EOF) {
return
}
if err != nil {
logger.Warn(ctx, "reconnecting pty failed with read error", slog.Error(err))
return
}
_, err = ptty.InputWriter().Write([]byte(req.Data))
if err != nil {
logger.Warn(ctx, "reconnecting pty failed with write error", slog.Error(err))
metrics.WithLabelValues("input_writer").Add(1)
return
}
// Check if a resize needs to happen!
if req.Height == 0 || req.Width == 0 {
continue
}
err = ptty.Resize(req.Height, req.Width)
if err != nil {
// We can continue after this, it's not fatal!
logger.Warn(ctx, "reconnecting pty resize failed, but will continue", slog.Error(err))
metrics.WithLabelValues("resize").Add(1)
}
}
}
+389
View File
@@ -0,0 +1,389 @@
package reconnectingpty
import (
"bytes"
"context"
"crypto/rand"
"encoding/hex"
"errors"
"io"
"net"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
"time"
"github.com/gliderlabs/ssh"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/xerrors"
"cdr.dev/slog"
"github.com/coder/coder/v2/pty"
)
// screenReconnectingPTY provides a reconnectable PTY via `screen`.
type screenReconnectingPTY struct {
command *pty.Cmd
// id holds the id of the session for both creating and attaching. This will
// be generated uniquely for each session because without control of the
// screen daemon we do not have its PID and without the PID screen will do
// partial matching. Enforcing a unique ID should guarantee we match on the
// right session.
id string
// mutex prevents concurrent attaches to the session. Screen will happily
// spawn two separate sessions with the same name if multiple attaches happen
// in a close enough interval. We are not able to control the screen daemon
// ourselves to prevent this because the daemon will spawn with a hardcoded
// 24x80 size which results in confusing padding above the prompt once the
// attach comes in and resizes.
mutex sync.Mutex
configFile string
metrics *prometheus.CounterVec
state *ptyState
// timer will close the reconnecting pty when it expires. The timer will be
// reset as long as there are active connections.
timer *time.Timer
timeout time.Duration
}
// newScreen creates a new screen-backed reconnecting PTY. It writes config
// settings and creates the socket directory. If we could, we would want to
// spawn the daemon here and attach each connection to it but since doing that
// spawns the daemon with a hardcoded 24x80 size it is not a very good user
// experience. Instead we will let the attach command spawn the daemon on its
// own which causes it to spawn with the specified size.
func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.Logger) *screenReconnectingPTY {
rpty := &screenReconnectingPTY{
command: cmd,
metrics: options.Metrics,
state: newState(),
timeout: options.Timeout,
}
go rpty.lifecycle(ctx, logger)
// Socket paths are limited to around 100 characters on Linux and macOS which
// depending on the temporary directory can be a problem. To give more leeway
// use a short ID.
buf := make([]byte, 4)
_, err := rand.Read(buf)
if err != nil {
rpty.state.setState(StateDone, xerrors.Errorf("generate screen id: %w", err))
return rpty
}
rpty.id = hex.EncodeToString(buf)
settings := []string{
// Tell screen not to handle motion for xterm* terminals which allows
// scrolling the terminal via the mouse wheel or scroll bar (by default
// screen uses it to cycle through the command history). There does not
// seem to be a way to make screen itself scroll on mouse wheel. tmux can
// do it but then there is no scroll bar and it kicks you into copy mode
// where keys stop working until you exit copy mode which seems like it
// could be confusing.
"termcapinfo xterm* ti@:te@",
// Enable alternate screen emulation otherwise applications get rendered in
// the current window which wipes out visible output resulting in missing
// output when scrolling back with the mouse wheel (copy mode still works
// since that is screen itself scrolling).
"altscreen on",
// Remap the control key to C-s since C-a may be used in applications. C-s
// is chosen because it cannot actually be used because by default it will
// pause and C-q to resume will just kill the browser window. We may not
// want people using the control key anyway since it will not be obvious
// they are in screen and doing things like switching windows makes mouse
// wheel scroll wonky due to the terminal doing the scrolling rather than
// screen itself (but again copy mode will work just fine).
"escape ^Ss",
}
rpty.configFile = filepath.Join(os.TempDir(), "coder-screen", "config")
err = os.MkdirAll(filepath.Dir(rpty.configFile), 0o700)
if err != nil {
rpty.state.setState(StateDone, xerrors.Errorf("make screen config dir: %w", err))
return rpty
}
err = os.WriteFile(rpty.configFile, []byte(strings.Join(settings, "\n")), 0o600)
if err != nil {
rpty.state.setState(StateDone, xerrors.Errorf("create config file: %w", err))
return rpty
}
return rpty
}
// lifecycle manages the lifecycle of the reconnecting pty. If the context ends
// the reconnecting pty will be closed.
func (rpty *screenReconnectingPTY) lifecycle(ctx context.Context, logger slog.Logger) {
rpty.timer = time.AfterFunc(attachTimeout, func() {
rpty.Close(xerrors.New("reconnecting pty timeout"))
})
logger.Debug(ctx, "reconnecting pty ready")
rpty.state.setState(StateReady, nil)
state, reasonErr := rpty.state.waitForStateOrContext(ctx, StateClosing)
if state < StateClosing {
// If we have not closed yet then the context is what unblocked us (which
// means the agent is shutting down) so move into the closing phase.
rpty.Close(reasonErr)
}
rpty.timer.Stop()
// If the command errors that the session is already gone that is fine.
err := rpty.sendCommand(context.Background(), "quit", []string{"No screen session found"})
if err != nil {
logger.Error(ctx, "close screen session", slog.Error(err))
}
logger.Info(ctx, "closed reconnecting pty")
rpty.state.setState(StateDone, reasonErr)
}
func (rpty *screenReconnectingPTY) Attach(ctx context.Context, _ string, conn net.Conn, height, width uint16, logger slog.Logger) error {
logger.Info(ctx, "attach to reconnecting pty")
// This will kill the heartbeat once we hit EOF or an error.
ctx, cancel := context.WithCancel(ctx)
defer cancel()
state, err := rpty.state.waitForStateOrContext(ctx, StateReady)
if state != StateReady {
return err
}
go heartbeat(ctx, rpty.timer, rpty.timeout)
ptty, process, err := rpty.doAttach(ctx, conn, height, width, logger)
if err != nil {
if errors.Is(err, context.Canceled) {
// Likely the process was too short-lived and canceled the version command.
// TODO: Is it worth distinguishing between that and a cancel from the
// Attach() caller? Additionally, since this could also happen if
// the command was invalid, should we check the process's exit code?
return nil
}
return err
}
defer func() {
// Log only for debugging since the process might have already exited on its
// own.
err := ptty.Close()
if err != nil {
logger.Debug(ctx, "closed ptty with error", slog.Error(err))
}
err = process.Kill()
if err != nil {
logger.Debug(ctx, "killed process with error", slog.Error(err))
}
}()
// Pipe conn -> pty and block.
readConnLoop(ctx, conn, ptty, rpty.metrics, logger)
return nil
}
// doAttach spawns the screen client and starts the heartbeat. It exists
// separately only so we can defer the mutex unlock which is not possible in
// Attach since it blocks.
func (rpty *screenReconnectingPTY) doAttach(ctx context.Context, conn net.Conn, height, width uint16, logger slog.Logger) (pty.PTYCmd, pty.Process, error) {
// Ensure another attach does not come in and spawn a duplicate session.
rpty.mutex.Lock()
defer rpty.mutex.Unlock()
logger.Debug(ctx, "spawning screen client", slog.F("screen_id", rpty.id))
// Wrap the command with screen and tie it to the connection's context.
cmd := pty.CommandContext(ctx, "screen", append([]string{
// -S is for setting the session's name.
"-S", rpty.id,
// -U tells screen to use UTF-8 encoding.
// -x allows attaching to an already attached session.
// -RR reattaches to the daemon or creates the session daemon if missing.
// -q disables the "New screen..." message that appears for five seconds
// when creating a new session with -RR.
// -c is the flag for the config file.
"-UxRRqc", rpty.configFile,
rpty.command.Path,
// pty.Cmd duplicates Path as the first argument so remove it.
}, rpty.command.Args[1:]...)...)
cmd.Env = append(rpty.command.Env, "TERM=xterm-256color")
cmd.Dir = rpty.command.Dir
ptty, process, err := pty.Start(cmd, pty.WithPTYOption(
pty.WithSSHRequest(ssh.Pty{
Window: ssh.Window{
// Make sure to spawn at the right size because if we resize afterward it
// leaves confusing padding (screen will resize such that the screen
// contents are aligned to the bottom).
Height: int(height),
Width: int(width),
},
}),
))
if err != nil {
rpty.metrics.WithLabelValues("screen_spawn").Add(1)
return nil, nil, err
}
// This context lets us abort the version command if the process dies.
versionCtx, versionCancel := context.WithCancel(ctx)
defer versionCancel()
// Pipe pty -> conn and close the connection when the process exits.
// We do not need to separately monitor for the process exiting. When it
// exits, our ptty.OutputReader() will return EOF after reading all process
// output.
go func() {
defer versionCancel()
defer func() {
err := conn.Close()
if err != nil {
// Log only for debugging since the connection might have already closed
// on its own.
logger.Debug(ctx, "closed connection with error", slog.Error(err))
}
}()
buffer := make([]byte, 1024)
for {
read, err := ptty.OutputReader().Read(buffer)
if err != nil {
// When the PTY is closed, this is triggered.
// Error is typically a benign EOF, so only log for debugging.
if errors.Is(err, io.EOF) {
logger.Debug(ctx, "unable to read pty output; screen might have exited", slog.Error(err))
} else {
logger.Warn(ctx, "unable to read pty output; screen might have exited", slog.Error(err))
rpty.metrics.WithLabelValues("screen_output_reader").Add(1)
}
// The process might have died because the session itself died or it
// might have been separately killed and the session is still up (for
// example `exit` or we killed it when the connection closed). If the
// session is still up we might leave the reconnecting pty in memory
// around longer than it needs to be but it will eventually clean up
// with the timer or context, or the next attach will respawn the screen
// daemon which is fine too.
break
}
part := buffer[:read]
_, err = conn.Write(part)
if err != nil {
// Connection might have been closed.
if errors.Unwrap(err).Error() != "endpoint is closed for send" {
logger.Warn(ctx, "error writing to active conn", slog.Error(err))
rpty.metrics.WithLabelValues("screen_write").Add(1)
}
break
}
}
}()
// Version seems to be the only command without a side effect (other than
// making the version pop up briefly) so use it to wait for the session to
// come up. If we do not wait we could end up spawning multiple sessions with
// the same name.
err = rpty.sendCommand(versionCtx, "version", nil)
if err != nil {
// Log only for debugging since the process might already have closed.
closeErr := ptty.Close()
if closeErr != nil {
logger.Debug(ctx, "closed ptty with error", slog.Error(closeErr))
}
closeErr = process.Kill()
if closeErr != nil {
logger.Debug(ctx, "killed process with error", slog.Error(closeErr))
}
rpty.metrics.WithLabelValues("screen_wait").Add(1)
return nil, nil, err
}
return ptty, process, nil
}
// sendCommand runs a screen command against a running screen session. If the
// command fails with an error matching anything in successErrors it will be
// considered a success state (for example "no session" when quitting and the
// session is already dead). The command will be retried until successful, the
// timeout is reached, or the context ends. A canceled context will return the
// canceled context's error as-is while a timed-out context returns together
// with the last error from the command.
func (rpty *screenReconnectingPTY) sendCommand(ctx context.Context, command string, successErrors []string) error {
ctx, cancel := context.WithTimeout(ctx, attachTimeout)
defer cancel()
var lastErr error
run := func() bool {
var stdout bytes.Buffer
//nolint:gosec
cmd := exec.CommandContext(ctx, "screen",
// -x targets an attached session.
"-x", rpty.id,
// -c is the flag for the config file.
"-c", rpty.configFile,
// -X runs a command in the matching session.
"-X", command,
)
cmd.Env = append(rpty.command.Env, "TERM=xterm-256color")
cmd.Dir = rpty.command.Dir
cmd.Stdout = &stdout
err := cmd.Run()
if err == nil {
return true
}
stdoutStr := stdout.String()
for _, se := range successErrors {
if strings.Contains(stdoutStr, se) {
return true
}
}
// Things like "exit status 1" are imprecise so include stdout as it may
// contain more information ("no screen session found" for example).
if !errors.Is(err, context.Canceled) && !errors.Is(err, context.DeadlineExceeded) {
lastErr = xerrors.Errorf("`screen -x %s -X %s`: %w: %s", rpty.id, command, err, stdoutStr)
}
return false
}
// Run immediately.
if done := run(); done {
return nil
}
// Then run on an interval.
ticker := time.NewTicker(250 * time.Millisecond)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
if errors.Is(ctx.Err(), context.Canceled) {
return ctx.Err()
}
return errors.Join(ctx.Err(), lastErr)
case <-ticker.C:
if done := run(); done {
return nil
}
}
}
}
func (rpty *screenReconnectingPTY) Wait() {
_, _ = rpty.state.waitForState(StateClosing)
}
func (rpty *screenReconnectingPTY) Close(err error) {
// The closing state change will be handled by the lifecycle.
rpty.state.setState(StateClosing, err)
}
+126
View File
@@ -0,0 +1,126 @@
package agent
import (
"context"
"sync"
"time"
"golang.org/x/xerrors"
"tailscale.com/types/netlogtype"
"cdr.dev/slog"
"github.com/coder/coder/v2/agent/proto"
)
const maxConns = 2048
type networkStatsSource interface {
SetConnStatsCallback(maxPeriod time.Duration, maxConns int, dump func(start, end time.Time, virtual, physical map[netlogtype.Connection]netlogtype.Counts))
}
type statsCollector interface {
Collect(ctx context.Context, networkStats map[netlogtype.Connection]netlogtype.Counts) *proto.Stats
}
type statsDest interface {
UpdateStats(ctx context.Context, req *proto.UpdateStatsRequest) (*proto.UpdateStatsResponse, error)
}
// statsReporter is a subcomponent of the agent that handles registering the stats callback on the
// networkStatsSource (tailnet.Conn in prod), handling the callback, calling back to the
// statsCollector (agent in prod) to collect additional stats, then sending the update to the
// statsDest (agent API in prod)
type statsReporter struct {
*sync.Cond
networkStats *map[netlogtype.Connection]netlogtype.Counts
unreported bool
lastInterval time.Duration
source networkStatsSource
collector statsCollector
logger slog.Logger
}
func newStatsReporter(logger slog.Logger, source networkStatsSource, collector statsCollector) *statsReporter {
return &statsReporter{
Cond: sync.NewCond(&sync.Mutex{}),
logger: logger,
source: source,
collector: collector,
}
}
func (s *statsReporter) callback(_, _ time.Time, virtual, _ map[netlogtype.Connection]netlogtype.Counts) {
s.L.Lock()
defer s.L.Unlock()
s.logger.Debug(context.Background(), "got stats callback")
s.networkStats = &virtual
s.unreported = true
s.Broadcast()
}
// reportLoop programs the source (tailnet.Conn) to send it stats via the
// callback, then reports them to the dest.
//
// It's intended to be called within the larger retry loop that establishes a
// connection to the agent API, then passes that connection to go routines like
// this that use it. There is no retry and we fail on the first error since
// this will be inside a larger retry loop.
func (s *statsReporter) reportLoop(ctx context.Context, dest statsDest) error {
// send an initial, blank report to get the interval
resp, err := dest.UpdateStats(ctx, &proto.UpdateStatsRequest{})
if err != nil {
return xerrors.Errorf("initial update: %w", err)
}
s.lastInterval = resp.ReportInterval.AsDuration()
s.source.SetConnStatsCallback(s.lastInterval, maxConns, s.callback)
// use a separate goroutine to monitor the context so that we notice immediately, rather than
// waiting for the next callback (which might never come if we are closing!)
ctxDone := false
go func() {
<-ctx.Done()
s.L.Lock()
defer s.L.Unlock()
ctxDone = true
s.Broadcast()
}()
defer s.logger.Debug(ctx, "reportLoop exiting")
s.L.Lock()
defer s.L.Unlock()
for {
for !s.unreported && !ctxDone {
s.Wait()
}
if ctxDone {
return nil
}
networkStats := *s.networkStats
s.unreported = false
if err = s.reportLocked(ctx, dest, networkStats); err != nil {
return xerrors.Errorf("report stats: %w", err)
}
}
}
func (s *statsReporter) reportLocked(
ctx context.Context, dest statsDest, networkStats map[netlogtype.Connection]netlogtype.Counts,
) error {
// here we want to do our collecting/reporting while it is unlocked, but then relock
// when we return to reportLoop.
s.L.Unlock()
defer s.L.Lock()
stats := s.collector.Collect(ctx, networkStats)
resp, err := dest.UpdateStats(ctx, &proto.UpdateStatsRequest{Stats: stats})
if err != nil {
return err
}
interval := resp.GetReportInterval().AsDuration()
if interval != s.lastInterval {
s.logger.Info(ctx, "new stats report interval", slog.F("interval", interval))
s.lastInterval = interval
s.source.SetConnStatsCallback(s.lastInterval, maxConns, s.callback)
}
return nil
}
+212
View File
@@ -0,0 +1,212 @@
package agent
import (
"context"
"net/netip"
"sync"
"testing"
"time"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/durationpb"
"tailscale.com/types/ipproto"
"tailscale.com/types/netlogtype"
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/testutil"
)
func TestStatsReporter(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
fSource := newFakeNetworkStatsSource(ctx, t)
fCollector := newFakeCollector(t)
fDest := newFakeStatsDest()
uut := newStatsReporter(logger, fSource, fCollector)
loopErr := make(chan error, 1)
loopCtx, loopCancel := context.WithCancel(ctx)
go func() {
err := uut.reportLoop(loopCtx, fDest)
loopErr <- err
}()
// initial request to get duration
req := testutil.RequireRecvCtx(ctx, t, fDest.reqs)
require.NotNil(t, req)
require.Nil(t, req.Stats)
interval := time.Second * 34
testutil.RequireSendCtx(ctx, t, fDest.resps, &proto.UpdateStatsResponse{ReportInterval: durationpb.New(interval)})
// call to source to set the callback and interval
gotInterval := testutil.RequireRecvCtx(ctx, t, fSource.period)
require.Equal(t, interval, gotInterval)
// callback returning netstats
netStats := map[netlogtype.Connection]netlogtype.Counts{
{
Proto: ipproto.TCP,
Src: netip.MustParseAddrPort("192.168.1.33:4887"),
Dst: netip.MustParseAddrPort("192.168.2.99:9999"),
}: {
TxPackets: 22,
TxBytes: 23,
RxPackets: 24,
RxBytes: 25,
},
}
fSource.callback(time.Now(), time.Now(), netStats, nil)
// collector called to complete the stats
gotNetStats := testutil.RequireRecvCtx(ctx, t, fCollector.calls)
require.Equal(t, netStats, gotNetStats)
// while we are collecting the stats, send in two new netStats to simulate
// what happens if we don't keep up. Only the latest should be kept.
netStats0 := map[netlogtype.Connection]netlogtype.Counts{
{
Proto: ipproto.TCP,
Src: netip.MustParseAddrPort("192.168.1.33:4887"),
Dst: netip.MustParseAddrPort("192.168.2.99:9999"),
}: {
TxPackets: 10,
TxBytes: 10,
RxPackets: 10,
RxBytes: 10,
},
}
fSource.callback(time.Now(), time.Now(), netStats0, nil)
netStats1 := map[netlogtype.Connection]netlogtype.Counts{
{
Proto: ipproto.TCP,
Src: netip.MustParseAddrPort("192.168.1.33:4887"),
Dst: netip.MustParseAddrPort("192.168.2.99:9999"),
}: {
TxPackets: 11,
TxBytes: 11,
RxPackets: 11,
RxBytes: 11,
},
}
fSource.callback(time.Now(), time.Now(), netStats1, nil)
// complete first collection
stats := &proto.Stats{SessionCountJetbrains: 55}
testutil.RequireSendCtx(ctx, t, fCollector.stats, stats)
// destination called to report the first stats
update := testutil.RequireRecvCtx(ctx, t, fDest.reqs)
require.NotNil(t, update)
require.Equal(t, stats, update.Stats)
testutil.RequireSendCtx(ctx, t, fDest.resps, &proto.UpdateStatsResponse{ReportInterval: durationpb.New(interval)})
// second update -- only netStats1 is reported
gotNetStats = testutil.RequireRecvCtx(ctx, t, fCollector.calls)
require.Equal(t, netStats1, gotNetStats)
stats = &proto.Stats{SessionCountJetbrains: 66}
testutil.RequireSendCtx(ctx, t, fCollector.stats, stats)
update = testutil.RequireRecvCtx(ctx, t, fDest.reqs)
require.NotNil(t, update)
require.Equal(t, stats, update.Stats)
interval2 := 27 * time.Second
testutil.RequireSendCtx(ctx, t, fDest.resps, &proto.UpdateStatsResponse{ReportInterval: durationpb.New(interval2)})
// set the new interval
gotInterval = testutil.RequireRecvCtx(ctx, t, fSource.period)
require.Equal(t, interval2, gotInterval)
loopCancel()
err := testutil.RequireRecvCtx(ctx, t, loopErr)
require.NoError(t, err)
}
type fakeNetworkStatsSource struct {
sync.Mutex
ctx context.Context
t testing.TB
callback func(start, end time.Time, virtual, physical map[netlogtype.Connection]netlogtype.Counts)
period chan time.Duration
}
func (f *fakeNetworkStatsSource) SetConnStatsCallback(maxPeriod time.Duration, _ int, dump func(start time.Time, end time.Time, virtual map[netlogtype.Connection]netlogtype.Counts, physical map[netlogtype.Connection]netlogtype.Counts)) {
f.Lock()
defer f.Unlock()
f.callback = dump
select {
case <-f.ctx.Done():
f.t.Error("timeout")
case f.period <- maxPeriod:
// OK
}
}
func newFakeNetworkStatsSource(ctx context.Context, t testing.TB) *fakeNetworkStatsSource {
f := &fakeNetworkStatsSource{
ctx: ctx,
t: t,
period: make(chan time.Duration),
}
return f
}
type fakeCollector struct {
t testing.TB
calls chan map[netlogtype.Connection]netlogtype.Counts
stats chan *proto.Stats
}
func (f *fakeCollector) Collect(ctx context.Context, networkStats map[netlogtype.Connection]netlogtype.Counts) *proto.Stats {
select {
case <-ctx.Done():
f.t.Error("timeout on collect")
return nil
case f.calls <- networkStats:
// ok
}
select {
case <-ctx.Done():
f.t.Error("timeout on collect")
return nil
case s := <-f.stats:
return s
}
}
func newFakeCollector(t testing.TB) *fakeCollector {
return &fakeCollector{
t: t,
calls: make(chan map[netlogtype.Connection]netlogtype.Counts),
stats: make(chan *proto.Stats),
}
}
type fakeStatsDest struct {
reqs chan *proto.UpdateStatsRequest
resps chan *proto.UpdateStatsResponse
}
func (f *fakeStatsDest) UpdateStats(ctx context.Context, req *proto.UpdateStatsRequest) (*proto.UpdateStatsResponse, error) {
select {
case <-ctx.Done():
return nil, ctx.Err()
case f.reqs <- req:
// OK
}
select {
case <-ctx.Done():
return nil, ctx.Err()
case resp := <-f.resps:
return resp, nil
}
}
func newFakeStatsDest() *fakeStatsDest {
return &fakeStatsDest{
reqs: make(chan *proto.UpdateStatsRequest),
resps: make(chan *proto.UpdateStatsResponse),
}
}
+24 -3
View File
@@ -1,8 +1,29 @@
package usershell
import "os"
import (
"os"
"os/exec"
"path/filepath"
"strings"
"golang.org/x/xerrors"
)
// Get returns the $SHELL environment variable.
func Get(_ string) (string, error) {
return os.Getenv("SHELL"), nil
func Get(username string) (string, error) {
// This command will output "UserShell: /bin/zsh" if successful, we
// can ignore the error since we have fallback behavior.
if !filepath.IsLocal(username) {
return "", xerrors.Errorf("username is nonlocal path: %s", username)
}
//nolint: gosec // input checked above
out, _ := exec.Command("dscl", ".", "-read", filepath.Join("/Users", username), "UserShell").Output()
s, ok := strings.CutPrefix(string(out), "UserShell: ")
if ok {
return strings.TrimSpace(s), nil
}
if s = os.Getenv("SHELL"); s != "" {
return s, nil
}
return "", xerrors.Errorf("shell for user %q not found via dscl or in $SHELL", username)
}
+4 -1
View File
@@ -27,5 +27,8 @@ func Get(username string) (string, error) {
}
return parts[6], nil
}
return "", xerrors.Errorf("user %q not found in /etc/passwd", username)
if s := os.Getenv("SHELL"); s != "" {
return s, nil
}
return "", xerrors.Errorf("shell for user %q not found in /etc/passwd or $SHELL", username)
}
-27
View File
@@ -1,27 +0,0 @@
//go:build !windows && !darwin
// +build !windows,!darwin
package usershell_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/coder/coder/agent/usershell"
)
func TestGet(t *testing.T) {
t.Parallel()
t.Run("Has", func(t *testing.T) {
t.Parallel()
shell, err := usershell.Get("root")
require.NoError(t, err)
require.NotEmpty(t, shell)
})
t.Run("NotFound", func(t *testing.T) {
t.Parallel()
_, err := usershell.Get("notauser")
require.Error(t, err)
})
}
+46
View File
@@ -0,0 +1,46 @@
package usershell_test
import (
"os/user"
"runtime"
"testing"
"github.com/stretchr/testify/require"
"github.com/coder/coder/v2/agent/usershell"
)
//nolint:paralleltest,tparallel // This test sets an environment variable.
func TestGet(t *testing.T) {
if runtime.GOOS == "windows" {
t.SkipNow()
}
t.Run("Fallback", func(t *testing.T) {
t.Setenv("SHELL", "/bin/sh")
t.Run("NonExistentUser", func(t *testing.T) {
shell, err := usershell.Get("notauser")
require.NoError(t, err)
require.Equal(t, "/bin/sh", shell)
})
})
t.Run("NoFallback", func(t *testing.T) {
// Disable env fallback for these tests.
t.Setenv("SHELL", "")
t.Run("NotFound", func(t *testing.T) {
_, err := usershell.Get("notauser")
require.Error(t, err)
})
t.Run("User", func(t *testing.T) {
u, err := user.Current()
require.NoError(t, err)
shell, err := usershell.Get(u.Username)
require.NoError(t, err)
require.NotEmpty(t, shell)
})
})
}
+7
View File
@@ -0,0 +1,7 @@
//go:build boringcrypto
package buildinfo
import "crypto/boring"
var boringcrypto = boring.Enabled()
+24 -7
View File
@@ -30,8 +30,15 @@ var (
)
const (
// develPrefix is prefixed to developer versions of the application.
develPrefix = "v0.0.0-devel"
// noVersion is the reported version when the version cannot be determined.
// Usually because `go build` is run instead of `make build`.
noVersion = "v0.0.0"
// develPreRelease is the pre-release tag for developer versions of the
// application. This includes CI builds. The pre-release tag should be appended
// to the version with a "-".
// Example: v0.0.0-devel
develPreRelease = "devel"
)
// Version returns the semantic version of the build.
@@ -45,7 +52,8 @@ func Version() string {
if tag == "" {
// This occurs when the tag hasn't been injected,
// like when using "go run".
version = develPrefix + revision
// <version>-<pre-release>+<revision>
version = fmt.Sprintf("%s-%s%s", noVersion, develPreRelease, revision)
return
}
version = "v" + tag
@@ -63,18 +71,23 @@ func Version() string {
// disregarded. If it detects that either version is a developer build it
// returns true.
func VersionsMatch(v1, v2 string) bool {
// Developer versions are disregarded...hopefully they know what they are
// doing.
if strings.HasPrefix(v1, develPrefix) || strings.HasPrefix(v2, develPrefix) {
// If no version is attached, then it is a dev build outside of CI. The version
// will be disregarded... hopefully they know what they are doing.
if strings.Contains(v1, noVersion) || strings.Contains(v2, noVersion) {
return true
}
return semver.MajorMinor(v1) == semver.MajorMinor(v2)
}
func IsDevVersion(v string) bool {
return strings.Contains(v, "-"+develPreRelease)
}
// IsDev returns true if this is a development build.
// CI builds are also considered development builds.
func IsDev() bool {
return strings.HasPrefix(Version(), develPrefix)
return IsDevVersion(Version())
}
// IsSlim returns true if this is a slim build.
@@ -87,6 +100,10 @@ func IsAGPL() bool {
return strings.Contains(agpl, "t")
}
func IsBoringCrypto() bool {
return boringcrypto
}
// ExternalURL returns a URL referencing the current Coder version.
// For production builds, this will link directly to a release.
// For development builds, this will link to a commit.
+9 -3
View File
@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/mod/semver"
"github.com/coder/coder/buildinfo"
"github.com/coder/coder/v2/buildinfo"
)
func TestBuildInfo(t *testing.T) {
@@ -57,13 +57,19 @@ func TestBuildInfo(t *testing.T) {
expectMatch: true,
},
// Our CI instance uses a "-devel" prerelease
// flag. This is not the same as a developer WIP build.
// flag.
{
name: "DevelPreleaseNotIgnored",
name: "DevelPreleaseMajor",
v1: "v1.1.1-devel+123abac",
v2: "v1.2.3",
expectMatch: false,
},
{
name: "DevelPreleaseSame",
v1: "v1.1.1-devel+123abac",
v2: "v1.1.9",
expectMatch: true,
},
{
name: "MajorMismatch",
v1: "v1.2.3",
+5
View File
@@ -0,0 +1,5 @@
//go:build !boringcrypto
package buildinfo
var boringcrypto = false
+66 -36
View File
@@ -8,10 +8,10 @@ import (
"net/http/pprof"
"net/url"
"os"
"os/signal"
"path/filepath"
"runtime"
"strconv"
"strings"
"sync"
"time"
@@ -27,12 +27,13 @@ import (
"cdr.dev/slog/sloggers/sloghuman"
"cdr.dev/slog/sloggers/slogjson"
"cdr.dev/slog/sloggers/slogstackdriver"
"github.com/coder/coder/agent"
"github.com/coder/coder/agent/reaper"
"github.com/coder/coder/buildinfo"
"github.com/coder/coder/cli/clibase"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/codersdk/agentsdk"
"github.com/coder/coder/v2/agent"
"github.com/coder/coder/v2/agent/agentproc"
"github.com/coder/coder/v2/agent/reaper"
"github.com/coder/coder/v2/buildinfo"
"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
)
func (r *RootCmd) workspaceAgent() *clibase.Cmd {
@@ -106,16 +107,16 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
// Spawn a reaper so that we don't accumulate a ton
// of zombie processes.
if reaper.IsInitProcess() && !noReap && isLinux {
logWriter := &lumberjack.Logger{
logWriter := &lumberjackWriteCloseFixer{w: &lumberjack.Logger{
Filename: filepath.Join(logDir, "coder-agent-init.log"),
MaxSize: 5, // MB
// Without this, rotated logs will never be deleted.
MaxBackups: 1,
}
}}
defer logWriter.Close()
sinks = append(sinks, sloghuman.Sink(logWriter))
logger := slog.Make(sinks...).Leveled(slog.LevelDebug)
logger := inv.Logger.AppendSinks(sinks...).Leveled(slog.LevelDebug)
logger.Info(ctx, "spawning reaper process")
// Do not start a reaper on the child process. It's important
@@ -126,7 +127,7 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
reaper.WithCatchSignals(InterruptSignals...),
)
if err != nil {
logger.Error(ctx, "failed to reap", slog.Error(err))
logger.Error(ctx, "agent process reaper unable to fork", slog.Error(err))
return xerrors.Errorf("fork reap: %w", err)
}
@@ -142,34 +143,33 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
// Note that we don't want to handle these signals in the
// process that runs as PID 1, that's why we do this after
// the reaper forked.
ctx, stopNotify := signal.NotifyContext(ctx, InterruptSignals...)
ctx, stopNotify := inv.SignalNotifyContext(ctx, InterruptSignals...)
defer stopNotify()
// DumpHandler does signal handling, so we call it after the
// reaper.
go DumpHandler(ctx)
ljLogger := &lumberjack.Logger{
logWriter := &lumberjackWriteCloseFixer{w: &lumberjack.Logger{
Filename: filepath.Join(logDir, "coder-agent.log"),
MaxSize: 5, // MB
// Without this, rotated logs will never be deleted.
MaxBackups: 1,
}
defer ljLogger.Close()
logWriter := &closeWriter{w: ljLogger}
// Per customer incident on November 17th, 2023, its helpful
// to have the log of the last few restarts to debug a failing agent.
MaxBackups: 10,
}}
defer logWriter.Close()
sinks = append(sinks, sloghuman.Sink(logWriter))
logger := slog.Make(sinks...).Leveled(slog.LevelDebug)
logger := inv.Logger.AppendSinks(sinks...).Leveled(slog.LevelDebug)
version := buildinfo.Version()
logger.Info(ctx, "starting agent",
logger.Info(ctx, "agent is starting now",
slog.F("url", r.agentURL),
slog.F("auth", auth),
slog.F("version", version),
)
client := agentsdk.New(r.agentURL)
client.SDK.Logger = logger
client.SDK.SetLogger(logger)
// Set a reasonable timeout so requests can't hang forever!
// The timeout needs to be reasonably long, because requests
// with large payloads can take a bit. e.g. startup scripts
@@ -199,9 +199,19 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
var exchangeToken func(context.Context) (agentsdk.AuthenticateResponse, error)
switch auth {
case "token":
token, err := inv.ParsedFlags().GetString(varAgentToken)
if err != nil {
return xerrors.Errorf("CODER_AGENT_TOKEN must be set for token auth: %w", err)
token, _ := inv.ParsedFlags().GetString(varAgentToken)
if token == "" {
tokenFile, _ := inv.ParsedFlags().GetString(varAgentTokenFile)
if tokenFile != "" {
tokenBytes, err := os.ReadFile(tokenFile)
if err != nil {
return xerrors.Errorf("read token file %q: %w", tokenFile, err)
}
token = strings.TrimSpace(string(tokenBytes))
}
}
if token == "" {
return xerrors.Errorf("CODER_AGENT_TOKEN or CODER_AGENT_TOKEN_FILE must be set for token auth")
}
client.SetSessionToken(token)
case "google-instance-identity":
@@ -255,7 +265,21 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
}
prometheusRegistry := prometheus.NewRegistry()
subsystem := inv.Environ.Get(agent.EnvAgentSubsystem)
subsystemsRaw := inv.Environ.Get(agent.EnvAgentSubsystem)
subsystems := []codersdk.AgentSubsystem{}
for _, s := range strings.Split(subsystemsRaw, ",") {
subsystem := codersdk.AgentSubsystem(strings.TrimSpace(s))
if subsystem == "" {
continue
}
if !subsystem.Valid() {
return xerrors.Errorf("invalid subsystem %q", subsystem)
}
subsystems = append(subsystems, subsystem)
}
procTicker := time.NewTicker(time.Second)
defer procTicker.Stop()
agnt := agent.New(agent.Options{
Client: client,
Logger: logger,
@@ -273,13 +297,18 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
return resp.SessionToken, nil
},
EnvironmentVariables: map[string]string{
"GIT_ASKPASS": executablePath,
"GIT_ASKPASS": executablePath,
agent.EnvProcPrioMgmt: os.Getenv(agent.EnvProcPrioMgmt),
},
IgnorePorts: ignorePorts,
SSHMaxTimeout: sshMaxTimeout,
Subsystem: codersdk.AgentSubsystem(subsystem),
Subsystems: subsystems,
PrometheusRegistry: prometheusRegistry,
Syscaller: agentproc.NewSyscaller(),
// Intentionally set this to nil. It's mainly used
// for testing.
ModifiedProcesses: nil,
})
prometheusSrvClose := ServeHandler(ctx, logger, prometheusMetricsHandler(prometheusRegistry, logger), prometheusAddress, "prometheus")
@@ -323,10 +352,11 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
Value: clibase.BoolOf(&noReap),
},
{
Flag: "ssh-max-timeout",
Default: "0",
Flag: "ssh-max-timeout",
// tcpip.KeepaliveIdleOption = 72h + 1min (forwardTCPSockOpts() in tailnet/conn.go)
Default: "72h",
Env: "CODER_AGENT_SSH_MAX_TIMEOUT",
Description: "Specify the max timeout for a SSH connection.",
Description: "Specify the max timeout for a SSH connection, it is advisable to set it to a minimum of 60s, but no more than 72h.",
Value: clibase.DurationOf(&sshMaxTimeout),
},
{
@@ -402,16 +432,16 @@ func ServeHandler(ctx context.Context, logger slog.Logger, handler http.Handler,
}
}
// closeWriter is a wrapper around an io.WriteCloser that prevents
// writes after Close. This is necessary because lumberjack will
// re-open the file on write.
type closeWriter struct {
// lumberjackWriteCloseFixer is a wrapper around an io.WriteCloser that
// prevents writes after Close. This is necessary because lumberjack
// re-opens the file on Write.
type lumberjackWriteCloseFixer struct {
w io.WriteCloser
mu sync.Mutex // Protects following.
closed bool
}
func (c *closeWriter) Close() error {
func (c *lumberjackWriteCloseFixer) Close() error {
c.mu.Lock()
defer c.mu.Unlock()
@@ -419,7 +449,7 @@ func (c *closeWriter) Close() error {
return c.w.Close()
}
func (c *closeWriter) Write(p []byte) (int, error) {
func (c *lumberjackWriteCloseFixer) Write(p []byte) (int, error) {
c.mu.Lock()
defer c.mu.Unlock()
+109 -134
View File
@@ -2,6 +2,7 @@ package cli_test
import (
"context"
"fmt"
"os"
"path/filepath"
"runtime"
@@ -12,13 +13,14 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/coder/coder/agent"
"github.com/coder/coder/cli/clitest"
"github.com/coder/coder/coderd/coderdtest"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/provisioner/echo"
"github.com/coder/coder/provisionersdk/proto"
"github.com/coder/coder/pty/ptytest"
"github.com/coder/coder/v2/agent"
"github.com/coder/coder/v2/cli/clitest"
"github.com/coder/coder/v2/coderd/coderdtest"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/dbfake"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/provisionersdk/proto"
"github.com/coder/coder/v2/testutil"
)
func TestWorkspaceAgent(t *testing.T) {
@@ -27,83 +29,63 @@ func TestWorkspaceAgent(t *testing.T) {
t.Run("LogDirectory", func(t *testing.T) {
t.Parallel()
authToken := uuid.NewString()
client := coderdtest.New(t, &coderdtest.Options{
IncludeProvisionerDaemon: true,
})
client, db := coderdtest.NewWithDatabase(t, nil)
user := coderdtest.CreateFirstUser(t, client)
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
Parse: echo.ParseComplete,
ProvisionApply: echo.ProvisionApplyWithAgent(authToken),
})
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
coderdtest.AwaitTemplateVersionJob(t, client, version.ID)
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
OrganizationID: user.OrganizationID,
OwnerID: user.UserID,
}).
WithAgent().
Do()
logDir := t.TempDir()
inv, _ := clitest.New(t,
"agent",
"--auth", "token",
"--agent-token", authToken,
"--agent-token", r.AgentToken,
"--agent-url", client.URL.String(),
"--log-dir", logDir,
)
pty := ptytest.New(t).Attach(inv)
clitest.Start(t, inv)
ctx := inv.Context()
pty.ExpectMatchContext(ctx, "starting agent")
coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
coderdtest.AwaitWorkspaceAgents(t, client, r.Workspace.ID)
info, err := os.Stat(filepath.Join(logDir, "coder-agent.log"))
require.NoError(t, err)
require.Greater(t, info.Size(), int64(0))
require.Eventually(t, func() bool {
info, err := os.Stat(filepath.Join(logDir, "coder-agent.log"))
if err != nil {
return false
}
return info.Size() > 0
}, testutil.WaitLong, testutil.IntervalMedium)
})
t.Run("Azure", func(t *testing.T) {
t.Parallel()
instanceID := "instanceidentifier"
certificates, metadataClient := coderdtest.NewAzureInstanceIdentity(t, instanceID)
client := coderdtest.New(t, &coderdtest.Options{
AzureCertificates: certificates,
IncludeProvisionerDaemon: true,
client, db := coderdtest.NewWithDatabase(t, &coderdtest.Options{
AzureCertificates: certificates,
})
user := coderdtest.CreateFirstUser(t, client)
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
Parse: echo.ParseComplete,
ProvisionApply: []*proto.Provision_Response{{
Type: &proto.Provision_Response_Complete{
Complete: &proto.Provision_Complete{
Resources: []*proto.Resource{{
Name: "somename",
Type: "someinstance",
Agents: []*proto.Agent{{
Auth: &proto.Agent_InstanceId{
InstanceId: instanceID,
},
}},
}},
},
},
}},
})
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
coderdtest.AwaitTemplateVersionJob(t, client, version.ID)
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
OrganizationID: user.OrganizationID,
OwnerID: user.UserID,
}).WithAgent(func(agents []*proto.Agent) []*proto.Agent {
agents[0].Auth = &proto.Agent_InstanceId{InstanceId: instanceID}
return agents
}).Do()
inv, _ := clitest.New(t, "agent", "--auth", "azure-instance-identity", "--agent-url", client.URL.String())
inv = inv.WithContext(
//nolint:revive,staticcheck
context.WithValue(inv.Context(), "azure-client", metadataClient),
)
ctx := inv.Context()
clitest.Start(t, inv)
coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
workspace, err := client.Workspace(ctx, workspace.ID)
coderdtest.NewWorkspaceAgentWaiter(t, client, r.Workspace.ID).
MatchResources(matchAgentWithVersion).Wait()
workspace, err := client.Workspace(ctx, r.Workspace.ID)
require.NoError(t, err)
resources := workspace.LatestBuild.Resources
if assert.NotEmpty(t, workspace.LatestBuild.Resources) && assert.NotEmpty(t, resources[0].Agents) {
@@ -119,43 +101,30 @@ func TestWorkspaceAgent(t *testing.T) {
t.Parallel()
instanceID := "instanceidentifier"
certificates, metadataClient := coderdtest.NewAWSInstanceIdentity(t, instanceID)
client := coderdtest.New(t, &coderdtest.Options{
AWSCertificates: certificates,
IncludeProvisionerDaemon: true,
client, db := coderdtest.NewWithDatabase(t, &coderdtest.Options{
AWSCertificates: certificates,
})
user := coderdtest.CreateFirstUser(t, client)
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
Parse: echo.ParseComplete,
ProvisionApply: []*proto.Provision_Response{{
Type: &proto.Provision_Response_Complete{
Complete: &proto.Provision_Complete{
Resources: []*proto.Resource{{
Name: "somename",
Type: "someinstance",
Agents: []*proto.Agent{{
Auth: &proto.Agent_InstanceId{
InstanceId: instanceID,
},
}},
}},
},
},
}},
})
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
coderdtest.AwaitTemplateVersionJob(t, client, version.ID)
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
OrganizationID: user.OrganizationID,
OwnerID: user.UserID,
}).WithAgent(func(agents []*proto.Agent) []*proto.Agent {
agents[0].Auth = &proto.Agent_InstanceId{InstanceId: instanceID}
return agents
}).Do()
inv, _ := clitest.New(t, "agent", "--auth", "aws-instance-identity", "--agent-url", client.URL.String())
inv = inv.WithContext(
//nolint:revive,staticcheck
context.WithValue(inv.Context(), "aws-client", metadataClient),
)
clitest.Start(t, inv)
ctx := inv.Context()
coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
workspace, err := client.Workspace(ctx, workspace.ID)
coderdtest.NewWorkspaceAgentWaiter(t, client, r.Workspace.ID).
MatchResources(matchAgentWithVersion).
Wait()
workspace, err := client.Workspace(ctx, r.Workspace.ID)
require.NoError(t, err)
resources := workspace.LatestBuild.Resources
if assert.NotEmpty(t, resources) && assert.NotEmpty(t, resources[0].Agents) {
@@ -171,37 +140,22 @@ func TestWorkspaceAgent(t *testing.T) {
t.Parallel()
instanceID := "instanceidentifier"
validator, metadataClient := coderdtest.NewGoogleInstanceIdentity(t, instanceID, false)
client := coderdtest.New(t, &coderdtest.Options{
GoogleTokenValidator: validator,
IncludeProvisionerDaemon: true,
client, db := coderdtest.NewWithDatabase(t, &coderdtest.Options{
GoogleTokenValidator: validator,
})
user := coderdtest.CreateFirstUser(t, client)
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
Parse: echo.ParseComplete,
ProvisionApply: []*proto.Provision_Response{{
Type: &proto.Provision_Response_Complete{
Complete: &proto.Provision_Complete{
Resources: []*proto.Resource{{
Name: "somename",
Type: "someinstance",
Agents: []*proto.Agent{{
Auth: &proto.Agent_InstanceId{
InstanceId: instanceID,
},
}},
}},
},
},
}},
})
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
coderdtest.AwaitTemplateVersionJob(t, client, version.ID)
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
owner := coderdtest.CreateFirstUser(t, client)
member, memberUser := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
OrganizationID: owner.OrganizationID,
OwnerID: memberUser.ID,
}).WithAgent(func(agents []*proto.Agent) []*proto.Agent {
agents[0].Auth = &proto.Agent_InstanceId{InstanceId: instanceID}
return agents
}).Do()
inv, cfg := clitest.New(t, "agent", "--auth", "google-instance-identity", "--agent-url", client.URL.String())
ptytest.New(t).Attach(inv)
clitest.SetupConfig(t, client, cfg)
clitest.SetupConfig(t, member, cfg)
clitest.Start(t,
inv.WithContext(
//nolint:revive,staticcheck
@@ -210,9 +164,10 @@ func TestWorkspaceAgent(t *testing.T) {
)
ctx := inv.Context()
coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
workspace, err := client.Workspace(ctx, workspace.ID)
coderdtest.NewWorkspaceAgentWaiter(t, client, r.Workspace.ID).
MatchResources(matchAgentWithVersion).
Wait()
workspace, err := client.Workspace(ctx, r.Workspace.ID)
require.NoError(t, err)
resources := workspace.LatestBuild.Resources
if assert.NotEmpty(t, resources) && assert.NotEmpty(t, resources[0].Agents) {
@@ -242,39 +197,59 @@ func TestWorkspaceAgent(t *testing.T) {
t.Run("PostStartup", func(t *testing.T) {
t.Parallel()
authToken := uuid.NewString()
client := coderdtest.New(t, &coderdtest.Options{
IncludeProvisionerDaemon: true,
})
client, db := coderdtest.NewWithDatabase(t, nil)
user := coderdtest.CreateFirstUser(t, client)
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
Parse: echo.ParseComplete,
ProvisionApply: echo.ProvisionApplyWithAgent(authToken),
})
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
coderdtest.AwaitTemplateVersionJob(t, client, version.ID)
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
OrganizationID: user.OrganizationID,
OwnerID: user.UserID,
}).WithAgent().Do()
logDir := t.TempDir()
inv, _ := clitest.New(t,
"agent",
"--auth", "token",
"--agent-token", authToken,
"--agent-token", r.AgentToken,
"--agent-url", client.URL.String(),
"--log-dir", logDir,
)
// Set the subsystem for the agent.
inv.Environ.Set(agent.EnvAgentSubsystem, string(codersdk.AgentSubsystemEnvbox))
pty := ptytest.New(t).Attach(inv)
// Set the subsystems for the agent.
inv.Environ.Set(agent.EnvAgentSubsystem, fmt.Sprintf("%s,%s", codersdk.AgentSubsystemExectrace, codersdk.AgentSubsystemEnvbox))
clitest.Start(t, inv)
pty.ExpectMatchContext(inv.Context(), "starting agent")
resources := coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
resources := coderdtest.NewWorkspaceAgentWaiter(t, client, r.Workspace.ID).
MatchResources(matchAgentWithSubsystems).Wait()
require.Len(t, resources, 1)
require.Len(t, resources[0].Agents, 1)
require.Equal(t, codersdk.AgentSubsystemEnvbox, resources[0].Agents[0].Subsystem)
require.Len(t, resources[0].Agents[0].Subsystems, 2)
// Sorted
require.Equal(t, codersdk.AgentSubsystemEnvbox, resources[0].Agents[0].Subsystems[0])
require.Equal(t, codersdk.AgentSubsystemExectrace, resources[0].Agents[0].Subsystems[1])
})
}
func matchAgentWithVersion(rs []codersdk.WorkspaceResource) bool {
if len(rs) < 1 {
return false
}
if len(rs[0].Agents) < 1 {
return false
}
if rs[0].Agents[0].Version == "" {
return false
}
return true
}
func matchAgentWithSubsystems(rs []codersdk.WorkspaceResource) bool {
if len(rs) < 1 {
return false
}
if len(rs[0].Agents) < 1 {
return false
}
if len(rs[0].Agents[0].Subsystems) < 1 {
return false
}
return true
}
+58
View File
@@ -0,0 +1,58 @@
package cli
import (
"fmt"
"strings"
"golang.org/x/xerrors"
"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/cli/cliui"
"github.com/coder/coder/v2/codersdk"
)
func (r *RootCmd) autoupdate() *clibase.Cmd {
client := new(codersdk.Client)
cmd := &clibase.Cmd{
Annotations: workspaceCommand,
Use: "autoupdate <workspace> <always|never>",
Short: "Toggle auto-update policy for a workspace",
Middleware: clibase.Chain(
clibase.RequireNArgs(2),
r.InitClient(client),
),
Handler: func(inv *clibase.Invocation) error {
policy := strings.ToLower(inv.Args[1])
err := validateAutoUpdatePolicy(policy)
if err != nil {
return xerrors.Errorf("validate policy: %w", err)
}
workspace, err := namedWorkspace(inv.Context(), client, inv.Args[0])
if err != nil {
return xerrors.Errorf("get workspace: %w", err)
}
err = client.UpdateWorkspaceAutomaticUpdates(inv.Context(), workspace.ID, codersdk.UpdateWorkspaceAutomaticUpdatesRequest{
AutomaticUpdates: codersdk.AutomaticUpdates(policy),
})
if err != nil {
return xerrors.Errorf("update workspace automatic updates policy: %w", err)
}
_, _ = fmt.Fprintf(inv.Stdout, "Updated workspace %q auto-update policy to %q\n", workspace.Name, policy)
return nil
},
}
cmd.Options = append(cmd.Options, cliui.SkipPromptOption())
return cmd
}
func validateAutoUpdatePolicy(arg string) error {
switch codersdk.AutomaticUpdates(arg) {
case codersdk.AutomaticUpdatesAlways, codersdk.AutomaticUpdatesNever:
return nil
default:
return xerrors.Errorf("invalid option %q must be either of %q or %q", arg, codersdk.AutomaticUpdatesAlways, codersdk.AutomaticUpdatesNever)
}
}

Some files were not shown because too many files have changed in this diff Show More