Commit Graph

2385 Commits

Author SHA1 Message Date
6e54bd9183 test(coderd/notifications): fix data race in tests and smpttest (#15304) 2024-10-31 15:48:49 +02:00
591cefa428 fix(coderd/provisionerdserver): prevent NPE if no user link exists (#15289) 2024-10-30 19:16:59 +00:00
3de98c25db feat: add prometheus metric for tracking user statuses (#15281) 2024-10-30 18:41:16 +00:00
144d3f3e3d chore: record lifecycle duration metric to prometheus (#15279)
`autobuild_execution_duration_seconds` keeps track of how long autobuild
takes and exposes it via prometheus histogram
2024-10-30 10:20:47 -04:00
823a2ea22e chore(cli): drop 'notification' prefix for configuring email auth (#15270)
Closes https://github.com/coder/coder/issues/14644
2024-10-30 10:06:10 +00:00
d83f4eb076 fix: stop activity bump if no tracked sessions (#15237)
Part of https://github.com/coder/coder/issues/15176

I originally kept this the same because I wanted to be conservative
about when we start dropping activity, but this is proving to be a
problem when using `coder ssh` with `--usage-app=disabled`. Because the
workspace agent still counts this as a connection (I think it still
should so it's counted somewhere) but not as a SSH / IDE session. This
leads to background ssh tasks that want to be untracked still continuing
to bump activity when it shouldn't. This makes it so we have to have an
explicit session to bump activity.
2024-10-29 18:08:24 +00:00
7982ad7659 feat: expose premium trial form via CLI (#15054)
This PR closes https://github.com/coder/coder/issues/14856
2024-10-29 13:02:20 +00:00
78ff375fed feat: log when attempted password resets fail (#15267)
Closes https://github.com/coder/coder/issues/15154

Log when someone attempts to either
- Request a one-time passcode for an account that doesn't exist
- Attempt to change a password with an invalid one-time passcode and/or
email

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-10-29 12:19:56 +00:00
4e20eea9e6 chore: remove unused 'must_reset_password' column (#15265)
Closes https://github.com/coder/internal/issues/153

Remove the 'must_reset_password' as it was introduced for use in the
"forgot password?" flow but never used.
2024-10-29 09:57:40 +00:00
fb4219f57d fix: parse int to correct bit size (#15257) 2024-10-28 20:31:01 +00:00
7cb20d7b26 chore: name unlabeled db transaction metrics (#15251) 2024-10-28 13:15:29 -04:00
95a348ecc7 fix(coderd): improve use case handling in notifier for appearance fetchers (#15242)
Fixing #15241 & add tests.
2024-10-28 16:53:20 +01:00
9308331d9a chore: change promtheus label to 'tx_id' (#15238)
the 'id' label was not coming through. Maybe it's reserved? Or used in
the chain somewhere.
2024-10-25 18:50:42 -04:00
e03ef62a13 chore: add scim service provider config endpoint (#15235)
Adds a static `/scim/v2/ServiceProviderConfig` endpoint. Our scim
support is static, so the response config is also defined statically.
2024-10-25 18:27:34 -04:00
27f5ff2dd1 chore: correctly document SCIM authentication (#15234) 2024-10-25 12:40:13 -05:00
0dd942e197 fix: stop incrementing activity on empty agent stats (#15204) 2024-10-25 16:49:44 +00:00
cd890aa3a0 feat: enable key rotation (#15066)
This PR contains the remaining logic necessary to hook up key rotation
to the product.
2024-10-25 17:14:35 +01:00
ccfffc6911 chore: add tx metrics and logs for serialization errors (#15215)
Before db_metrics were all or nothing. Now `InTx` metrics are always recorded, and query metrics are opt in.


Adds instrumentation & logging around serialization failures in the database.
2024-10-25 12:14:15 -04:00
df34858c3c chore(coderd): extract fileszip to package archive for reuse (#15229)
Related to https://github.com/coder/coder/issues/15087
As part of sniffing the workspace tags from an uploaded file, we need to
be able to handle both zip and tar files. Extracting the functions to
a separate `archive` package will be helpful here.
2024-10-25 15:14:39 +01:00
d9f1aafa94 fix: stop logging errors on cancel in notifier (#15186)
fixes https://github.com/coder/internal/issues/121

We shouldn't log errors when context is canceled, e.g. on shutdown.  This breaks our tests and alarms customers needlessly.
2024-10-25 16:28:54 +04:00
e5668720b8 fix(coderd): improve password update logic (#15210)
Working on #15202

The main change is to fetch the user doing the action to verify if it
should be able to change the password if there's no old_password set.
2024-10-24 22:48:15 +02:00
81e99bec6b fix: close server pty connections on client disconnect (#15201) 2024-10-24 15:12:35 -04:00
095c9797c9 feat: notify users on template deprecation (#15195)
Closes https://github.com/coder/coder/issues/15117

Notify users when a template has been deprecated.
2024-10-24 13:12:12 +01:00
32d5875fa4 fix: wait for server tailnet background routines to exit on Close (#15183)
fixes https://github.com/coder/internal/issues/114

We need to wait for ServerTailnet goroutines to finish when closing down, otherwise we can race with the shutdown of coderd & the coordinator, which causes errors.
2024-10-23 10:09:56 +04:00
343f8ec9ab chore: join owner, template, and org in new workspace view (#15116)
Joins in fields like `username`, `avatar_url`, `organization_name`,
`template_name` to `workspaces` via a **view**. 
The view must be maintained moving forward, but this prevents needing to
add RBAC permissions to fetch related workspace fields.
2024-10-22 09:20:54 -05:00
5076161078 fix: show audit logs for forgot password flow (#15181)
Fixes https://github.com/coder/coder/issues/15150

Audit logs for requesting a password reset, and a user updating their
password, now show up in the audit log.
2024-10-22 13:47:30 +01:00
297089e944 feat(coderd): add company logo when available for email notifications (#14935)
This PR aims to close #14253 

We keep the default behavior using the Coder logo if there's no logo
set.
Otherwise we want to use the logo based on the URL set in appearance.

---------

Co-authored-by: defelmnq <yvincent@coder.com>
2024-10-22 14:06:19 +02:00
23f61c68b4 fix: urlencode email in reset password link (#15167)
Fixes https://github.com/coder/coder/issues/15151

This runs `urlencode` (provided by `text/template`) on the email address
in the link. This ensures the link will work if a user has an email in
the form `user+label@example.com`.
2024-10-21 16:09:59 +01:00
29099d4727 chore: refactor notifier to use quartz.TickerFunc (#15134)
In investigating https://github.com/coder/internal/issues/109 I noticed many of the notification tests are still using `time.Sleep` and `require.Eventually`. This is an initial effort to start converting these to Quartz.

One product change is to switch the `notifier` to use a `TickerFunc` instead of a normal Ticker, since it allows the test to assert that a batch process is complete via the Quartz `Mock` clock.  This does introduce one slight behavioral change in that the notifier waits the fetch interval before processing its first batch.  In practice, this is inconsequential: no one will notice if we send notifications immediately on startup, or just a little later.

But, it does make a difference to some tests, which are fixed up here.
2024-10-21 12:07:19 +04:00
8c8bd3141f chore: stop creating coderd for notification unit tests (#15133)
A bunch of notification tests create a whole `coderd`, when all they use is the database and logger.  This makes the tests more expensive to run, and pollutes the test logs with a bunch of stuff that doesn't matter (e.g. tailnet).
2024-10-21 10:39:37 +04:00
aaa1223408 feat(site): add forgot password link (#15108)
Demo:

https://github.com/user-attachments/assets/139eb8c0-5bd6-4bbd-8064-a4acc526afda
2024-10-18 09:50:22 -03:00
5f640eb219 fix: correct connection_median_latency_ms in query (#15086)
Closes https://github.com/coder/coder/issues/14805
2024-10-17 12:22:26 -04:00
46cce333b1 fix: check unstaged files during ci lint (#15120) 2024-10-17 05:37:43 +00:00
dfb6bfa4d2 fix(coderd/notifications): exclude unset fields from notifications (#15110)
This PR will ensure that optional fields are ignored when they are unset
in user account related templates.
2024-10-16 21:53:24 +02:00
f537193682 chore: refactor keycache implementation to reduce duplication (#15100) 2024-10-16 20:01:45 +01:00
774c9ddc64 test: add logging to TestWorkspaceActivityBump/Dial (#15089)
Added logging information to output timing information of this for
loop. If we get another failure, this timing information should be
helpful.

I also made the time drift allowed (was 10s) to match the maximum
waiting time of the for loop. It's not perfect, but now the loop should
take max ~15s, and the time comparison will allow 15s leeway.
2024-10-16 10:01:48 -05:00
416d67ba2c test: use barrier in TestInflightDispatchesMetric (#15107)
Fixes: https://github.com/coder/internal/issues/109
2024-10-16 14:12:19 +02:00
21feb42fc4 test: ignore slog errors in TestUserLatencyInsights (#15105) 2024-10-16 13:20:28 +02:00
fac77f956e fix(coderd/notifications): simplify TemplateWorkspaceManualBuildFailed (#15067)
This PR closes #15065.

As advised by @mtojek, a template's display name may be set to "", which
is not useful in an email notification. We'd like to provide a friendly
name for the template, but it also needs to be identifiable.

As such, we fall back to template.Name in the case that the template's
display name is empty.
2024-10-15 21:02:02 +02:00
42e2a4150c fix(coderd): improve workspace tests (#15069)
With [a recent PR](https://github.com/coder/coder/pull/14923) we
introduced [new
tests](https://github.com/coder/coder/pull/14923/files#diff-81081239b93aaa61eb8d180a5f9870fda8f0ab5cb4c6727d9d1636aa933e597b)
that - while running in parallel to the existing ones - are failing.

This PR is a quick proposal to fix it - tested in local and in the CI to
unblock the situation. We can ignore it to work on a longer term
solution if preferred.
2024-10-15 16:30:38 +02:00
b8420ecaaf test(coderd): fix flake on TestWorkspaceBuildTimings (#15077)
Fix https://github.com/coder/coder/issues/15073
2024-10-15 09:43:39 -03:00
208ed1efd7 chore(coderd/notifications): expand golden file testing for notifications (#15032)
This PR aims to close https://github.com/coder/coder/issues/14913.

It expands the golden files for the notifier to include the entire
payload serialised as JSON.
2024-10-14 12:34:32 +00:00
9c8ecb82a3 feat(coderd): return agent script timings (#14923)
Add the agent script timings into the
`/workspacebuilds/:workspacebuild/timings` response.

Close https://github.com/coder/coder/issues/14876
2024-10-14 09:31:03 -03:00
9d02269191 feat(coderd/notifications): improve notification format consistency (#14967)
This Pull request addresses the more trivial items in
https://github.com/coder/coder/issues/14893.
These were simple formatting changes that I was able to fix despite
limited context.

Some more changes are required for which I will have to dig a bit deeper
into how the template contexts are populated. I'm happy to add those to
this PR or create a subsequent PR.
2024-10-09 17:31:12 -05:00
6bf73a5964 fix(coderd): move test location to ignore Australia time saving error (#15013)
A test is currently failing because it relies on Sidney Tz.

from the internet : 

```
Daylight Saving Time begins at 2 am (AEST) on the first Sunday in October and ends at 3 am (Australian Eastern Daylight Time) on the first Sunday in April.
```

Due to that - there's one hour missing in the tests - and the test `6
days are acceptable` is failing.

Changing to another timezone to fix the situation, it would require a
longer-term solution or making sure it cannot happen anymore.
2024-10-07 21:10:01 +02:00
288df75686 fix: serialize updateEntitlements() (#14974)
fixes #14961

Adding the license and updating entitlements is flaky, especially at the start of our `coderdent` testing because, while the actual modifications to the `entitlements.Set` were threadsafe, we could have multiple goroutines reading from the database and writing to the set, so we could end up writing stale data.

This enforces serialization on updates, so that if you modify the database and kick off an update, you know the state of the `Set` is at least as fresh as your database update.
2024-10-05 06:58:43 +04:00
4369f2b4b5 feat: implement api for "forgot password?" flow (#14915)
Relates to https://github.com/coder/coder/issues/14232

This implements two endpoints (names subject to change):
- `/api/v2/users/otp/request`
- `/api/v2/users/otp/change-password`
2024-10-04 11:53:25 +01:00
7d9f5ab81d chore: add Coder service prefix to tailnet (#14943)
re: #14715

This PR introduces the Coder service prefix: `fd60:627a:a42b::/48` and refactors our existing code as calling the Tailscale service prefix explicitly (rather than implicitly).

Removes the unused `Addresses` agent option. All clients today assume they can compute the Agent's IP address based on its UUID, so an agent started with a custom address would break things.
2024-10-04 10:04:10 +04:00
68ec532ca7 feat: add jwt pkg (#14928)
- Adds a `jwtutils` package to be shared amongst the various
packages in the codebase that make use of JWTs. It's intended to help us
standardize on one library instead of some implementations using
`go-jose` and others using `golang-jwt`.

The main reason we're converging on `go-jose` is due to its support for
JWEs, `golang-jwt` also has a repo to handle it but it doesn't look
maintained: https://github.com/golang-jwt/jwe
2024-10-03 21:09:52 -05:00
zx
d0a8424819 feat: remove dark blue theme (#14890) 2024-10-02 09:30:33 -06:00