Commit Graph

9888 Commits

Author SHA1 Message Date
Hugo Dutka
a0e229afec chore: run test-go-pg on macOS and Windows in regular CI (#17853)
This PR starts running test-go-pg on macOS and Windows in regular CI.
Previously this suite was only run in the nightly gauntlet for 2
reasons:

- it was flaky
- it was slow (took 17 minutes)

We've since stabilized the flakiness by switching to depot runners,
using ram disks, optimizing the number of tests run in parallel, and
automatically re-running failing tests. We've also [brought
down](https://github.com/coder/coder/pull/17756) the time to run the
suite to 9 minutes. Additionally, this PR allows test-go-pg to use cache
from previous runs, which speeds it up further. The cache is only used
on PRs, `main` will still run tests without it.

This PR also:

- removes the nightly gauntlet since all tests now run in regular CI
- removes the `test-cli` job for the same reason
- removes the `setup-imdisk` action which is now fully replaced by
[coder/setup-ramdisk-action](https://github.com/coder/setup-ramdisk-action)
- makes 2 minor changes which could be separate PRs, but I rolled them
into this because they were helpful when iterating on it:
- replace the `if: always()` condition on the `gen` job with a `if: ${{
!cancelled() }}` to allow the job to be cancelled. Previously the job
would run to completion even if the entire workflow was cancelled. See
[the GitHub
docs](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#always)
for more details.
- disable the recently added `TestReinitializeAgent` since it does not
pass on Windows with Postgres. There's an open issue to fix it:
https://github.com/coder/internal/issues/642

This PR will:

- unblock https://github.com/coder/coder/issues/15109
- alleviate https://github.com/coder/internal/issues/647

I tested caching by temporarily enabling cache upload on this PR: here's
[a
run](https://github.com/coder/coder/actions/runs/15119046903/job/42496939341?pr=17853#step:13:1296)
showing cache being used.
2025-05-22 15:53:37 +02:00
Hugo Dutka
f825477a5c fix: add timeouts to test telemetry snapshot (#17879)
This PR ensures that waits on channels will time out according to the
test context, rather than waiting indefinitely. This should alleviate
the panic seen in https://github.com/coder/internal/issues/645 and, if
the deadlock recurs, allow the test to be retried automatically in CI.
2025-05-22 13:51:24 +02:00
Atif Ali
5a3a7fc4e5 chore: add JetBrains Toolbox to docs manifest (#17986) 2025-05-22 16:30:56 +05:00
Edward Angert
eb8013a7f4 docs: add jetbrains toolbox steps (#17661)
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
Co-authored-by: ケイラ <mckayla@hey.com>
Co-authored-by: Jon Ayers <jon@coder.com>
Co-authored-by: Danny Kopping <danny@coder.com>
Co-authored-by: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com>
Co-authored-by: Bruno Quaresma <bruno@coder.com>
Co-authored-by: Steven Masley <stevenmasley@gmail.com>
Co-authored-by: Atif Ali <atif@coder.com>
2025-05-22 16:08:59 +05:00
Ethan
34494fb330 chore: avoid depending on rbac in slim builds (#17959)
I noticed the `coder-vpn.dylib` (of course alongside the Agent/CLI binaries) had grown substantially (from 29MB to 37MB for the dylib), and discovered that importing RBAC in slim builds was the issue

This PR removes the dependency on RBAC in slim builds, and adds a compile-time check to ensure it can't be imported in the future:

```
$ make build
# github.com/coder/coder/v2/coderd/rbac
coderd/rbac/no_slim.go:8:2: initialization cycle: _DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS refers to itself
make: *** [Makefile:224: build/coder-slim_2.22.1-devel+7e46d24b4_linux_amd64] Error 1
```

Before and after for `coder-slim_darwin_arm64`:
```
$ gsa before after
┌───────────────────────────────────────────────────────────────────────────────────┐
│ Diff between before and after                                                     │
├─────────┬─────────────────────────────────────────┬──────────┬──────────┬─────────┤
│ PERCENT │ NAME                                    │ OLD SIZE │ NEW SIZE │ DIFF    │
├─────────┼─────────────────────────────────────────┼──────────┼──────────┼─────────┤
│ -100%   │ github.com/gorilla/mux                  │          │          │ +0 B    │
│ -100%   │ github.com/ammario/tlru                 │          │          │ +0 B    │
│ -100%   │ github.com/armon/go-radix               │          │          │ +0 B    │
│ -0.00%  │ gvisor.dev/gvisor                       │ 2.4 MB   │ 2.4 MB   │ -4 B    │
│ -0.21%  │ os                                      │ 155 kB   │ 155 kB   │ -328 B  │
│ -0.23%  │ regexp                                  │ 152 kB   │ 152 kB   │ -346 B  │
│ -0.04%  │ runtime                                 │ 876 kB   │ 876 kB   │ -372 B  │
│ -100%   │ github.com/rcrowley/go-metrics          │ 675 B    │          │ -675 B  │
│ -23.79% │ github.com/cespare/xxhash/v2            │ 3.0 kB   │ 2.3 kB   │ -715 B  │
│ -100%   │ github.com/agnivade/levenshtein         │ 1.4 kB   │          │ -1.4 kB │
│ -100%   │ github.com/go-ini/ini                   │ 1.5 kB   │          │ -1.5 kB │
│ -100%   │ github.com/xeipuuv/gojsonreference      │ 2.4 kB   │          │ -2.4 kB │
│ -100%   │ github.com/xeipuuv/gojsonpointer        │ 5.2 kB   │          │ -5.2 kB │
│ -2.43%  │ go.opentelemetry.io/otel                │ 316 kB   │ 309 kB   │ -7.7 kB │
│ -2.40%  │ slices                                  │ 381 kB   │ 372 kB   │ -9.2 kB │
│ -0.68%  │ crypto                                  │ 1.4 MB   │ 1.4 MB   │ -9.5 kB │
│ -100%   │ github.com/tchap/go-patricia/v2         │ 23 kB    │          │ -23 kB  │
│ -100%   │ github.com/yashtewari/glob-intersection │ 28 kB    │          │ -28 kB  │
│ -4.35%  │ <autogenerated>                         │ 754 kB   │ 721 kB   │ -33 kB  │
│ -100%   │ github.com/sirupsen/logrus              │ 72 kB    │          │ -72 kB  │
│ -2.56%  │ github.com/coder/coder/v2               │ 3.3 MB   │ 3.2 MB   │ -84 kB  │
│ -100%   │ github.com/gobwas/glob                  │ 107 kB   │          │ -107 kB │
│ -100%   │ sigs.k8s.io/yaml                        │ 244 kB   │          │ -244 kB │
│ -100%   │ github.com/open-policy-agent/opa        │ 2.2 MB   │          │ -2.2 MB │
├─────────┼─────────────────────────────────────────┼──────────┼──────────┼─────────┤
│ -7.79%  │ __go_buildinfo __DATA                   │ 18 kB    │ 17 kB    │ -1.4 kB │
│ -6.81%  │ __itablink __DATA_CONST                 │ 23 kB    │ 22 kB    │ -1.6 kB │
│ -6.61%  │ __typelink __DATA_CONST                 │ 71 kB    │ 66 kB    │ -4.7 kB │
│ -2.86%  │ __noptrdata __DATA                      │ 1.0 MB   │ 993 kB   │ -29 kB  │
│ -21.49% │ __data __DATA                           │ 320 kB   │ 251 kB   │ -69 kB  │
│ -6.19%  │ __rodata __DATA_CONST                   │ 6.0 MB   │ 5.6 MB   │ -372 kB │
│ -47.19% │ __rodata __TEXT                         │ 7.6 MB   │ 4.0 MB   │ -3.6 MB │
├─────────┼─────────────────────────────────────────┼──────────┼──────────┼─────────┤
│ -14.02% │ before                                  │ 50 MB    │ 43 MB    │ -7.0 MB │
│         │ after                                   │          │          │         │
└─────────┴─────────────────────────────────────────┴──────────┴──────────┴─────────┘
```
2025-05-22 19:48:23 +10:00
Sas Swart
1e1e6f3bd1 fix: skip TestReinitializeAgent until we can adapt it for windows (#17968)
relates to https://github.com/coder/internal/issues/642

I've reached a timebox trying to get a script for windows to work, so
I'm skipping it for now.
2025-05-22 08:48:40 +02:00
Ben Potter
a5234bf9a5 chore: fix autoversion script and update experiments/docs to v2.22.1 (#17954) 2025-05-21 23:17:14 -04:00
Yevhenii Shcherbina
53e8e9c7cd fix: reduce cost of prebuild failure (#17697)
Relates to https://github.com/coder/coder/issues/17432

### Part 1:

Notes:
- `GetPresetsAtFailureLimit` SQL query is added, which is similar to
`GetPresetsBackoff`, they use same CTEs: `filtered_builds`,
`time_sorted_builds`, but they are still different.

- Query is executed on every loop iteration. We can consider marking
specific preset as permanently failed as an optimization to avoid
executing query on every loop iteration. But I decided don't do it for
now.

- By default `FailureHardLimit` is set to 3.

- `FailureHardLimit` is configurable. Setting it to zero - means that
hard limit is disabled.

### Part 2

Notes:
- `PrebuildFailureLimitReached` notification is added.
- Notification is sent to template admins.
- Notification is sent only the first time, when hard limit is reached.
But it will `log.Warn` on every loop iteration.
- I introduced this enum:
```sql
CREATE TYPE prebuild_status AS ENUM (
  'normal',           -- Prebuilds are working as expected; this is the default, healthy state.
  'hard_limited',     -- Prebuilds have failed repeatedly and hit the configured hard failure limit; won't be retried anymore.
  'validation_failed' -- Prebuilds failed due to a non-retryable validation error (e.g. template misconfiguration); won't be retried.
);
```
`validation_failed` not used in this PR, but I think it will be used in
next one, so I wanted to save us an extra migration.

- Notification looks like this:
<img width="472" alt="image"
src="https://github.com/user-attachments/assets/e10efea0-1790-4e7f-a65c-f94c40fced27"
/>

### Latest notification views:
<img width="463" alt="image"
src="https://github.com/user-attachments/assets/11310c58-68d1-4075-a497-f76d854633fe"
/>
<img width="725" alt="image"
src="https://github.com/user-attachments/assets/6bbfe21a-91ac-47c3-a9d1-21807bb0c53a"
/>
2025-05-21 15:16:38 -04:00
Bruno Quaresma
e1934fe119 chore: replace MUI icons with Lucide icons - update 18 (#17958)
1. PersonOutline → UserIcon
2. Apps → LayoutGridIcon
3. Delete → TrashIcon
4. InsertDriveFile → FileIcon
2025-05-21 16:11:23 -03:00
Bruno Quaresma
f35a1bc448 chore: replace MUI Button - 3 (#17955)
Replaced MUI Button with custom Button in 5 components:
  - Filter.tsx - Changed import and updated Button props
(variant="outline", size="sm")
  - ChatLayout.tsx - Changed import and updated Button
props for the "New Chat" button
  - StarterTemplatePageView.tsx - Changed import and
implemented asChild pattern for links
  - Notifications.tsx - Changed import and updated
NotificationActionButton to use variant="subtle"
  - DateRange.tsx - Changed import and updated Button
styling
2025-05-21 15:58:38 -03:00
Bruno Quaresma
cbfe975cc8 refactor: show unhealthy status on workspace status indicator (#17956)
Instead of showing a "yellow question icon" on the side of the status,
to let the user aware of unhealthy agents, we could make it yellow and
use a tooltip.

Before:
<img width="1512" alt="Screenshot 2025-05-20 at 18 13 15"
src="https://github.com/user-attachments/assets/afee470e-9dd4-4c32-b2bc-b9f66eac60fa"
/>

After:
<img width="1512" alt="Screenshot 2025-05-20 at 18 13 26"
src="https://github.com/user-attachments/assets/5769828b-f23c-45a5-8017-c4a88f085d0f"
/>
2025-05-21 15:57:32 -03:00
Jaayden Halko
cb7ce18592 feat: add experimental workspace parameters page for dynamic params (#17841)
![Screenshot 2025-05-20 at 22 26
40](https://github.com/user-attachments/assets/639441d7-2349-4c92-a4ee-d8a5a724fe8e)
2025-05-21 13:48:35 -04:00
Jaayden Halko
3a6d5f5bba fix: update textarea to fit content height and set a max height (#17946) 2025-05-21 10:56:01 -04:00
Jaayden Halko
36d938fa88 fix: show diagnostics if there are no parameters (#17967)
Prefer to show the top level diagnostics inside the parameters section
for context but this adds a case to show diagnostics if there are no
parameters.

Normally, the entire parameters section is hidden if there are no
parameters.
2025-05-21 10:55:37 -04:00
Michael Suchacz
b7462fb256 feat: improve transaction safety in CompleteJob function (#17970)
This PR refactors the CompleteJob function to use database transactions
more consistently for better atomicity guarantees. The large function
was broken down into three specialized handlers:

- completeTemplateImportJob
- completeWorkspaceBuildJob
- completeTemplateDryRunJob

Each handler now uses the Database.InTx wrapper to ensure all database
operations for a job completion are performed within a single
transaction, preventing partial updates in case of failures.

Added comprehensive tests for transaction behavior for each job type.

Fixes #17694

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-21 16:48:51 +02:00
Bruno Quaresma
c6bece0ec5 refactor: update provisioners column copy (#17949) 2025-05-21 08:57:15 -03:00
Spike Curtis
818d4d03f4 chore: ignore 'session shutdown' yamux error in tests (#17964)
Fixes flake seen here: https://github.com/coder/coder/actions/runs/15154327939/job/42606133069?pr=17960

Error log dropped when the dRPC server is being shut down right as we are (re)dialing.
2025-05-21 11:29:25 +04:00
Michael Suchacz
3654a49fb5 feat: add Claude.md initial draft (#17785) 2025-05-21 09:16:00 +02:00
Spike Curtis
cbbbb4492a docs: explain coder:// link for RDP (#17901)
fixes https://github.com/coder/internal/issues/627

Adds docs for `coder://` URLs for Windows Remote Desktop (RDP).

Note that we might want to hold of merging since the URI handling is
unreleased in Coder Desktop for Windows.
2025-05-21 09:28:31 +04:00
Bruno Quaresma
36224f263f chore: replace MUI icons with Lucide icons - 17 (#17957)
1. ExpandMoreOutlined → ChevronDownIcon
2. Error/ErrorIcon → CircleAlertIcon
3. CheckCircle → CircleCheckIcon
4. Warning → TriangleAlertIcon
2025-05-20 22:24:17 -03:00
Danielle Maywood
3e7ff9d9e1 chore(coderd/rbac): add Action{Create,Delete}Agent to ResourceWorkspace (#17932) 2025-05-20 21:20:56 +01:00
Danny Kopping
d2d21898f2 chore: reduce ignore_changes suggestion scope (#17947)
We probably shouldn't be suggesting `ignore_changes = all`. Only the
attributes which cause drift in prebuilds should be ignored; everything
else can behave as normal.

---------

Signed-off-by: Danny Kopping <dannykopping@gmail.com>
Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
2025-05-20 22:16:23 +02:00
Edward Angert
1f54c36375 docs: rename external-auth heading in setup doc (#17868)
to help point searchers to the correct doc


[preview](https://coder.com/docs/@setup-ext-auth/admin/setup#continue-your-setup-with-external-authentication)

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2025-05-20 15:10:52 -04:00
Thomas Kosiewski
b551a062d7 fix: correct environment variable name for MCP app status slug (#17948)
Fixed environment variable name for app status slug in Claude MCP configuration from `CODER_MCP_CLAUDE_APP_STATUS_SLUG` to `CODER_MCP_APP_STATUS_SLUG` to maintain consistency with other MCP environment variables.

This also caused the User level Claude.md to not contain instructions to report its progress, so it did not receive status reports.
2025-05-20 19:35:19 +02:00
Julio
55313cffbc chore: add vsphere icon (#17936) 2025-05-20 17:19:38 +00:00
Edward Angert
b51c902e48 docs: add early access badge to devcontainers admin (#17937)
[preview](https://coder.com/docs/@dev-container-tweaks/admin/templates/extending-templates/devcontainers)

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2025-05-20 12:46:07 -04:00
Steven Masley
a123900fe8 chore: remove coder/preview dependency from codersdk (#17939) 2025-05-20 10:45:12 -05:00
Steven Masley
e76d58f2b6 chore: disable parameter validatation for dynamic params for all transitions (#17926)
Dynamic params skip parameter validation in coder/coder.
This is because conditional parameters cannot be validated 
with the static parameters in the database.
2025-05-20 10:09:53 -05:00
Thomas Kosiewski
93f17bc73e fix: remove unnecessary user lookup in agent API calls (#17934)
# Use workspace.OwnerUsername instead of fetching the owner

This PR optimizes the agent API by using the `workspace.OwnerUsername` field directly instead of making an additional database query to fetch the owner's username. The change removes the need to call `GetUserByID` in the manifest API and workspace agent RPC endpoints.

An issue arose when the agent token was scoped without access to user data (`api_key_scope = "no_user_data"`), causing the agent to fail to fetch the manifest due to an RBAC issue.

Change-Id: I3b6e7581134e2374b364ee059e3b18ece3d98b41
Signed-off-by: Thomas Kosiewski <tk@coder.com>
2025-05-20 17:07:50 +02:00
Danielle Maywood
1267c9c405 fix: ensure reason present for workspace autoupdated notification (#17935)
Fixes https://github.com/coder/coder/issues/17930

Update the `WorkspaceAutoUpdated` notification to only display the
reason if it is present.
2025-05-20 16:01:57 +01:00
Michael Suchacz
769c9ee337 feat: cancel stuck pending jobs (#17803)
Closes: #16488
2025-05-20 15:22:44 +02:00
Sas Swart
613117bde2 chore: add presets with prebuilds to our dogfood template (#17933)
This PR adds a preset with prebuilds for each region to our dogfood
template. Creating a workspace based on a preset should now save time
compared to creating a workspace from scratch
2025-05-20 14:45:26 +02:00
Ethan
e5758a12c7 fix(site): center /cli-auth on firefox (#17929)
`-webkit-fill-available` is not available in Firefox: https://caniuse.com/mdn-css_properties_height_stretch
`-moz-available` doesn't work on `height`, so we have to use `100vh`.

Before:
<img width="1405" alt="image" src="https://github.com/user-attachments/assets/bd0f4390-50e9-47fa-8501-f3e3483d3c0d" />

After:
<img width="1329" alt="image" src="https://github.com/user-attachments/assets/f19f4b2a-3398-4d64-8e12-5cfcb84106a9" />


The existing CSS is retained in browsers that support `-webkit-fill-available`, i.e. chrome:
<img width="253" alt="image" src="https://github.com/user-attachments/assets/c1b356b4-c228-4580-a4c3-cddc2e0327b4" />
2025-05-20 14:25:13 +10:00
Jaayden Halko
dc21016151 fix: get presets working correctly with dynamic params (#17923)
This adds a few fixes to get presets working correctly with dynamic
params

1. Changes to preset params need to be rendered and displayed correctly
2. Changes to preset params need to be sent to the websocket
3. Changes to preset params need to be marked as touched so they won't
be automatically changed later because of dynamic defaults. Dynamic
defaults means any default parameter value can be changed by the
websocket response unless edited by the user, set by autofill or set by
a preset.
2025-05-19 18:20:40 -04:00
Steven Masley
9c000468a1 chore: expose use_classic_parameter_flow on workspace response (#17925) 2025-05-19 21:59:15 +00:00
Bruno Quaresma
cc53c4d1d5 fix: fix devcontainer port button (#17924) 2025-05-19 18:38:38 -03:00
Edward Angert
1314dbdc94 docs: add new dynamic parameters information to parameters doc (#17653)
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
Co-authored-by: Stephen Kirby <kirby@coder.com>
Co-authored-by: Stephen Kirby <58410745+stirby@users.noreply.github.com>
2025-05-19 21:23:53 +00:00
Susana Ferreira
0cac6a8c38 docs: add provisioner job state transition diagram (#17882)
# Description

Add a state transition diagram for provisioner jobs to the
documentation.

This PR introduces a new diagram illustrating the lifecycle and state
transitions of provisioner jobs. The diagram complements the existing
status table by providing a visual representation of how jobs move
between different states throughout their lifecycle.

# Changes

- Added a SVG diagram under the **Manage Provisioner Jobs**
documentation page, in the **Provisioner Job Status** section.
- Included a brief introductory text before the diagram.

Mermaid
[link](https://www.mermaidchart.com/play#pako:eNqFkD1PwzAQhv_KyRMdvPSDIUKVUFIGJtSyYQbXvjSW3DM4jiqE-O_YsRtFCMF49z6P75U_mXIaWcU454KUo9acKkEAocMzVkA4BC-toDFvrbuoTvoAz02CAO5vXgQ7hLgS7HUBnMOjO0LtUQbUcdxCHYEnJG3oFJFs1VdwNAvYRHA_EM3BZnrRnd8sRvTu6LeHQSns-3aw9mNUaZlapC1q1P_YFxM62HnvfHZX0X2Qxv4qSlJorQzGUXL3-D5gf21M66hmZF6a1kn_qeYT5eRf4FQ2s5vpxqwgbXJ4m75_RylYlGRVkjIup5F9fQNTV5aS)

---

Screenshot of `Provisioner job status` section in documentation page:

![Screenshot 2025-05-19 at 16 10
12](https://github.com/user-attachments/assets/9cd6a46e-24ae-450c-842c-9580d61a50f6)
2025-05-19 17:23:36 -04:00
Steven Masley
358b64154e chore: skip parameter resolution for dynamic params (#17922)
Pass through the user input as is. The previous code only passed through
parameters that existed in the db (static params). This would omit
conditional params.

Validation is enforced by the dynamic params websocket, so validation at
this point is not required.
2025-05-19 16:15:15 -05:00
Bruno Quaresma
fe733afd14 chore: fix flake on useAgentLogs (#17919)
We need to wait for the result since the result is depending on effects.

Fix https://github.com/coder/internal/issues/644
2025-05-19 16:43:26 -03:00
Cian Johnston
433f0be53d fix: show provisioner name instead of key name in expanded ProvisionerKeyRow (#17921) 2025-05-19 14:35:22 -03:00
Bruno Quaresma
ca5f114204 refactor: update cli auth page design (#17915)
Improve UX of CLI Auth page.

**Before:**

<img width="1512" alt="Screenshot 2025-05-19 at 09 22 36"
src="https://github.com/user-attachments/assets/ffcecebc-a289-4b06-993d-a170f2ba5e49"
/>

**After:**


https://github.com/user-attachments/assets/01dfcd70-d0a6-48bb-9186-77da24001498



Fixes https://github.com/coder/coder/issues/17905
2025-05-19 13:27:58 -03:00
Cian Johnston
ac7961a5b0 feat: add Organization Provisioner Keys view (#17889)
Fixes https://github.com/coder/coder/issues/17698

**Demo:**


https://github.com/user-attachments/assets/ba92693f-29b7-43ee-8d69-3d77214f3230

---------

Co-authored-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>
2025-05-19 16:58:12 +01:00
Danielle Maywood
61f22a59ba feat(agent): add ParentId to agent manifest (#17888)
Closes https://github.com/coder/internal/issues/648

This change introduces a new `ParentId` field to the agent's manifest.
This will allow an agent to know if it is a child or not, as well as
knowing who the owner is.

This is part of the Dev Container Agents work
2025-05-19 16:09:56 +01:00
Susana Ferreira
f044cc3550 feat: add provisioner daemon name to provisioner jobs responses (#17877)
# Description

This PR adds the `worker_name` field to the provisioner jobs endpoint.

To achieve this, the following SQL query was updated:
-
`GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisioner`

As a result, the `codersdk.ProvisionerJob` type, which represents the
provisioner job API response, was modified to include the new field.

**Notes:** 
* As mentioned in
[comment](https://github.com/coder/coder/pull/17877#discussion_r2093218206),
the `GetProvisionerJobsByIDsWithQueuePosition` query was not changed due
to load concerns. This means that for template and template version
endpoints, `worker_id` will still be returned, but `worker_name` will
not.
* Similar to `worker_id`, the `worker_name` is only present once a job
is assigned to a provisioner daemon. For jobs in a pending state (not
yet assigned), neither `worker_id` nor `worker_name` will be returned.

---

# Affected Endpoints

- `/organizations/{organization}/provisionerjobs`
- `/organizations/{organization}/provisionerjobs/{job}`

---

# Testing

- Added new tests verifying that both `worker_id` and `worker_name` are
returned once a provisioner job reaches the **succeeded** state.
- Existing tests covering state transitions and other logic remain
unchanged, as they test different scenarios.

---

# Front-end Changes

Admin provisioner jobs dashboard:
<img width="1088" alt="Screenshot 2025-05-16 at 11 51 33"
src="https://github.com/user-attachments/assets/0e20e360-c615-4497-84b7-693777c5443e"
/>

Fixes: https://github.com/coder/coder/issues/16982
2025-05-19 16:05:39 +01:00
Danny Kopping
87dc2478a9 feat: fail CI when pubsub.Publish calls are found in db transactions (#17903)
Publishing inside a db transaction can lead to database connection
starvation/contention since it requires its own connection.

This ruleguard rule (one-shotted by Claude Sonnet 3.7 and finalized by
@Emyrk) will detect two of the following 3 instances:

```go
type Nested struct {
	ps pubsub.Pubsub
}

func TestFail(t *testing.T) {
	t.Parallel()

	db, ps := dbtestutil.NewDB(t)
	nested := &Nested{
		ps: ps,
	}

	// will catch this
	_ = db.InTx(func(_ database.Store) error {
		_, _ = fmt.Printf("")
		_ = ps.Publish("", []byte{})
		return nil
	}, nil)

	// will catch this
	_ = db.InTx(func(_ database.Store) error {
		_ = nested.ps.Publish("", []byte{})
		return nil
	}, nil)

	// will NOT catch this
	_ = db.InTx(func(_ database.Store) error {
		blah(ps)
		return nil
	}, nil)
}

func blah(ps pubsub.Pubsub) {
	ps.Publish("", []byte{})
}
```

The ruleguard doesn't recursively introspect function calls so only the
first two cases will be guarded against, but it's better than nothing.

<img width="1444" alt="image"
src="https://github.com/user-attachments/assets/8ffa0d88-16a0-41a9-9521-21211910dec9"
/>

---------

Signed-off-by: Danny Kopping <dannykopping@gmail.com>
Co-authored-by: Steven Masley <stevenmasley@gmail.com>
2025-05-19 14:52:51 +00:00
Jaayden Halko
4412f194d4 fix: sync websocket params with form params (#17895)
The current issue is that when multiple parameters are added or removed
from a form because a user change in a conditional parameter value. The
websocket parameters response gets out of sync with the state of the
parameters in the form.

The form state needs to be maintained because this is what gets
submitted when the user attempts to create a workspace.

Fixes:

1. When autofill params are set from the url, mark these params as
touched in the form. This is necessary as only touched params are sent
in the request to the websocket. These params should technically count
as being touched because they were preset from the url params.

2. Create a hook to synchronize the parameters from the websocket
response with the current state of the parameters stored in the form.
2025-05-19 10:49:02 -04:00
Jaayden Halko
766277c20e fix: disable submit button on diagnostics error (#17900) 2025-05-19 10:43:56 -04:00
dependabot[bot]
4e0fc6e17c chore: bump github.com/hashicorp/terraform-json from 0.24.0 to 0.25.0 (#17914)
Bumps
[github.com/hashicorp/terraform-json](https://github.com/hashicorp/terraform-json)
from 0.24.0 to 0.25.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/hashicorp/terraform-json/releases">github.com/hashicorp/terraform-json's
releases</a>.</em></p>
<blockquote>
<h2>v0.25.0</h2>
<p>ENHANCEMENTS:</p>
<ul>
<li>Add identity fields to plan struct by <a
href="https://github.com/dbanck"><code>@​dbanck</code></a> in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/158">hashicorp/terraform-json#158</a></li>
<li>Update state and provider JSON with identity fields by <a
href="https://github.com/dbanck"><code>@​dbanck</code></a> in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/155">hashicorp/terraform-json#155</a></li>
</ul>
<p>INTERNAL:</p>
<ul>
<li>build(deps): Bump workflows to latest trusted versions by <a
href="https://github.com/hashicorp-tsccr"><code>@​hashicorp-tsccr</code></a>
in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/149">hashicorp/terraform-json#149</a></li>
<li>Bump github.com/zclconf/go-cty from 1.15.1 to 1.16.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/150">hashicorp/terraform-json#150</a></li>
<li>Bump github.com/zclconf/go-cty from 1.16.0 to 1.16.1 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/151">hashicorp/terraform-json#151</a></li>
<li>Bump github.com/zclconf/go-cty from 1.16.1 to 1.16.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/152">hashicorp/terraform-json#152</a></li>
<li>build(deps): Bump workflows to latest trusted versions by <a
href="https://github.com/hashicorp-tsccr"><code>@​hashicorp-tsccr</code></a>
in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/153">hashicorp/terraform-json#153</a></li>
<li>Bump github.com/google/go-cmp from 0.6.0 to 0.7.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/154">hashicorp/terraform-json#154</a></li>
<li>build(deps): Bump workflows to latest trusted versions by <a
href="https://github.com/hashicorp-tsccr"><code>@​hashicorp-tsccr</code></a>
in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/156">hashicorp/terraform-json#156</a></li>
<li>Update owner field in catalog-info.yaml by <a
href="https://github.com/imakewebthings"><code>@​imakewebthings</code></a>
in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/157">hashicorp/terraform-json#157</a></li>
<li>Update CODEOWNERS by <a
href="https://github.com/austinvalle"><code>@​austinvalle</code></a> in
<a
href="https://redirect.github.com/hashicorp/terraform-json/pull/159">hashicorp/terraform-json#159</a></li>
<li>github: Use Dependabot to keep Actions updated by <a
href="https://github.com/xiehan"><code>@​xiehan</code></a> in <a
href="https://redirect.github.com/hashicorp/terraform-json/pull/160">hashicorp/terraform-json#160</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/hashicorp/terraform-json/compare/v0.24.0...v0.25.0">https://github.com/hashicorp/terraform-json/compare/v0.24.0...v0.25.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c2689b1b4b"><code>c2689b1</code></a>
github: Use Dependabot to keep Actions updated (<a
href="https://redirect.github.com/hashicorp/terraform-json/issues/160">#160</a>)</li>
<li><a
href="6bc20aac0e"><code>6bc20aa</code></a>
Add identity fields to Plan struct (<a
href="https://redirect.github.com/hashicorp/terraform-json/issues/158">#158</a>)</li>
<li><a
href="b5939fa6c3"><code>b5939fa</code></a>
Update CODEOWNERS (<a
href="https://redirect.github.com/hashicorp/terraform-json/issues/159">#159</a>)</li>
<li><a
href="c370ee72fd"><code>c370ee7</code></a>
Update owner field in catalog-info.yaml (<a
href="https://redirect.github.com/hashicorp/terraform-json/issues/157">#157</a>)</li>
<li><a
href="0b330eb970"><code>0b330eb</code></a>
build(deps): Bump workflows to latest trusted versions (<a
href="https://redirect.github.com/hashicorp/terraform-json/issues/156">#156</a>)</li>
<li><a
href="f86d5e36f4"><code>f86d5e3</code></a>
Update state and provider JSON with identity fields (<a
href="https://redirect.github.com/hashicorp/terraform-json/issues/155">#155</a>)</li>
<li><a
href="4d6dac0a34"><code>4d6dac0</code></a>
Bump github.com/google/go-cmp from 0.6.0 to 0.7.0 (<a
href="https://redirect.github.com/hashicorp/terraform-json/issues/154">#154</a>)</li>
<li><a
href="323ee613da"><code>323ee61</code></a>
Merge pull request <a
href="https://redirect.github.com/hashicorp/terraform-json/issues/153">#153</a>
from hashicorp/tsccr-auto-pinning/trusted/2025-02-03</li>
<li><a
href="2eb7d113bc"><code>2eb7d11</code></a>
Result of tsccr-helper -log-level=info gha update -latest .github/</li>
<li><a
href="0169f43a11"><code>0169f43</code></a>
Bump github.com/zclconf/go-cty from 1.16.1 to 1.16.2 (<a
href="https://redirect.github.com/hashicorp/terraform-json/issues/152">#152</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/hashicorp/terraform-json/compare/v0.24.0...v0.25.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/hashicorp/terraform-json&package-manager=go_modules&previous-version=0.24.0&new-version=0.25.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 this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-19 13:47:12 +00:00
dependabot[bot]
9367ef1663 chore: bump cloud.google.com/go/compute/metadata from 0.6.0 to 0.7.0 (#17913)
Bumps
[cloud.google.com/go/compute/metadata](https://github.com/googleapis/google-cloud-go)
from 0.6.0 to 0.7.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/google-cloud-go/releases">cloud.google.com/go/compute/metadata's
releases</a>.</em></p>
<blockquote>
<h2>compute/metadata: v0.7.0</h2>
<h2><a
href="https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.6.0...compute/metadata/v0.7.0">0.7.0</a>
(2025-05-13)</h2>
<h3>Features</h3>
<ul>
<li><strong>compute/metadata:</strong> Allow canceling GCE detection (<a
href="https://redirect.github.com/googleapis/google-cloud-go/issues/11786">#11786</a>)
(<a
href="78100fe7e2">78100fe</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md">cloud.google.com/go/compute/metadata's
changelog</a>.</em></p>
<blockquote>
<h2>v0.7.0</h2>
<ul>
<li>Release of a client library for Spanner. See
the
<a
href="https://cloudplatform.googleblog.com/2017/02/introducing-Cloud-Spanner-a-global-database-service-for-mission-critical-applications.html">blog
post</a>.
Note that although the Spanner service is beta, the Go client library is
alpha.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2e6a95edb1"><code>2e6a95e</code></a>
pubsub: fix flaky streaming retry test</li>
<li><a
href="581b8393c3"><code>581b839</code></a>
pubsub: check early if streaming iterator is already drained</li>
<li><a
href="cc13a9bec5"><code>cc13a9b</code></a>
spanner: fix time.Time comparisons for upcoming Go1.9 monotonic
times</li>
<li><a
href="1ba9ec4b19"><code>1ba9ec4</code></a>
spanner: remove most logging from tests</li>
<li><a
href="11737a05a4"><code>11737a0</code></a>
spanner: skip some tests in short mode</li>
<li><a
href="7bcba8ac93"><code>7bcba8a</code></a>
datastore: DRY up loading entity code</li>
<li><a
href="df9740f981"><code>df9740f</code></a>
regenerate toolkit client</li>
<li><a
href="960c7688c8"><code>960c768</code></a>
trace: export tracing scopes</li>
<li><a
href="8b0ab476b1"><code>8b0ab47</code></a>
logadmin: retry on CreateMetric and UpdateMetric</li>
<li><a
href="20666962de"><code>2066696</code></a>
trace: clarify how gRPC options work</li>
<li>Additional commits viewable in <a
href="https://github.com/googleapis/google-cloud-go/compare/v0.6.0...v0.7.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cloud.google.com/go/compute/metadata&package-manager=go_modules&previous-version=0.6.0&new-version=0.7.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 this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-19 13:27:13 +00:00