Compare commits

..

1216 Commits

Author SHA1 Message Date
gcp-cherry-pick-bot[bot] 6125358569 fix: fetch custom roles from workspace agent context (cherry-pick #16237) (#16246)
Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
2025-01-23 14:23:12 -06:00
gcp-cherry-pick-bot[bot] 803e2c7679 fix: change precedence order between coder_workspace_tags and request_tags (#16239)
Co-authored-by: Cian Johnston <cian@coder.com>
2025-01-23 14:19:04 -06:00
gcp-cherry-pick-bot[bot] bd6f4266a7 fix: return first workspace agent script timing per script (cherry-pick #16203) (#16208)
Co-authored-by: Danielle Maywood <danielle@themaywoods.com>
Fixes https://github.com/coder/coder/issues/16124
2025-01-21 21:06:30 +05:00
Phorcys 075269a94e fix(examples/templates/docker): persist /home/coder instead of /home/${local.user} (#16190)
Backport of #16189, which is a fix for #16188
2025-01-19 08:42:35 +05:00
Ben Potter a5a7326415 chore: add cherry picks for v2.18.3 (#16187)
fixes #16182

<img width="1177" alt="Screenshot 2025-01-17 at 23 20 04"
src="https://github.com/user-attachments/assets/e0eec4bb-6b50-45e9-a27b-d3a89552562a"
/>
<img width="1163" alt="Screenshot 2025-01-17 at 23 20 12"
src="https://github.com/user-attachments/assets/d8a7129c-0240-4ef5-9f21-84cda5631366"
/>
<img width="1161" alt="Screenshot 2025-01-17 at 23 20 22"
src="https://github.com/user-attachments/assets/0ec78f3d-ec96-46a6-8def-aad4700712ac"
/>

(cherry picked from commit fbc2a73bef)

---------

Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
2025-01-18 10:21:56 -06:00
Stephen Kirby d15c4702b0 chore: add cherry-picks for patch 2.18.2 (#16061)
Co-authored-by: Cian Johnston <cian@coder.com>
Co-authored-by: Joobi S B <joobisb@gmail.com>
2025-01-07 15:05:04 -06:00
Stephen Kirby 765d99caa3 chore: cherry-pick commits for 2.18.1 (#15885)
Co-authored-by: Cian Johnston <cian@coder.com>
Co-authored-by: Eric Paulsen <ericpaulsen@coder.com>
Co-authored-by: Sas Swart <sas.swart.cdk@gmail.com>
2024-12-16 13:49:21 -06:00
Stephen Kirby c5e87690be chore: acquire lock for individual workspace transition (#15883)
When Coder is ran in High Availability mode, each Coder instance has a
lifecycle executor. These lifecycle executors are all trying to do the
same work, and whilst transactions saves us from this causing an issue,
we are still doing extra work that could be prevented.

This PR adds a `TryAcquireLock` call for each attempted workspace
transition, meaning two Coder instances shouldn't duplicate effort.

(cherry picked from commit 50ff06cc3c)

Co-authored-by: Danielle Maywood <danielle@themaywoods.com>
2024-12-16 12:01:04 -06:00
Phorcys 4097ec3a6d fix(examples/templates/aws-linux): (backport) add hashicorp/cloudinit provider (#15796)
Backport #15794
2024-12-09 19:48:59 +05:00
Jon Ayers d8651d7682 fix: remove dylib job from release workflow (#15736)
cc @ethanndickson some errors happening when trying to run the release
workflow
2024-12-03 22:51:15 +02:00
Stephen Kirby 41359ce2fd chore: add cherry-picks for release 2.18 (#15735)
Co-authored-by: Hugo Dutka <hugo@coder.com>
Co-authored-by: Sas Swart <sas.swart.cdk@gmail.com>
Co-authored-by: Spike Curtis <spike@coder.com>
Co-authored-by: Cian Johnston <cian@coder.com>
2024-12-03 13:58:07 -06:00
Jon Ayers 45d9274aca chore: disable parallelization when running security action (#15666)
- `make -j` appears to be broken for clean builds
2024-11-26 23:35:51 +02:00
Muhammad Atif Ali a9195bfe74 docs: add Amazon DCV Windows module to guides (#15610) 2024-11-26 21:41:22 +05:00
Muhammad Atif Ali 35594bb7fd chore: update testify to v1.9.0 in go.sum (#15662) 2024-11-26 12:41:20 +00:00
dependabot[bot] 84395730dc chore: bump github.com/mocktools/go-smtp-mock/v2 from 2.3.0 to 2.4.0 (#15644)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-26 16:26:59 +05:00
dependabot[bot] 0239507ee2 chore: bump github.com/gohugoio/hugo from 0.138.0 to 0.139.2 (#15646)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-26 16:26:08 +05:00
dependabot[bot] db6d345516 chore: bump github.com/coder/serpent from 0.9.0 to 0.10.0 (#15645)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-26 16:25:26 +05:00
dependabot[bot] ab8769e369 chore: bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#15648)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify)
from 1.9.0 to 1.10.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/stretchr/testify/releases">github.com/stretchr/testify's
releases</a>.</em></p>
<blockquote>
<h2>v1.10.0</h2>
<h2>What's Changed</h2>
<h3>Functional Changes</h3>
<ul>
<li>Add PanicAssertionFunc by <a
href="https://github.com/fahimbagar"><code>@​fahimbagar</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1337">stretchr/testify#1337</a></li>
<li>assert: deprecate CompareType by <a
href="https://github.com/dolmen"><code>@​dolmen</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1566">stretchr/testify#1566</a></li>
<li>assert: make YAML dependency pluggable via build tags by <a
href="https://github.com/dolmen"><code>@​dolmen</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1579">stretchr/testify#1579</a></li>
<li>assert: new assertion NotElementsMatch by <a
href="https://github.com/hendrywiranto"><code>@​hendrywiranto</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1600">stretchr/testify#1600</a></li>
<li>mock: in order mock calls by <a
href="https://github.com/ReyOrtiz"><code>@​ReyOrtiz</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1637">stretchr/testify#1637</a></li>
<li>Add assertion for NotErrorAs by <a
href="https://github.com/palsivertsen"><code>@​palsivertsen</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1129">stretchr/testify#1129</a></li>
<li>Record Return Arguments of a Call by <a
href="https://github.com/jayd3e"><code>@​jayd3e</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1636">stretchr/testify#1636</a></li>
<li>assert.EqualExportedValues: accepts everything by <a
href="https://github.com/redachl"><code>@​redachl</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1586">stretchr/testify#1586</a></li>
</ul>
<h3>Fixes</h3>
<ul>
<li>assert: make tHelper a type alias by <a
href="https://github.com/dolmen"><code>@​dolmen</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1562">stretchr/testify#1562</a></li>
<li>Do not get argument again unnecessarily in Arguments.Error() by <a
href="https://github.com/TomWright"><code>@​TomWright</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/820">stretchr/testify#820</a></li>
<li>Fix time.Time compare by <a
href="https://github.com/myxo"><code>@​myxo</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1582">stretchr/testify#1582</a></li>
<li>assert.Regexp: handle []byte array properly by <a
href="https://github.com/kevinburkesegment"><code>@​kevinburkesegment</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1587">stretchr/testify#1587</a></li>
<li>assert: collect.FailNow() should not panic by <a
href="https://github.com/marshall-lee"><code>@​marshall-lee</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1481">stretchr/testify#1481</a></li>
<li>mock: simplify implementation of FunctionalOptions by <a
href="https://github.com/dolmen"><code>@​dolmen</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1571">stretchr/testify#1571</a></li>
<li>mock: caller information for unexpected method call by <a
href="https://github.com/spirin"><code>@​spirin</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1644">stretchr/testify#1644</a></li>
<li>suite: fix test failures by <a
href="https://github.com/stevenh"><code>@​stevenh</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1421">stretchr/testify#1421</a></li>
<li>Fix issue <a
href="https://redirect.github.com/stretchr/testify/issues/1662">#1662</a>
(comparing infs should fail) by <a
href="https://github.com/ybrustin"><code>@​ybrustin</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1663">stretchr/testify#1663</a></li>
<li>NotSame should fail if args are not pointers <a
href="https://redirect.github.com/stretchr/testify/issues/1661">#1661</a>
by <a href="https://github.com/sikehish"><code>@​sikehish</code></a> in
<a
href="https://redirect.github.com/stretchr/testify/pull/1664">stretchr/testify#1664</a></li>
<li>Increase timeouts in Test_Mock_Called_blocks to reduce flakiness in
CI by <a href="https://github.com/sikehish"><code>@​sikehish</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1667">stretchr/testify#1667</a></li>
<li>fix: compare functional option names for indirect calls by <a
href="https://github.com/arjun-1"><code>@​arjun-1</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1626">stretchr/testify#1626</a></li>
</ul>
<h3>Documantation, Build &amp; CI</h3>
<ul>
<li>.gitignore: ignore &quot;go test -c&quot; binaries by <a
href="https://github.com/dolmen"><code>@​dolmen</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1565">stretchr/testify#1565</a></li>
<li>mock: improve doc by <a
href="https://github.com/dolmen"><code>@​dolmen</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1570">stretchr/testify#1570</a></li>
<li>mock: fix FunctionalOptions docs by <a
href="https://github.com/snirye"><code>@​snirye</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1433">stretchr/testify#1433</a></li>
<li>README: link out to the excellent testifylint by <a
href="https://github.com/brackendawson"><code>@​brackendawson</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1568">stretchr/testify#1568</a></li>
<li>assert: fix typo in comment by <a
href="https://github.com/JohnEndson"><code>@​JohnEndson</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1580">stretchr/testify#1580</a></li>
<li>Correct the EventuallyWithT and EventuallyWithTf example by <a
href="https://github.com/JonCrowther"><code>@​JonCrowther</code></a> in
<a
href="https://redirect.github.com/stretchr/testify/pull/1588">stretchr/testify#1588</a></li>
<li>CI: bump softprops/action-gh-release from 1 to 2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1575">stretchr/testify#1575</a></li>
<li>mock: document more alternatives to deprecated
AnythingOfTypeArgument by <a
href="https://github.com/dolmen"><code>@​dolmen</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1569">stretchr/testify#1569</a></li>
<li>assert: Correctly document EqualValues behavior by <a
href="https://github.com/brackendawson"><code>@​brackendawson</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1593">stretchr/testify#1593</a></li>
<li>fix: grammar in godoc by <a
href="https://github.com/miparnisari"><code>@​miparnisari</code></a> in
<a
href="https://redirect.github.com/stretchr/testify/pull/1607">stretchr/testify#1607</a></li>
<li>.github/workflows: Run tests for Go 1.22 by <a
href="https://github.com/HaraldNordgren"><code>@​HaraldNordgren</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1629">stretchr/testify#1629</a></li>
<li>Document suite's lack of support for t.Parallel by <a
href="https://github.com/brackendawson"><code>@​brackendawson</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1645">stretchr/testify#1645</a></li>
<li>assert: fix typos in comments by <a
href="https://github.com/alexandear"><code>@​alexandear</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1650">stretchr/testify#1650</a></li>
<li>mock: fix doc comment for NotBefore by <a
href="https://github.com/alexandear"><code>@​alexandear</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1651">stretchr/testify#1651</a></li>
<li>Generate better comments for require package by <a
href="https://github.com/Neokil"><code>@​Neokil</code></a> in <a
href="https://redirect.github.com/stretchr/testify/pull/1610">stretchr/testify#1610</a></li>
<li>README: replace Testify V2 notice with <a
href="https://github.com/dolmen"><code>@​dolmen</code></a>'s V2
manifesto by <a
href="https://github.com/hendrywiranto"><code>@​hendrywiranto</code></a>
in <a
href="https://redirect.github.com/stretchr/testify/pull/1518">stretchr/testify#1518</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/fahimbagar"><code>@​fahimbagar</code></a> made
their first contribution in <a
href="https://redirect.github.com/stretchr/testify/pull/1337">stretchr/testify#1337</a></li>
<li><a href="https://github.com/TomWright"><code>@​TomWright</code></a>
made their first contribution in <a
href="https://redirect.github.com/stretchr/testify/pull/820">stretchr/testify#820</a></li>
<li><a href="https://github.com/snirye"><code>@​snirye</code></a> made
their first contribution in <a
href="https://redirect.github.com/stretchr/testify/pull/1433">stretchr/testify#1433</a></li>
<li><a href="https://github.com/myxo"><code>@​myxo</code></a> made their
first contribution in <a
href="https://redirect.github.com/stretchr/testify/pull/1582">stretchr/testify#1582</a></li>
<li><a
href="https://github.com/JohnEndson"><code>@​JohnEndson</code></a> made
their first contribution in <a
href="https://redirect.github.com/stretchr/testify/pull/1580">stretchr/testify#1580</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/stretchr/testify/commit/89cbdd9e7b39eb58896d316a7495597d3aba4371"><code>89cbdd9</code></a>
Merge pull request <a
href="https://redirect.github.com/stretchr/testify/issues/1626">#1626</a>
from arjun-1/fix-functional-options-diff-indirect-calls</li>
<li><a
href="https://github.com/stretchr/testify/commit/07bac606be2191ae89a281195e58d01e0de7b5f8"><code>07bac60</code></a>
Merge pull request <a
href="https://redirect.github.com/stretchr/testify/issues/1667">#1667</a>
from sikehish/flaky</li>
<li><a
href="https://github.com/stretchr/testify/commit/716de8dff46ed7ae3c6ebb7a6124db741ba7c018"><code>716de8d</code></a>
Increase timeouts in Test_Mock_Called_blocks to reduce flakiness in
CI</li>
<li><a
href="https://github.com/stretchr/testify/commit/118fb8346630c192421c8914848381af9d4412a7"><code>118fb83</code></a>
NotSame should fail if args are not pointers <a
href="https://redirect.github.com/stretchr/testify/issues/1661">#1661</a>
(<a
href="https://redirect.github.com/stretchr/testify/issues/1664">#1664</a>)</li>
<li><a
href="https://github.com/stretchr/testify/commit/7d99b2b43d8f60a8982a78cde6e8bd287dea5da0"><code>7d99b2b</code></a>
attempt 2</li>
<li><a
href="https://github.com/stretchr/testify/commit/05f87c016035811e6d8371f1887ec360c318f53f"><code>05f87c0</code></a>
more similar</li>
<li><a
href="https://github.com/stretchr/testify/commit/ea7129e00694592e20cb34c58a6b8a251418b9da"><code>ea7129e</code></a>
better fmt</li>
<li><a
href="https://github.com/stretchr/testify/commit/a1b9c9efe3c25c50678b1e492045164b914e255f"><code>a1b9c9e</code></a>
Merge pull request <a
href="https://redirect.github.com/stretchr/testify/issues/1663">#1663</a>
from ybrustin/master</li>
<li><a
href="https://github.com/stretchr/testify/commit/8302de98b17649445fc1f1992fc3fecdb40c59ba"><code>8302de9</code></a>
Merge branch 'master' into master</li>
<li><a
href="https://github.com/stretchr/testify/commit/89352f7958086841c72425ccd6f43ab299e1309c"><code>89352f7</code></a>
Merge pull request <a
href="https://redirect.github.com/stretchr/testify/issues/1518">#1518</a>
from hendrywiranto/adjust-readme-remove-v2</li>
<li>Additional commits viewable in <a
href="https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/stretchr/testify&package-manager=go_modules&previous-version=1.9.0&new-version=1.10.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>
2024-11-26 16:24:27 +05:00
dependabot[bot] 9e78aaeea3 ci: bump the github-actions group with 3 updates (#15649)
Bumps the github-actions group with 3 updates:
[step-security/harden-runner](https://github.com/step-security/harden-runner),
[github/codeql-action](https://github.com/github/codeql-action) and
[aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action).

Updates `step-security/harden-runner` from 2.10.1 to 2.10.2
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/step-security/harden-runner/releases">step-security/harden-runner's
releases</a>.</em></p>
<blockquote>
<h2>v2.10.2</h2>
<h2>What's Changed</h2>
<ol>
<li>
<p>Fixes low-severity command injection weaknesses
The advisory is here: <a
href="https://github.com/step-security/harden-runner/security/advisories/GHSA-g85v-wf27-67xc">https://github.com/step-security/harden-runner/security/advisories/GHSA-g85v-wf27-67xc</a></p>
</li>
<li>
<p>Bug fix to improve detection of whether Harden-Runner is running in a
container</p>
</li>
</ol>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/step-security/harden-runner/compare/v2...v2.10.2">https://github.com/step-security/harden-runner/compare/v2...v2.10.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/step-security/harden-runner/commit/0080882f6c36860b6ba35c610c98ce87d4e2f26f"><code>0080882</code></a>
Merge pull request <a
href="https://redirect.github.com/step-security/harden-runner/issues/476">#476</a>
from step-security/rc-16</li>
<li><a
href="https://github.com/step-security/harden-runner/commit/4a3a88bbf8f2e304f84e1042472c02dce37eba82"><code>4a3a88b</code></a>
Update dist</li>
<li><a
href="https://github.com/step-security/harden-runner/commit/556aae632a6c1f630efa52e90d706218618e5f2f"><code>556aae6</code></a>
Merge pull request <a
href="https://redirect.github.com/step-security/harden-runner/issues/480">#480</a>
from h0x0er/jatin/cleanup</li>
<li><a
href="https://github.com/step-security/harden-runner/commit/6c39b8466160e86ad8606033d399fe7f4052aee1"><code>6c39b84</code></a>
chore: clean the code</li>
<li><a
href="https://github.com/step-security/harden-runner/commit/40401cf6183a0ab2dae5c7e485c1d073fe911e91"><code>40401cf</code></a>
Update for isdocker</li>
<li><a
href="https://github.com/step-security/harden-runner/commit/806ab1cccb47a439a89d5f8f85d3ea41a7fb1e4c"><code>806ab1c</code></a>
Update check for isdocker</li>
<li><a
href="https://github.com/step-security/harden-runner/commit/28468118cdb665b2214b64175253b83fcb4b25f6"><code>2846811</code></a>
update dist</li>
<li><a
href="https://github.com/step-security/harden-runner/commit/df8a07c1712fac199e8d6e78d64a46092afffa44"><code>df8a07c</code></a>
Merge pull request <a
href="https://redirect.github.com/step-security/harden-runner/issues/475">#475</a>
from h0x0er/fix-execSync</li>
<li><a
href="https://github.com/step-security/harden-runner/commit/30636fb583e59a926da2f17677e5cd3b63cf1be1"><code>30636fb</code></a>
bug fixes</li>
<li>See full diff in <a
href="https://github.com/step-security/harden-runner/compare/91182cccc01eb5e619899d80e4e971d6181294a7...0080882f6c36860b6ba35c610c98ce87d4e2f26f">compare
view</a></li>
</ul>
</details>
<br />

Updates `github/codeql-action` from 3.27.4 to 3.27.5
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/github/codeql-action/releases">github/codeql-action's
releases</a>.</em></p>
<blockquote>
<h2>v3.27.5</h2>
<h1>CodeQL Action Changelog</h1>
<p>See the <a
href="https://github.com/github/codeql-action/releases">releases
page</a> for the relevant changes to the CodeQL CLI and language
packs.</p>
<p>Note that the only difference between <code>v2</code> and
<code>v3</code> of the CodeQL Action is the node version they support,
with <code>v3</code> running on node 20 while we continue to release
<code>v2</code> to support running on node 16. For example
<code>3.22.11</code> was the first <code>v3</code> release and is
functionally identical to <code>2.22.11</code>. This approach ensures an
easy way to track exactly which features are included in different
versions, indicated by the minor and patch version numbers.</p>
<h2>3.27.5 - 19 Nov 2024</h2>
<p>No user facing changes.</p>
<p>See the full <a
href="https://github.com/github/codeql-action/blob/v3.27.5/CHANGELOG.md">CHANGELOG.md</a>
for more information.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/github/codeql-action/blob/main/CHANGELOG.md">github/codeql-action's
changelog</a>.</em></p>
<blockquote>
<h1>CodeQL Action Changelog</h1>
<p>See the <a
href="https://github.com/github/codeql-action/releases">releases
page</a> for the relevant changes to the CodeQL CLI and language
packs.</p>
<p>Note that the only difference between <code>v2</code> and
<code>v3</code> of the CodeQL Action is the node version they support,
with <code>v3</code> running on node 20 while we continue to release
<code>v2</code> to support running on node 16. For example
<code>3.22.11</code> was the first <code>v3</code> release and is
functionally identical to <code>2.22.11</code>. This approach ensures an
easy way to track exactly which features are included in different
versions, indicated by the minor and patch version numbers.</p>
<h2>[UNRELEASED]</h2>
<p>No user facing changes.</p>
<h2>3.27.5 - 19 Nov 2024</h2>
<p>No user facing changes.</p>
<h2>3.27.4 - 14 Nov 2024</h2>
<p>No user facing changes.</p>
<h2>3.27.3 - 12 Nov 2024</h2>
<p>No user facing changes.</p>
<h2>3.27.2 - 12 Nov 2024</h2>
<ul>
<li>Fixed an issue where setting up the CodeQL tools would sometimes
fail with the message &quot;Invalid value 'undefined' for header
'authorization'&quot;. <a
href="https://redirect.github.com/github/codeql-action/pull/2590">#2590</a></li>
</ul>
<h2>3.27.1 - 08 Nov 2024</h2>
<ul>
<li>The CodeQL Action now downloads bundles compressed using Zstandard
on GitHub Enterprise Server when using Linux or macOS runners. This
speeds up the installation of the CodeQL tools. This feature is already
available to GitHub.com users. <a
href="https://redirect.github.com/github/codeql-action/pull/2573">#2573</a></li>
<li>Update default CodeQL bundle version to 2.19.3. <a
href="https://redirect.github.com/github/codeql-action/pull/2576">#2576</a></li>
</ul>
<h2>3.27.0 - 22 Oct 2024</h2>
<ul>
<li>Bump the minimum CodeQL bundle version to 2.14.6. <a
href="https://redirect.github.com/github/codeql-action/pull/2549">#2549</a></li>
<li>Fix an issue where the <code>upload-sarif</code> Action would fail
with &quot;upload-sarif post-action step failed: Input required and not
supplied: token&quot; when called in a composite Action that had a
different set of inputs to the ones expected by the
<code>upload-sarif</code> Action. <a
href="https://redirect.github.com/github/codeql-action/pull/2557">#2557</a></li>
<li>Update default CodeQL bundle version to 2.19.2. <a
href="https://redirect.github.com/github/codeql-action/pull/2552">#2552</a></li>
</ul>
<h2>3.26.13 - 14 Oct 2024</h2>
<p>No user facing changes.</p>
<h2>3.26.12 - 07 Oct 2024</h2>
<ul>
<li>
<p><em>Upcoming breaking change</em>: Add a deprecation warning for
customers using CodeQL version 2.14.5 and earlier. These versions of
CodeQL were discontinued on 24 September 2024 alongside GitHub
Enterprise Server 3.10, and will be unsupported by CodeQL Action
versions 3.27.0 and later and versions 2.27.0 and later. <a
href="https://redirect.github.com/github/codeql-action/pull/2520">#2520</a></p>
<ul>
<li>
<p>If you are using one of these versions, please update to CodeQL CLI
version 2.14.6 or later. For instance, if you have specified a custom
version of the CLI using the 'tools' input to the 'init' Action, you can
remove this input to use the default version.</p>
</li>
<li>
<p>Alternatively, if you want to continue using a version of the CodeQL
CLI between 2.13.5 and 2.14.5, you can replace
<code>github/codeql-action/*@v3</code> by
<code>github/codeql-action/*@v3.26.11</code> and
<code>github/codeql-action/*@v2</code> by
<code>github/codeql-action/*@v2.26.11</code> in your code scanning
workflow to ensure you continue using this version of the CodeQL
Action.</p>
</li>
</ul>
</li>
</ul>
<h2>3.26.11 - 03 Oct 2024</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/github/codeql-action/commit/f09c1c0a94de965c15400f5634aa42fac8fb8f88"><code>f09c1c0</code></a>
Merge pull request <a
href="https://redirect.github.com/github/codeql-action/issues/2616">#2616</a>
from github/update-v3.27.5-a6c8729a5</li>
<li><a
href="https://github.com/github/codeql-action/commit/67b73eaba559c7e6913377065b0362ccbfc94e87"><code>67b73ea</code></a>
Update changelog for v3.27.5</li>
<li><a
href="https://github.com/github/codeql-action/commit/a6c8729a5d7573eb8d440e52a9645ce4db61d97c"><code>a6c8729</code></a>
Merge pull request <a
href="https://redirect.github.com/github/codeql-action/issues/2614">#2614</a>
from github/marcogario/per-platform-proxy</li>
<li><a
href="https://github.com/github/codeql-action/commit/8f3b48727ff1b076c28967a258b95fcee30a3a48"><code>8f3b487</code></a>
Start-proxy: Fetch OS specific binary</li>
<li><a
href="https://github.com/github/codeql-action/commit/cba5fb58d4f85affaf03eb9da32f5b6c9d76838b"><code>cba5fb5</code></a>
Merge pull request <a
href="https://redirect.github.com/github/codeql-action/issues/2613">#2613</a>
from github/dependabot/npm_and_yarn/npm_and_yarn-018...</li>
<li><a
href="https://github.com/github/codeql-action/commit/e782c3a145d9946aba8fa390e406acbe4e4c05c5"><code>e782c3a</code></a>
Merge pull request <a
href="https://redirect.github.com/github/codeql-action/issues/2612">#2612</a>
from github/angelapwen/report-linux-runner-release</li>
<li><a
href="https://github.com/github/codeql-action/commit/db6788195b646f87b3d1c616b0c14a6d5b7fa9a6"><code>db67881</code></a>
Update checked-in dependencies</li>
<li><a
href="https://github.com/github/codeql-action/commit/ecde4d232d18cf2dba6c1a6b76810332abff736f"><code>ecde4d2</code></a>
Bump cross-spawn from 7.0.3 to 7.0.6 in the npm_and_yarn group</li>
<li><a
href="https://github.com/github/codeql-action/commit/e3c67a01d31d9c173ba5ffccc9d0f275540d99de"><code>e3c67a0</code></a>
Merge pull request <a
href="https://redirect.github.com/github/codeql-action/issues/2610">#2610</a>
from github/dependabot/npm_and_yarn/npm-d2ca52e617</li>
<li><a
href="https://github.com/github/codeql-action/commit/f9ada54538b47b6db28c4d11f53848689968909e"><code>f9ada54</code></a>
Telemetry: report OS release for GitHub-hosted Linux runners</li>
<li>Additional commits viewable in <a
href="https://github.com/github/codeql-action/compare/ea9e4e37992a54ee68a9622e985e60c8e8f12d9f...f09c1c0a94de965c15400f5634aa42fac8fb8f88">compare
view</a></li>
</ul>
</details>
<br />

Updates `aquasecurity/trivy-action` from 0.28.0 to 0.29.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/aquasecurity/trivy-action/releases">aquasecurity/trivy-action's
releases</a>.</em></p>
<blockquote>
<h2>v0.29.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat: Allow skipping setup by <a
href="https://github.com/rvesse"><code>@​rvesse</code></a> in <a
href="https://redirect.github.com/aquasecurity/trivy-action/pull/414">aquasecurity/trivy-action#414</a></li>
<li>Fix oras command not found in &quot;Update Trivy Cache&quot; action
by <a href="https://github.com/Tiryoh"><code>@​Tiryoh</code></a> in <a
href="https://redirect.github.com/aquasecurity/trivy-action/pull/413">aquasecurity/trivy-action#413</a></li>
<li>Update README.md by <a
href="https://github.com/simar7"><code>@​simar7</code></a> in <a
href="https://redirect.github.com/aquasecurity/trivy-action/pull/420">aquasecurity/trivy-action#420</a></li>
<li>feat: add token for <code>setup-trivy</code> by <a
href="https://github.com/DmitriyLewen"><code>@​DmitriyLewen</code></a>
in <a
href="https://redirect.github.com/aquasecurity/trivy-action/pull/421">aquasecurity/trivy-action#421</a></li>
<li>fix: bump <code>setup-trivy</code> and add new <code>contrib</code>
directory path info by <a
href="https://github.com/DmitriyLewen"><code>@​DmitriyLewen</code></a>
in <a
href="https://redirect.github.com/aquasecurity/trivy-action/pull/424">aquasecurity/trivy-action#424</a></li>
<li>docs: remove ignore-unfixed from IaC scan example by <a
href="https://github.com/nikpivkin"><code>@​nikpivkin</code></a> in <a
href="https://redirect.github.com/aquasecurity/trivy-action/pull/429">aquasecurity/trivy-action#429</a></li>
<li>chore(deps): Bump trivy to v0.57.1 by <a
href="https://github.com/simar7"><code>@​simar7</code></a> in <a
href="https://redirect.github.com/aquasecurity/trivy-action/pull/434">aquasecurity/trivy-action#434</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/rvesse"><code>@​rvesse</code></a> made
their first contribution in <a
href="https://redirect.github.com/aquasecurity/trivy-action/pull/414">aquasecurity/trivy-action#414</a></li>
<li><a href="https://github.com/Tiryoh"><code>@​Tiryoh</code></a> made
their first contribution in <a
href="https://redirect.github.com/aquasecurity/trivy-action/pull/413">aquasecurity/trivy-action#413</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/aquasecurity/trivy-action/compare/0.28.0...0.29.0">https://github.com/aquasecurity/trivy-action/compare/0.28.0...0.29.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/aquasecurity/trivy-action/commit/18f2510ee396bbf400402947b394f2dd8c87dbb0"><code>18f2510</code></a>
chore(deps): Bump trivy to v0.57.1 (<a
href="https://redirect.github.com/aquasecurity/trivy-action/issues/434">#434</a>)</li>
<li><a
href="https://github.com/aquasecurity/trivy-action/commit/93941cebba762da4c91a91883859bf1bfb221c73"><code>93941ce</code></a>
docs: remove ignore-unfixed from IaC scan example (<a
href="https://redirect.github.com/aquasecurity/trivy-action/issues/429">#429</a>)</li>
<li><a
href="https://github.com/aquasecurity/trivy-action/commit/d2a392a13760cb64cb6bbd31d4bed2a7d9a5298d"><code>d2a392a</code></a>
fix: bump <code>setup-trivy</code> and add new <code>contrib</code>
directory path info (<a
href="https://redirect.github.com/aquasecurity/trivy-action/issues/424">#424</a>)</li>
<li><a
href="https://github.com/aquasecurity/trivy-action/commit/ee8934673cc18947baf4b05c01c4100ff36648da"><code>ee89346</code></a>
feat: add token for <code>setup-trivy</code> (<a
href="https://redirect.github.com/aquasecurity/trivy-action/issues/421">#421</a>)</li>
<li><a
href="https://github.com/aquasecurity/trivy-action/commit/cf990b19d84bbbe1eb8833659989a7c1029132e3"><code>cf990b1</code></a>
Update README.md (<a
href="https://redirect.github.com/aquasecurity/trivy-action/issues/420">#420</a>)</li>
<li><a
href="https://github.com/aquasecurity/trivy-action/commit/bff40be51b9207cf8f2148d628a9836cc7370247"><code>bff40be</code></a>
docs: Fix oras command not found (<a
href="https://redirect.github.com/aquasecurity/trivy-action/issues/413">#413</a>)</li>
<li><a
href="https://github.com/aquasecurity/trivy-action/commit/fc1500abdcdc9fc681e98d8912a52fa70dbc67de"><code>fc1500a</code></a>
feat: Allow skipping setup (<a
href="https://redirect.github.com/aquasecurity/trivy-action/issues/414">#414</a>)</li>
<li>See full diff in <a
href="https://github.com/aquasecurity/trivy-action/compare/915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2...18f2510ee396bbf400402947b394f2dd8c87dbb0">compare
view</a></li>
</ul>
</details>
<br />


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>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-26 16:24:10 +05:00
Hugo Dutka 83c493e832 chore: fix more flaky tests on Windows with Postgres (#15629)
Addresses the following flakes:

- https://github.com/coder/internal/issues/222
- https://github.com/coder/internal/issues/223
- https://github.com/coder/internal/issues/224
- https://github.com/coder/internal/issues/225
- https://github.com/coder/internal/issues/226
- https://github.com/coder/internal/issues/227
- https://github.com/coder/internal/issues/228
- https://github.com/coder/internal/issues/229
- https://github.com/coder/internal/issues/230
2024-11-26 11:56:07 +01:00
Dean Sheather 06c99793f4 chore: add csharp_namespace to vpn.proto (#15634) 2024-11-26 19:58:18 +10:00
Vincent Vielle 8afb10e090 chore: improve validation of Security tag in swaggerparser (#15660)
Aims to resolve #15605 

There's currently one option valid for the `@Security` tag in
swaggerparser - which fails in the CI if we try to put any other value.

At least one of our endpoints does not accept `CoderSessionToken` as an
option for the authentication and so we need to add new possibilities in
order to keep the documentation up-to-date.

In this PR , I added `ProvisionerKey` which is the way our provisioner
daemon can authenticate to the backend - also modified a bit the code to
simplify other options later.
2024-11-26 07:19:43 +01:00
Vincent Vielle 60ddcf5de2 chore: improve testing coverage on ExtractProvisionerDaemonAuthenticated middleware (#15622)
This one aims to resolve #15604 

Created some table tests for the main cases - 
also preferred to create two isolated cases for the most complicated
cases in order to keep table tests simple enough.

Give us full coverage on the middleware logic, for both optional and non
optional cases - PSK and ProvisionerKey.
2024-11-26 04:02:20 +01:00
Eric Paulsen d60b58874e fix: update /builds transition example (#15657) 2024-11-26 00:52:23 +00:00
Cian Johnston e550365e35 chore(docs): update documentation for coder_workspace_tags (#15620)
Adds documentation relating to
https://github.com/coder/coder/issues/15087 and
https://github.com/coder/coder/issues/15427

See also: https://github.com/coder/coder/pull/15578
2024-11-25 21:01:18 +00:00
Danielle Maywood 0896f339c4 refactor(coderd/provisionerdserver): use quartz.Clock instead of TimeNowFn (#15642)
Replace `TimeNowFn` in `provisionerdserver` with `quartz.Clock` as
well as pass `coderd`'s `Clock` to `provisionerdserver`.
2024-11-25 16:25:36 +00:00
Jon Ayers bbc549d2df feat: add agent exec pkg (#15577) 2024-11-25 17:22:12 +02:00
Cian Johnston 7876dc5fb1 feat(helm/provisioner): support deploying multiple provisioners in same namespace (#15637)
Fixes https://github.com/coder/coder/issues/15437

- Adds support for `coder.serviceAccount.disableCreate` (originally
added to `helm/coder` in https://github.com/coder/coder/pull/14817).
- Adds documentation and examples in `helm/provisioner/README.md` on
deploying multiple provisioners in the same namespace leveraging
`nameOverride`.
2024-11-25 14:23:37 +00:00
Spike Curtis e6506f0679 feat: change port-forward to opportunistically listen on IPv6 (#15640)
If the local IP address is not explicitly set, previously we assumed 127.0.0.1 (that is, IPv4 only localhost). This PR adds support to opportunistically _also_ listen on IPv6 ::1.
2024-11-25 16:33:28 +04:00
Cian Johnston 1cdc3e8921 feat!: extract provisioner tags from coder_workspace_tags data source (#15578)
Relates to https://github.com/coder/coder/issues/15087 and
https://github.com/coder/coder/issues/15427

- Extracts provisioner job tags from `coder_workspace_tags` on template
version creation using `provisioner/terraform/tfparse` added in
https://github.com/coder/coder/pull/15236
- Drops a WARN log in coderd if no matching provisioners found.
- Also drops a warning message in the CLI if no provisioners are found.
- To support both CLI and UI warnings, added a
`codersdk.MatchedProvisioners` struct to the `TemplateVersion` response
containing details of how many provisioners were around at the time of
the insert.

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-11-25 11:19:14 +00:00
Spike Curtis 648cdd006c fix: fix parsing of IPv6 addresses in coder port-forward (#15627)
fixes: #15561

Fixes parsing of IPv6 local addresses on `coder port-forward`
2024-11-25 14:06:59 +04:00
Vincent Vielle a8becfb7a4 fix: improve log on provisioner daemon started with pk (#15588)
Resolve #15126 

This PR aims to fetch the provisioned key details when starting a
provisioned daemon - for now in order to access the tags associated to
the provisioned key and display them accordingly in the starting logs.

We do not want to change any other logic inside this PR as it was
already working as expected.
2024-11-25 10:11:27 +01:00
Kayla Washburn-Love 32b4b77c45 fix: use ExternalImage for external auth providers (#15572) 2024-11-22 15:24:18 -07:00
Bruno Quaresma f3e1dd8d1c fix: deduplicate agent script timings (#15631)
Related to https://github.com/coder/coder/issues/15413
2024-11-22 14:29:31 -03:00
Toshiki Shimomura e87b0bb455 fix(site): set min and max attributes for workspace number parameters (#15182)
Implements #14532.

This PR sets `min` and `max` attributes for workspace number parameter
`<input>` elements using
[inputProps](https://mui.com/material-ui/api/text-field/#text-field-prop-inputProps).

Note: When we update MUI to v6 or later, it is better to use
`slotProps.htmlInput` instead.

---------

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-11-22 09:50:22 -06:00
dependabot[bot] e3cc3be718 chore: bump google.golang.org/api from 0.205.0 to 0.209.0 (#15628)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-22 18:58:12 +05:00
Ethan 45f7d77d6f fix(site): remove hard-coded activity bump label (#15583)
Closes #15536.

The setting description is already dynamically set correctly, and I
don't believe it warrants repeating.


![image](https://github.com/user-attachments/assets/467b2ef3-468a-4634-819f-98f36c86b5ab)
2024-11-22 23:48:23 +11:00
dependabot[bot] e3082f1bdc chore: bump cross-spawn from 6.0.5 to 6.0.6 in /scripts/apidocgen (#15599)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-22 17:46:44 +05:00
Ethan a35c01de54 fix(site): show error on template upload failure (#15558)
Closes #15441.
2024-11-22 23:46:21 +11:00
Spike Curtis b5fbfd727c fix: fix hang in teardown of TestConn_CoordinatorRollingRestart (#15624)
fixes a flake seen on main: https://github.com/coder/coder/actions/runs/11967210463/job/33364072261

the TCP echo server had a waitgroup to ensure that all accepted connections get torn down, but no explicit teardown of the connection. We depended on the tailnet agent closing its side of the connection, which depends on closing the tunneled connection. The tunneled `FIN` could race with tearing down the tunnel itself.

So, this PR adds explicit `t.Cleanup` to close the echo connection. It also removes the waitgroup. The purpose of the waitgroup was to ensure that all goroutines created by the echo listener get shut down, but we have `goleak` for that, which fails much faster than the 20 minutes this test run took.
2024-11-22 11:44:56 +04:00
Spike Curtis 103824f726 fix: fix panic while tearing down reconnecting PTY (#15615)
fixes https://github.com/coder/internal/issues/221

Fixes an issue where two goroutines were sharing the `err` variable, leading to a data race where we'd fail to process the error and then nil-pointer panic.

I ended up refactoring reconnecting PTY stuff into the `reconnectingpty` package, instead of having it on the agent.  That `createTailnet` routine had waaay too many deeply nested goroutines, which is I'm sure a big contributor to the bug appearing in the first place.
2024-11-22 09:46:25 +04:00
Edward Angert 684e75e2a7 docs: create a markdown code snippet file to make it easier for contributors (#15611)
adds snippets to make some of the docs markdown components a little
easier to use

- wraps selected text where it seems appropriate
- limits code block languages (these are suggestions, you can choose
from the list or enter anything)

tabs example:

![tabs
gif](https://github.com/user-attachments/assets/226b942e-4b34-4d3b-8561-84c5a17e2805)

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-21 22:09:56 +00:00
Steven Masley 26438aa91f chore: implement OIDCClaimFieldValues for idp sync mappings auto complete (#15576)
When creating IDP sync mappings, these are the values that can be
selected from. These are the values that can be mapped from in
org/group/role sync.
2024-11-21 13:04:00 -06:00
Steven Masley 5b7fa78676 chore: add deployment config option to append custom csp directives (#15596)
Allows adding custom static CSP directives to Coder. Niche use case but
makes this easier then creating a reverse proxy that has to replace the
header. We want to preserve our directives, so having an append option
is preferred to a "replace" option via a reverse proxy.


Closes https://github.com/coder/coder/issues/15118
2024-11-21 11:53:53 -06:00
Danny Kopping f38f746f5d chore: ensure coder is logged before querying orgs (#15618) 2024-11-21 16:04:21 +01:00
Steven Masley 78f9f43c97 chore: do not refresh tokens that have already failed refreshing (#15608)
Once a token refresh fails, we remove the `oauth_refresh_token` from the
database. This will prevent the token from hitting the IDP for
subsequent refresh attempts.

Without this change, a bad script can cause a failing token to hit a
remote IDP repeatedly with each `git` operation. With this change, after
the first hit, subsequent hits will fail locally, and never contact the
IDP.

The solution in both cases is to authenticate the external auth link. So
the resolution is the same as before.
2024-11-20 20:13:07 -06:00
Muhammad Atif Ali dcbcf6740c docs: add guide for CI/CD template testing (#15528)
Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
2024-11-20 23:58:51 +05:00
Vincent Vielle a518017a88 feat(coderd): add endpoint to fetch provisioner key details (#15505)
This PR is the first step aiming to resolve #15126 - 

Creating a new endpoint to return the details associated to a
provisioner key.

This is an authenticated endpoints aiming to be used by the provisioner
daemons - using the provisioner key as authentication method.

This endpoint is not ment to be used with PSK or User Sessions.
2024-11-20 18:04:47 +01:00
Cian Johnston 593d659ec8 chore(scripts/develop.sh): auto determine first org name and run terraform init (#15603)
Updates `develop.sh` to automatically determine the name of the 'first
org' when pushing the initial template.

Also runs `terraform init` before running `coder templates push` (pet
peeve).
2024-11-20 14:01:13 +00:00
Hugo Dutka 6ed76921dd chore: fix windows postgres tests (#15593)
Patches tests that caused Windows Postgres CI in
https://github.com/coder/coder/pull/15520 to consistently fail.

I tested this by temporarily adding Postgres Windows CI to this PR.
However, I reverted those changes to merge them with
https://github.com/coder/coder/pull/15520. For reference, here's [a
passing CI
run](https://github.com/coder/coder/actions/runs/11918816662/job/33219786238)
from an earlier commit.

**Note:** Although Windows tests now pass, they remain quite flaky. I
recommend running Postgres Windows CI to gather data on these flakes,
but I don’t think it should be a required job just yet.
2024-11-20 13:30:31 +01:00
Hugo Dutka 97ce44a77d chore: track terraform module source type in telemetry (#15590) 2024-11-20 11:03:48 +01:00
Dean Sheather fbe2fa66f5 chore: add test for coord rolling restart (#14680)
Closes https://github.com/coder/team-coconut/issues/50

---------

Co-authored-by: Ethan Dickson <ethan@coder.com>
2024-11-20 18:04:33 +11:00
Spike Curtis 9e63caf593 docs: add crypto_keys to list of dbcrypt fields (#15602)
closes: https://github.com/coder/internal/issues/220

Updates docs that talk about what db fields we encrypt.  We've recently added `crypto_keys.secret` to the list, but didn't add it to the docs.
2024-11-20 11:03:46 +04:00
Ethan 6e7f65bc59 fix(cli): properly handle build log streaming during coder ping (#15600)
Closes #15584.

- The `Collecting Diagnostics` spinner now starts after the workspace
build logs (if any) have finished streaming.
- Removes network interfaces with negative MTUs from `healthsdk`
diagnostics.
- Improves the wording on diagnostics for MTUs below the 'safe' value to
indicate that direct connections may be degraded, or rendered unusable
(i.e. if every packet is dropped).
2024-11-20 15:50:12 +11:00
Ethan 32fc844b47 chore: support building Coder Desktop .dylib (#15512)
Relates to #14734.
2024-11-20 14:13:03 +11:00
Danielle Maywood 576e1f48fe feat!: allow disabling notifications (#15509)
Resolves https://github.com/coder/coder/issues/15513

Disables notifications when both `$CODER_NOTIFICATIONS_WEBHOOK_ENDPOINT` and `$CODER_EMAIL_SMARTHOST` are unset.

Breaking change: `$CODER_EMAIL_SMARTHOST` is no longer set by default as `localhost:587`, meaning any deployments that make use of this default value will need to add it back.

---------

Co-authored-by: Danny Kopping <danny@coder.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-11-19 15:05:12 +00:00
Ethan 1c08580f23 chore(cli): use option source name for deprecation warnings (#15581)
Closes #15568.
2024-11-19 10:15:38 +00:00
Ethan e72d58b4f6 fix: guard server log lumberjack with mutex (#15582)
(Hopefully) closes https://github.com/coder/internal/issues/213.
2024-11-19 19:47:35 +11:00
Spike Curtis 029cd5d064 fix(tailnet): prevent redial after Coord graceful restart (#15586)
fixes: https://github.com/coder/internal/issues/217

> There are a couple problems:
>
> One is that we assert the RPCs succeed, but if the pipeDialer context is canceled at the end of the test, then these assertions happen after the test is officially complete, which panics and affects other tests.

This converts these to just return the error rather than assert.

> The other is that the retrier is slightly bugged: if the current retry delay is 0 AND the ctx is done, (e.g. after successfully connecting and then gracefully disconnecting), then retrier.Wait(c.ctx) is racy and could return either true or false.

Fixes the phantom redial by explicitly checking the context before dialing. Also, in the test, we assert that the controller is closed before completing the test.
2024-11-19 11:37:11 +04:00
Spike Curtis 85c3c4c025 feat(tailnet): add alias with username and short alias to DNS (#15585)
Adds DNS aliases of the form `<agent>.<workspace>.<username>.coder.` and
`<workspace>.coder.`
2024-11-19 11:23:17 +04:00
Steven Masley c3c23ed3d9 chore: add query to fetch top level idp claim fields (#15525)
Adds an api endpoint to grab all available sync field options for IDP
sync. This is for autocomplete on idp sync forms. This is required for
organization admins to have some insight into the claim fields available
when configuring group/role sync.
2024-11-18 14:31:39 -06:00
Jon Ayers 48bb452829 fix: fix tailnet resume using incorrect DB reference (#15522)
- We were instantiating a cryptokey cache with a vanilla reference to
the database instead of one wrapped by dbcrypt.
- Fixes an issue where failing to instantiate unrelated keycaches does
not fatally error out.
2024-11-18 14:09:04 -06:00
Steven Masley 4fedc7cf3d chore: include merged claims into the database (#15570)
Merging happens before IDP sync. Storing this will make some SQL queries
much simplier.
2024-11-18 11:58:19 -06:00
dependabot[bot] 097b84f27b chore: bump cross-spawn from 7.0.3 to 7.0.5 in /offlinedocs (#15553)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 19:53:19 +05:00
dependabot[bot] c803e7d6f7 chore: bump cross-spawn from 7.0.3 to 7.0.6 in /site (#15567)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 19:51:46 +05:00
dependabot[bot] 1c6cec3c43 ci: bump github/codeql-action from 3.27.1 to 3.27.4 in the github-actions group (#15563)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 19:38:29 +05:00
dependabot[bot] 36ba932c3a chore: bump github.com/go-playground/validator/v10 from 10.22.0 to 10.23.0 (#15565)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 19:38:16 +05:00
dependabot[bot] a9554a52bf chore: bump github.com/hashicorp/hcl/v2 from 2.22.0 to 2.23.0 (#15564)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 19:37:46 +05:00
Spike Curtis 1aaaad998c fix: fix listening flake on TestTailnet_ForcesWebSockets (#15555)
Fixes a test flake on TestTailnet_ForcesWebsockets like:

```
    t.go:106: 2024-11-18 07:44:25.939 [debu]  w2: dial tcp  addr_port="[fd7a:115c:a1e0:46cc:bd8e:400d:1bc6:f6ac]:35565"
    t.go:106: 2024-11-18 07:44:25.943 [debu]  w1.net.netstack: netstack: could not connect to local server at 127.0.0.1:35565 (or [::1]:35565)%!(EXTRA *net.OpError=dial tcp [::1]:35565: connect: connection refused)
    conn_test.go:146:
        	Error Trace:	/Users/spike/repos/coder/tailnet/conn_test.go:146
        	Error:      	Received unexpected error:
        	            	connect tcp [fd7a:115c:a1e0:46cc:bd8e:400d:1bc6:f6ac]:35565: connection was refused
        	Test:       	TestTailnet/ForcesWebSockets
    t.go:106: 2024-11-18 07:44:25.945 [info]  w1: closing tailnet Conn
    t.go:106: 2024-11-18 07:44:25.945 [debu]  w1: closing configMaps configLoop
    t.go:106: 2024-11-18 07:44:25.945 [debu]  w1: closing nodeUpdater updateLoop
    t.go:106: 2024-11-18 07:44:25.945 [debu]  w1: closed netstack
    conn_test.go:135:
        	Error Trace:	/Users/spike/repos/coder/tailnet/conn_test.go:135
        	            				/Users/spike/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.8.darwin-arm64/src/runtime/asm_arm64.s:1222
        	Error:      	Received unexpected error:
        	            	connection closed:
        	            	    github.com/coder/coder/v2/tailnet.init
        	            	        <autogenerated>:1
        	Test:       	TestTailnet/ForcesWebSockets
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1039771dc]

goroutine 2224 [running]:
github.com/coder/coder/v2/tailnet_test.TestTailnet.func3.2()
	/Users/spike/repos/coder/tailnet/conn_test.go:136 +0x7c
created by github.com/coder/coder/v2/tailnet_test.TestTailnet.func3 in goroutine 109
	/Users/spike/repos/coder/tailnet/conn_test.go:133 +0x7dc
```

Test didn't synchronize listening on the port before dialing it. 

It also has a nil pointer deference when the test fails, which causes a bunch of unrelated output. Also fixed.
2024-11-18 16:05:16 +04:00
Dean Sheather d63bd213f7 chore: add vpn-daemon run subcommand for windows (#15526)
`coder vpn-daemon run` will instantiate a RPC connection with the
specified pipe handles and communicate with the (yet to be implemented)
parent process.

The tests don't ensure that the tunnel is actually usable yet as the
tunnel functionality isn't implemented, but it does make sure that the
tunnel tries to read from the RPC pipe.

Closes #14735
2024-11-18 21:10:01 +10:00
Marcin Tojek 8ca8e016fa fix(site): wait until port is available in e2e (#15537)
Related: https://github.com/coder/internal/issues/212

This PR modifies the logic responsible for creating a server in E2E
tests to check if the port is free. Alternatively, we could refactor the
framework to dynamically create server instances, but this solution
might be a cheaper quick win.

Note:

I'll leave it as is now, it might be worth asking somebody with a
frontend skillset to double-check this contribution.

---------

Signed-off-by: Danny Kopping <danny@coder.com>
Co-authored-by: Danny Kopping <danny@coder.com>
2024-11-18 10:28:16 +00:00
Spike Curtis 5861e516b9 chore: add standard test logger ignoring db canceled (#15556)
Refactors our use of `slogtest` to instantiate a "standard logger" across most of our tests.  This standard logger incorporates https://github.com/coder/slog/pull/217 to also ignore database query canceled errors by default, which are a source of low-severity flakes.

Any test that has set non-default `slogtest.Options` is left alone. In particular, `coderdtest` defaults to ignoring all errors. We might consider revisiting that decision now that we have better tools to target the really common flaky Error logs on shutdown.
2024-11-18 14:09:22 +04:00
Cian Johnston 4719d2406f chore(testutil): extract testutil.CreateZip and testutil.CreateTar helpers (#15540)
Extracts `testutil.CreateTar` and `testutil.CreateZip` test helpers.
2024-11-18 09:17:04 +00:00
Phorcys f9d6698384 feat(examples/templates/azure-linux): promote module usage (#15517) 2024-11-18 13:40:12 +05:00
Spike Curtis 747f7ce173 feat: add support for WorkspaceUpdates to WebsocketDialer (#15534)
closes #14730

Adds support for WorkspaceUpdates to the WebsocketDialer. This allows us to dial the new endpoint added in #14847 and connect it up to a `tailnet.Controllers` to connect to all agents over the tailnet.

I refactored the fakeWorkspaceUpdatesProvider to a mock and moved it to `tailnettest` so it could be more easily reused.  The Mock is a little more full-featured.
2024-11-18 10:54:11 +04:00
Spike Curtis 16992ee548 feat(tailnet): add workspace updates support to Controller (#15529)
re: #14730

Adds support in `tailnet.Controller` for WorkspaceUpdates.

Also checks configured controllers against the clients returned by the dialer, so that if we connect with a dialer that doesn't support an RPC (for instance the in-memory dialer for ServerTailnet doesn't support WorkspaceUpdates), we throw an error if there is a controller expecting it.
2024-11-18 10:41:19 +04:00
Hugo Dutka aa0dc2daa1 chore: track terraform modules in telemetry (#15450)
Addresses https://github.com/coder/nexus/issues/35.

This PR:

- Adds a `workspace_modules` table to track modules used by the
Terraform provisioner in provisioner jobs.
- Adds a `module_path` column to the `workspace_resources` table,
allowing to identify which module a resource originates from.
- Starts pushing this new information into telemetry.

For the person reviewing this PR, do not fret about the 1,500 new lines
- ~1,000 of them are auto-generated.
2024-11-16 21:56:19 +01:00
Kayla Washburn-Love 968c52bc36 fix: add error that provisionerkeys require the externalprovisioners feature (#15541) 2024-11-15 14:43:32 -07:00
Steven Masley 16ade985ae chore: make scim auth header case insensitive for 'bearer' (#15538)
Fixes status codes to return more than 500. The way we were using the
package, it always returned a status code 500
2024-11-15 12:30:11 -06:00
Joobi S B 4cb807670d chore: generate countries.tsx from Go code (#15274)
Closes https://github.com/coder/coder/issues/15074

We have a hard-coded list of countries at
https://github.com/coder/coder/blob/main/site/src/pages/SetupPage/countries.tsx.
This means Go code in coder/coder doesn't have an easy way of utilizing
it.

## Solution
Generate countries.tsx from Go code. Generated by `scripts/apitypings`
2024-11-15 12:05:21 -06:00
Steven Masley aea6208515 chore: use codersdk return type, not package type (#15539) 2024-11-15 18:01:42 +00:00
Cian Johnston 12a9d6336b fix(agent): start rpty lifecycle after all reads/writes (#15535)
Fixes https://github.com/coder/internal/issues/214

#15475 missed that we also write to `rpty` after starting
`rpty.lifecycle()`.
This PR moves the function call right at the end. Hopefully this should
address the data races before we go resorting to mutexes.
2024-11-15 14:48:17 +00:00
Cian Johnston aca5be5e50 feat(provisionersdk): allow variadic tags in provisionersdk.MutateTags (#15518)
Relates to https://github.com/coder/coder/issues/15087 and
https://github.com/coder/coder/issues/15427

Allows specifying multiple sets of provisioner tags into `MutateTags`.
These tags get additively merged.

This will simplify handling tags from multiple sources when sniffing
tags from the template.
2024-11-15 12:31:02 +00:00
Sas Swart 450c72f95c chore(coderd/database): fix duplicate migration numbers (#15533) 2024-11-15 11:39:05 +00:00
Marcin Tojek 23470789f1 fix: ignore cancellation error in test (#15532)
Fixes: https://github.com/coder/internal/issues/211
2024-11-15 12:20:35 +01:00
Sas Swart dbf41a1160 chore(coderd/database): fix duplicate migration numbers (#15530)
Renaming migrations to avoid duplicate numbering
2024-11-15 10:55:47 +00:00
Sas Swart 814dd6f854 feat(coderd): update API to allow filtering provisioner daemons by tags (#15448)
This PR provides new parameters to an endpoint that will be necessary
for #15048
2024-11-15 11:33:22 +02:00
Spike Curtis 40802958e9 fix: use explicit api versions for agent and tailnet (#15508)
Bumps the Tailnet and Agent API version 2.3, and creates some extra controls and machinery around these versions.

What happened is that we accidentally shipped two new API features without bumping the version.  `ScriptCompleted` on the Agent API in Coder v2.16 and `RefreshResumeToken` on the Tailnet API in Coder v2.15.

Since we can't easily retroactively bump the versions, we'll roll these changes into API version 2.3 along with the new WorkspaceUpdates RPC, which hasn't been released yet.  That means there is some ambiguity in Coder v2.15-v2.17 about exactly what methods are supported on the Tailnet and Agent APIs.  This isn't great, but hasn't caused us major issues because 

1. RefreshResumeToken is considered optional, and clients just log and move on if the RPC isn't supported. 
2. Agents basically never get started talking to a Coderd that is older than they are, since the agent binary is normally downloaded from Coderd at workspace start.

Still it's good to get things squared away in terms of versions for SDK users and possible edge cases around client and server versions.

To mitigate against this thing happening again, this PR also:

1. adds a CODEOWNERS for the API proto packages, so I'll review changes
2. defines interface types for different API versions, and has the agent explicitly use a specific version.  That way, if you add a new method, and try to use it in the agent without thinking explicitly about versions, it won't compile.

With the protocol controllers stuff, we've sort of already abstracted the Tailnet API such that the interface type strategy won't work, but I'll work on getting the Controller to be version aware, such that it can check the API version it's getting against the controllers it has -- in a later PR.
2024-11-15 11:16:28 +04:00
Spike Curtis 916df4d411 feat: set DNS hostnames in workspace updates controller (#15507)
re: #14730

Adds support for the workspace updates protocol controller to also program DNS names for each agent.

Right now, we only program names like `myagent.myworkspace.me.coder` and `myworkspace.coder.` (if there is exactly one agent in the workspace).  We also want to support `myagent.myworkspace.username.coder.`, but for that we need to update WorkspaceUpdates RPC to also send the workspace owner's username, which will be in a separate PR.
2024-11-15 11:00:19 +04:00
Muhammad Atif Ali 365ce67f21 chore: add provenance attestation to docker-base image (#14999)
Enables [build
attestation](https://docs.docker.com/build/metadata/attestations/slsa-provenance/)
for the docker-base image.
Contributes to #14879 and coder/internal#89

As an experiment, we are only doing it with the coder-base image for
now.
2024-11-15 08:16:33 +05:00
Aaron Lehmann f1cb3a5b11 fix: correct example for /extend endpoint in the documentation (#15521)
The example in the docs wrongly shows a POST to this endpoint.

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2024-11-14 12:13:27 -05:00
Steven Masley b6d0b7713a chore: implement user link claims as a typed golang object (#15502)
Move claims from a `debug` column to an actual typed column to be used.
This does not functionally change anything, it just adds some Go typing to build
on.
2024-11-14 10:05:44 -06:00
Phorcys 6b1fafbacc feat(examples/templates/aws-linux): use modules for code-server and jetbrains (#15500) 2024-11-14 15:45:08 +01:00
Ethan b96177613b ci: fix go tests not running if examples are updated (#15514)
- https://github.com/coder/coder/pull/15504 broke CI on main because of
the aforementioned issue, this also fixes the test failure.
2024-11-14 14:20:51 +00:00
Ben Potter d3eb896543 fix: remove built-in image for Docker template (#15504)
The hardcoded image is an anti-pattern, leading to weird errors if the
`docker` group is absent. We should either provide a better error
in-product or just have a better image.

@matifali - also down to use a Devcontainers universal image instead or
make this a parameter. Let me know what you think the best "default
install" is
2024-11-14 06:40:50 -07:00
Cian Johnston bebc38ee94 feat(provisioner/terraform/tfparse): implement WorkspaceTagDefaultsFromFile (#15236)
Relates to https://github.com/coder/coder/issues/15087 and
https://github.com/coder/coder/issues/15427

Adds functionality to `provisioner/terraform/tfparse` to extract the
default values for a `coder_workspace_tags` data source from a given
file.
2024-11-14 12:24:48 +00:00
Spike Curtis 08216aaad6 feat: add workspace updates controller (#15506)
re: #14730

Adds a protocol controller for WorkspaceUpdates RPC that takes all the agents we learn about over the RPC, and programs them into the Coordination controller, so that we set up tunnels to all the agents.

Handling DNS is in a PR up the stack, as is actually wiring it up to anything.
2024-11-14 16:16:04 +04:00
Marcin Tojek e7ab3e1b6a chore: log cancellation error in test (#15511)
Related: https://github.com/coder/internal/issues/211
2024-11-14 12:47:00 +01:00
Danny Kopping cb1a006ae4 chore: add link to RBAC usage doc in README (#15510)
Some new joiners had found the README, but not the usage doc

Signed-off-by: Danny Kopping <danny@coder.com>
2024-11-14 10:01:19 +00:00
Mathias Fredriksson e55e8ee1b2 fix(cli): add backwards compat for old telemetry env and tests (#15476) 2024-11-14 01:07:52 +02:00
Steven Masley 99dd13d4cd chore: add cli command to update organization sync settings (#15459) 2024-11-13 13:44:21 -06:00
Stephen Kirby 75b299071c docs: update version flags (#15501) 2024-11-13 13:40:06 -06:00
Cian Johnston 55dccae5a3 chore(docs): document how to correctly override list(string) parameters (#15497)
- Adds documentation for how to correctly hold --parameter with list(string)
- Adds tests for the aforementioned documented correct finger positions for --parameter list(string)
2024-11-13 15:41:36 +00:00
Muhammad Atif Ali 6ff302b740 docs: add Docker to provider authentication docs (#15494)
Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
2024-11-13 15:40:41 +00:00
Cian Johnston 4a6b28f5df feat(provisioner): add support for workspace_owner_login_type (#15499)
- Adds support for the `coder_workspace_owner.login_type` attribute.
- Adds a currently disabled test for `coder_workspace_owner.login_type`
2024-11-13 15:34:58 +00:00
Cian Johnston 1c938cda4b chore(cli): exp prompt-example: add option to multi-select (#15496)
Adds a `--things` flag to our `multi-select` example prompt command.

```
go run ./cmd/coder exp prompt-example multi-select --things=Code,Bike,Potato=mashed
"Code, Bike, Potato=mashed" are nice choices.
```
2024-11-13 12:14:43 +00:00
Danielle Maywood f2fe379bd2 fix: make GetWorkspacesEligibleForTransition return less false-positives (#15429)
Relates to https://github.com/coder/coder/issues/15082

The old implementation of `GetWorkspacesEligibleForTransition` returns
many workspaces that are not actually eligible for transition. This new
implementation reduces this number significantly (at least on our
dogfood instance).
2024-11-13 10:24:20 +00:00
Ethan fa69d1ca74 ci: reenable link checker & fix broken links (#15489)
Follow-up on #15484.
2024-11-13 16:04:10 +11:00
Vincent Vielle d6442db25a feat(cli): rotate file logs for coderd (#15438)
Related to #15309 

As we already are doing for agent logs - this PR is enabling the logs
rotation for coderd logs.

Currently keeping the same logic than we had for agent - with 5MB as the
file size for rotation.
2024-11-12 21:48:32 +01:00
Edward Angert 56e219b50d docs: update template-from-scratch (#15101)
closes https://github.com/coder/internal/issues/104

- [x] update screenshots
- [x] consistent md
- [x] confirm and update `Dockerfile` and `main.tf`
   - matched up to the Docker Containers starter template
- upload template
   - [x] confirm CLI steps
   - [x] add steps in tab for Dashboard
- [x] ~confirm that the expand works~ it doesn't


<https://coder.com/docs/@template-from-scratch-update/tutorials/template-from-scratch>

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-12 14:01:51 -05:00
Edward Angert eff07a2db0 docs: clarify admin email telemetry (#15485)
add a note to the telemtery doc that explains that we do collect the
admin email


https://coder.com/docs/@telemetry-clarification/admin/setup/telemetry#what-we-collect

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-12 11:24:13 -05:00
Bruno Quaresma bebe4f06d2 chore: sort inserted users on dbmem (#15483) 2024-11-12 10:44:31 -03:00
Ethan 97b3bbf4a0 ci: disable weekly-docs temporarily (#15484)
I updated it in #15424 and it's doing suspect things to block PRs 🙃 

https://github.com/coder/coder/actions/runs/11797850940/job/32862729001?pr=15482
2024-11-12 13:41:00 +00:00
Cian Johnston 30e6fbd35c fix(coderd): ensure correct RBAC when enqueueing notifications (#15478)
- Assert rbac in fake notifications enqueuer
- Move fake notifications enqueuer to separate notificationstest package
- Update dbauthz rbac policy to allow provisionerd and autostart to create and read notification messages
- Update tests as required
2024-11-12 12:40:46 +00:00
dependabot[bot] bb5c3a2dd8 chore: bump google.golang.org/grpc from 1.67.1 to 1.68.0 (#15471)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from
1.67.1 to 1.68.0.
2024-11-12 15:14:27 +04:00
Spike Curtis d1305ac25e fix: stop logging error when template schedule query is canceled (#15402)
Fixes test flakes _a la_

```
    t.go:108: 2024-11-05 09:52:37.996 [erro]  workspacestats: failed to load template schedule bumping activity, defaulting to bumping by 60min  request_id=f14215d2-73dc-47ba-aa81-422c62f257e4  workspace_id=545d73c7-3a62-4466-8c08-b6abb12867b7  template_id=49747428-3abb-40e4-a6b2-03653e9f2506 ...
        error= fetch object:
                   github.com/coder/coder/v2/coderd/database/dbauthz.(*querier).GetTemplateByID.fetch[...].func1
                       /home/runner/work/coder/coder/coderd/database/dbauthz/dbauthz.go:497
                 - pq: canceling statement due to user request
         *** slogtest: log detected at level ERROR; TEST FAILURE ***
```

seen here on main: https://github.com/coder/coder/actions/runs/11681605747/job/32527006174
2024-11-12 15:08:15 +04:00
Ethan 6117f46706 chore: include if direct connection is over private network in ping diagnostics (#15313)
Whilst the `networking-troubleshooting` docs page already mentions that
a direct connection can be established over a private network, even if
there are no STUN servers, it's worth this is the case at the end of the
ping output.

This also removes a print statement that was dirtying up the diagnostic
output, and corrects the name of the `--disable-direct-connections`
flag.
2024-11-12 17:33:35 +11:00
dependabot[bot] c519a129fc chore: bump google.golang.org/api from 0.204.0 to 0.205.0 (#15473)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-12 06:29:04 +00:00
dependabot[bot] 4e2a46eee8 chore: bump github.com/charmbracelet/bubbletea from 1.1.0 to 1.2.1 (#15472)
Bumps
[github.com/charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea)
from 1.1.0 to 1.2.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/charmbracelet/bubbletea/releases">github.com/charmbracelet/bubbletea's
releases</a>.</em></p>
<blockquote>
<h2>v1.2.0</h2>
<h1>It’s performance boost time</h1>
<p>Sometimes you have to take matters into your own hands. That’s
exactly what <a
href="https://github.com/LeperGnome"><code>@​LeperGnome</code></a> did
when he wanted faster rendering. This release features adjustments to
the rendering algorithm for faster repaints. We encourage you to upgrade
and give it a go!</p>
<blockquote>
<p>[!NOTE]
Renderer changes are no laughing matter. We’ve tested the new renderer
extensively, however if you notice any bugs let us know. Rendering
accuracy is among our top priorities.</p>
</blockquote>
<h2>Changelog</h2>
<ul>
<li>rendering speed improvements by <a
href="https://github.com/LeperGnome"><code>@​LeperGnome</code></a> in <a
href="https://redirect.github.com/charmbracelet/bubbletea/pull/1132">charmbracelet/bubbletea#1132</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/LeperGnome"><code>@​LeperGnome</code></a> made
their first contribution in <a
href="https://redirect.github.com/charmbracelet/bubbletea/pull/1132">charmbracelet/bubbletea#1132</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/charmbracelet/bubbletea/compare/v1.1.2...v1.2.0">https://github.com/charmbracelet/bubbletea/compare/v1.1.2...v1.2.0</a></p>
<hr />
<p><!-- raw HTML omitted --><!-- raw HTML omitted --><!-- raw HTML
omitted --></p>
<p>Thoughts? Questions? We love hearing from you. Feel free to reach out
on <a href="https://twitter.com/charmcli">Twitter</a>, <a
href="https://mastodon.technology/@charm">The Fediverse</a>, or on <a
href="https://charm.sh/chat">Discord</a>.</p>
<h2>v1.1.2</h2>
<h1>This and that</h1>
<p>A tiny tiny release that fixes the tests on Windows, and uses the
latest <code>ansi</code> package definitions.</p>
<!-- raw HTML omitted -->
<h2>Changelog</h2>
<!-- raw HTML omitted -->
<h3>New Features</h3>
<ul>
<li>12b04c5d6001056875bc712f81fa1efd470fa592: feat(ci): use meta lint
workflow (<a
href="https://github.com/aymanbagabas"><code>@​aymanbagabas</code></a>)</li>
<li>3209d62ae751da63a38237666d6706ab7c9f0006: feat(ci): use meta
lint-sync workflow to sync linter config (<a
href="https://github.com/aymanbagabas"><code>@​aymanbagabas</code></a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>566879aa33ce13f27a6bdab4a274e08be01bac9c: fix(ci): run lint workflow
on all platforms (<a
href="https://github.com/aymanbagabas"><code>@​aymanbagabas</code></a>)</li>
<li>cd1e4d34a7e0232ea94afcc168eec107450aa332: fix: exec tests on windows
(<a
href="https://github.com/aymanbagabas"><code>@​aymanbagabas</code></a>)</li>
</ul>
<h3>Documentation updates</h3>
<ul>
<li>d928d8dcabcd4bca0efc22fb661de0cc27c66b21: docs: update contributing
guidelines (<a
href="https://redirect.github.com/charmbracelet/bubbletea/issues/1186">#1186</a>)
(<a
href="https://github.com/bashbunni"><code>@​bashbunni</code></a>)</li>
<li>de4788dc763d5a6ce7ca555c5ee6fce3179dedc4: docs: update readme badge
images (<a
href="https://github.com/aymanbagabas"><code>@​aymanbagabas</code></a>)</li>
</ul>
<!-- raw HTML omitted -->
<hr />
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/5b65f9afee63a23935373397c858891ddf0e868d"><code>5b65f9a</code></a>
chore: go mod tidy</li>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/e16a768eabe59bb0e4d4fe7a40439e27346dcf66"><code>e16a768</code></a>
fix: screen_test.go: fix test cases for ClearScreen and
EnterAltScreen</li>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/c78a084f81ea3011662876d8ae65752875f25aa3"><code>c78a084</code></a>
fix: renderer: use HomeCursorPosition instead of CursorOrigin</li>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/50249d492da0c103dfc37d2e47e1be49217479b1"><code>50249d4</code></a>
fix: screen_test.go: fix test cases for cursor movement</li>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/99b85ff94fbbf85dc1a0c8f5753e0b18f484816e"><code>99b85ff</code></a>
fix: renderer: erase the rest of the line when it's shorter than the
width</li>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/f4d1e0ead8047cc5557e638ed424e66e18a36c11"><code>f4d1e0e</code></a>
chore(deps): bump github.com/charmbracelet/x/ansi from 0.4.2 to 0.4.5
(<a
href="https://redirect.github.com/charmbracelet/bubbletea/issues/1224">#1224</a>)</li>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/d6aee5bd5f9492b96f31969a09d1c38f21532120"><code>d6aee5b</code></a>
chore(deps): bump github.com/charmbracelet/lipgloss from 0.13.1 to 1.0.0
(<a
href="https://redirect.github.com/charmbracelet/bubbletea/issues/1219">#1219</a>)</li>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/3bbf24dec24acebdb32ef675cb9788c90206e911"><code>3bbf24d</code></a>
chore(deps): bump github.com/charmbracelet/lipgloss in /examples (<a
href="https://redirect.github.com/charmbracelet/bubbletea/issues/1220">#1220</a>)</li>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/2472d90201467bb911eb0ba37f4a9da69ad33209"><code>2472d90</code></a>
fix: remove unnecessary line break</li>
<li><a
href="https://github.com/charmbracelet/bubbletea/commit/5f70edd7873cccfc82de75a624b1b28305c9be4e"><code>5f70edd</code></a>
chore(ci): sync golangci-lint config (<a
href="https://redirect.github.com/charmbracelet/bubbletea/issues/1222">#1222</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/charmbracelet/bubbletea/compare/v1.1.0...v1.2.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/charmbracelet/bubbletea&package-manager=go_modules&previous-version=1.1.0&new-version=1.2.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 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>
2024-11-12 13:55:00 +11:00
Ethan a5d19776af chore: increase autostop requirement leeway to two hours (#15445)
Closes https://github.com/coder/coder/issues/12612

The problem in the linked issue was caused due to a mismatch of when the
Web UI tooltip shows up (2 hours before an autostop requirement) and the
leeway in the `autostop_requirement` algorithm (workspace builds must be
1 hour before an autostop requirement to skip them).

Now, restarting your workspace whilst the tooltip is showing will skip
the upcoming autostop requirement.

This also could have been fixed by only showing the tooltip one hour
before the autostop requirement, but it looks like 1 hour was chosen
arbitrarily, and it doesn't hurt to give users more time to skip the
autostop.
2024-11-12 13:53:21 +11:00
Dean Sheather 6cc1067319 chore: add Tokyo server to dogfood template (#15479) 2024-11-11 23:56:06 +00:00
Cian Johnston b6e7498cb8 fix(agent/reconnectingpty): generate rpty id before starting lifecycle (#15475)
Fixes https://github.com/coder/coder/issues/12687

There was a race condition where we would start the rpty lifecycle
before generating the ID, leading to a data race where we would try to
concurrently read and write the struct field.
2024-11-11 15:02:55 +00:00
dependabot[bot] bc9d875efe chore: bump github.com/gohugoio/hugo from 0.136.5 to 0.138.0 (#15470)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-11 18:10:41 +05:00
dependabot[bot] 827fc41b86 chore: bump the x group with 9 updates (#15469)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-11 18:03:06 +05:00
dependabot[bot] 7f294bbb70 ci: bump the github-actions group with 2 updates (#15474)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-11 18:02:29 +05:00
Muhammad Atif Ali 329e08686f chore: improve PR deployments (#15430) 2024-11-11 17:58:32 +05:00
Mathias Fredriksson 78b4967571 docs: fix mention of incorrect env var to enable/disable telemetry (#15467) 2024-11-11 11:12:39 +00:00
Edward Angert 50e95ba676 docs: adjust manual github action screenshot in contributing.md (#15439)
resolves #15407

adjust manual github action screenshot in contributing.md


[preview](https://coder.com/docs/@15407-contrib-image/CONTRIBUTING#deploying-a-pr)
(once ready)

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-08 13:15:57 -05:00
Bruno Quaresma 308df177c9 chore: use hsl for tailwind and shadcn theming (#15453)
Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
2024-11-08 14:33:50 -03:00
Danny Kopping 111029ec07 chore: clarify template provisioning speed doc (#15383)
I noticed a few inaccuracies in this doc, or aspects which could've been
explained a little more. In other cases, I've added some specificity in
service of clarity.

---------

Signed-off-by: Danny Kopping <danny@coder.com>
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-08 16:06:20 +00:00
Steven Masley 782214bcd8 chore: move organizatinon sync to runtime configuration (#15431)
Moves the configuration from environment to database backed, to allow
configuring organization sync at runtime.
2024-11-08 08:44:14 -06:00
Spike Curtis 7b33ab0dcf fix: set dogfood go version to match go.mod (#15446)
Updates our dogfood image to use the same go version as `go.mod`. This allows us to skip downloading the new go version on builds.
2024-11-08 13:51:04 +04:00
Ethan 5d853fcfd8 chore: support adding dns hosts to tailnet.Conn (#15419)
Relates to #14718.

The remaining changes (regarding the Tailscale DNS service) will need to
be made on `coder/tailscale`.
2024-11-08 09:37:56 +00:00
Spike Curtis e5661c2748 feat: add support for multiple tunnel destinations in tailnet (#15409)
Closes #14729

Expands the Coordination controller used by the CLI client to allow multiple tunnel destinations (agents).  Our current client uses just one, but this unifies the logic so that when we add Coder VPN, 1 is just a special case of "many."
2024-11-08 13:32:07 +04:00
Spike Curtis 8c00ebc6ee chore: refactor ServerTailnet to use tailnet.Controllers (#15408)
chore of #14729

Refactors the `ServerTailnet` to use `tailnet.Controller` so that we reuse logic around reconnection and handling control messages, instead of reimplementing.  This unifies our "client" use of the tailscale API across CLI, coderd, and wsproxy.
2024-11-08 13:18:56 +04:00
Ethan f7cbf5dd79 fix: support windows specific zip mime type for template uploads (#15442)
![image](https://github.com/user-attachments/assets/15ae6dc4-84a3-4c20-b603-ed38cc14a250)
Despite being encoded the same, the API was previously rejecting zip
files with this MIME type.
2024-11-08 18:24:12 +11:00
Spike Curtis 718722af1b chore: refactor tailnetAPIConnector to tailnet.Controller (#15361)
Refactors `workspacesdk.tailnetAPIConnector` as a `tailnet.Controller` to reuse all the reconnection and graceful disconnect logic.

chore re: #14729
2024-11-08 10:10:54 +04:00
Ethan d2e496901f fix: set content type when uploading edited template (#15440)
Fixes a bug where a file produced by `generateVersionFiles` (as used
when uploading a web UI edited template) produced a file where the
`type` field was unset.
This meant the change in #15410 used the unset type value as the content
header when uploading, causing it to always fail.
2024-11-08 05:59:17 +00:00
Edward Angert f7694568eb docs: add workplace scheduling to manifest (#15384)
- [ ] check links to
<https://coder.com/docs/@workspace-scheduling/admin/templates/managing-templates/schedule#dormancy-threshold-enterprise-premium>
- @mattvollmer reports that
<https://coder.com/docs/templates/managing-templates/schedule#dormancy-threshold-enterprise>
is missing. I'll try to find refs to it



[preview](https://coder.com/docs/@workspace-scheduling/admin/templates/managing-templates/schedule)

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-08 00:54:52 -05:00
Edward Angert e688ff723b docs: add deploy id to license doc (#15415)
resolves #15414 

adds a section to licensing doc to show where to find the deployment ID


[preview](https://coder.com/docs/@15414-deploy-id/admin/licensing#find-your-deployment-id)

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-07 21:54:11 -08:00
Jaayden Halko de2f42eedd fix: enable Tailwind with storybook (#15418)
This adds index.css to the storybook preview file and references to
#storybook-root element in the tailwind config

---------

Co-authored-by: Spike Curtis <spike@coder.com>
Co-authored-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>
2024-11-07 20:56:42 -05:00
Bruno Quaresma cb9991a9bf chore: add VSCode TailwindCSS extension as recommendation (#15436) 2024-11-07 17:19:32 -03:00
Hugo Dutka f85ef84cc5 fix: use container with Postgres 13 for dump.sql (#15411) 2024-11-07 16:49:26 +01:00
Cian Johnston 9f05b192b4 chore(docs): fix inconsistencies in external provisioner docs (#15416)
This PR:
- Updates the table in `docs/admin/provisioners.md` to include highlight
multi-org changes
- Updates the instructions for the provisionerd helm chart when using
provisioner keys

---------

Co-authored-by: Ben Potter <ben@coder.com>
2024-11-07 13:28:53 +00:00
Spike Curtis 2d061e698d chore: refactor tailnetAPIConnector to use dialer (#15347)
refactors `tailnetAPIConnector` to use the `Dialer` interface in `tailnet`, introduced lower in this stack of PRs. This will let us use the same Tailnet API handling code across different things that connect to the Tailnet API (CLI client, coderd, workspace proxies, and soon: Coder VPN).

chore re: #14729
2024-11-07 17:24:19 +04:00
Spike Curtis ba483efd0f chore: add logging for Run failures in workspacetraffic (#15425)
Run logs are currently dropped on the floor when workspacetraffic tests fail.

e.g. https://github.com/coder/coder/runs/32640144785


This prints the logs when we get a failure, like

```
    run_test.go:341: 
        	Error Trace:	/Users/spike/repos/coder/scaletest/workspacetraffic/run_test.go:341
        	            				/Users/spike/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.8.darwin-arm64/src/runtime/asm_arm64.s:1222
        	Error:      	Received unexpected error:
        	            	badness:
        	            	    github.com/coder/coder/v2/scaletest/workspacetraffic.(*Runner).Run
        	            	        /Users/spike/repos/coder/scaletest/workspacetraffic/run.go:174
        	Test:       	TestRun/App
        	Messages:   	RUN LOGS:
        	            	2024-11-07 13:04:30.274 [debu]  config  agent_id=00000000-0000-0000-0000-000000000000  reconnecting_pty_id=95bb480f-cd26-4633-8332-328d44ffa997  height=25  width=80  tick_interval=1s  bytes_per_tick=1024
        	            	2024-11-07 13:04:30.274 [debu]  connect to workspace agent  agent_id=00000000-0000-0000-0000-000000000000
        	            	2024-11-07 13:04:30.274 [info]  sending traffic to workspace app  agent_id=00000000-0000-0000-0000-000000000000  app=echo
        	            	2024-11-07 13:04:30.276 [debu]  reading from agent  agent_id=00000000-0000-0000-0000-000000000000
        	            	2024-11-07 13:04:30.276 [debu]  writing to agent  agent_id=00000000-0000-0000-0000-000000000000
        	            	2024-11-07 13:04:31.526 [debu]  done reading from agent  agent_id=00000000-0000-0000-0000-000000000000
        	            	2024-11-07 13:04:32.276 [debu]  done writing to agent  agent_id=00000000-0000-0000-0000-000000000000
        	            	
        	            	END RUN LOGS
```

So, hopefully we can diagnose flakes.
2024-11-07 17:16:43 +04:00
Spike Curtis cee6b1ebde fix: wait for prompt on rich param CLI test (#15406)
Fixes a race in TestUpdateValidateRichParameters where the parameter is sent prior to the prompt.

Causes errors like: https://github.com/coder/coder/actions/runs/11681622439/job/32527173007

```
    ptytest.go:132: 2024-11-05 10:02:18.819: cmd: "bool_parameter"
    ptytest.go:167: 2024-11-05 10:02:18.819: cmd: matched "bool_parameter" = "bool_parameter"
    update_test.go:440: 2024-11-05 10:02:18.819: cmd: stdin: "cat\r\n"
    ptytest.go:132: 2024-11-05 10:02:18.819: cmd: "> Enter a value (default: \"\"): can't validate build parameter \"bool_parameter\": boolean value can be either \"true\" or \"false\""
    ptytest.go:167: 2024-11-05 10:02:18.819: cmd: matched "boolean value can be either" = "\n> Enter a value (default: \"\"): can't validate build parameter \"bool_parameter\": boolean value can be either"
    update_test.go:440: 2024-11-05 10:02:18.819: cmd: stdin: "\r\n"
    ptytest.go:167: 2024-11-05 10:02:18.819: cmd: matched "Enter a value" = " \"true\" or \"false\"\n> Enter a value"
    update_test.go:440: 2024-11-05 10:02:18.819: cmd: stdin: "false\r\n"
    ptytest.go:132: 2024-11-05 10:02:18.821: cmd: "> Enter a value (default: \"\"): can't validate build parameter \"bool_parameter\": boolean value can be either \"true\" or \"false\""
```
2024-11-07 16:47:15 +04:00
Cian Johnston 6781b0fc87 fix(helm/provisioner): prefer provisioner key if both psk and key are set (#15417)
Relates to https://github.com/coder/coder/pull/15416

This PR modifies the provisioner helm chart logic:
- Previously, when both provisionerDaemon.keySecretName and provisionerDaemon.pskSecretName
  were both set, we would fail to install the chart. This required users to have an obnoxious workaround
  in place where setting provisionerDaemon.pskSecretName="" was required in order to use provisioner
  keys. We now check for pskSecretName being set to the default value when keySecretName is also specified,
  and switch to provisioner key authentication instead of PSK. The previous workaround is still supported.
- We also had omitted to check for provisionerd.Tags being set along with provisionerDaemon.keySecretName.
  This would result in a crashlooping provisioner deployment, as setting both of these configuration options is
  not allowed. We now fast-fail the Helm deployment if we detect this scenario.
2024-11-07 12:33:58 +00:00
Spike Curtis 71dc91e496 fix: fix loss of buffered input on cliui.Prompt (#15421)
fixes https://github.com/coder/internal/issues/203
2024-11-07 16:19:03 +04:00
Ethan 098728138f chore: add a tailscale router that uses the CoderVPN protocol (#15391)
Closes #14732.
2024-11-07 22:45:17 +11:00
Ethan 6e18742ad3 ci: replace unmaintained markdown link checker (#15424)
The old one was flaking a bunch and blocking PRs. This is the one
recommended by the maintainer of the old.
2024-11-07 22:30:43 +11:00
dependabot[bot] 7318cc0e34 chore: bump @types/node from 20.16.10 to 20.17.6 in /offlinedocs (#15350)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-07 13:07:51 +05:00
Spike Curtis d7e86278c8 chore: add resume token controller (#15346)
Implements a controller for the Tailnet API resume token RPC, by refactoring from `workspacesdk`.

chore re: #14729
2024-11-07 11:32:20 +04:00
Jaayden Halko d4131badb6 feat: implement Premium features page using shadcn/ui and Tailwind (#15094)
resolves coder/internal#176

This is a proof of concept to showcase the use of Tailwind + shadcn/ui.
The goal here was to implement a lower complexity page to reduce the
initial risk and highlight the specific global changes needed.

Changes:

- Create a separate version of Premium features content for Enterprise
and OSS users
- Use shadcn/ui button component and setup styling and variants to match
the buttons defined in the Coder Kit Figma.
https://www.figma.com/design/WfqIgsTFXN2BscBSSyXWF8/Coder-kit?node-id=3-1756
- Setup theming using CSS variables and custom Tailwind colors by using
the dark class name on the root element.
- CSS variable design token naming and colors defined in Figma.
https://www.figma.com/design/WfqIgsTFXN2BscBSSyXWF8/Coder-kit?node-id=1-2


<img width="1199" alt="Screenshot 2024-11-01 at 12 46 03 PM"
src="https://github.com/user-attachments/assets/a251450f-8447-405a-9cc4-9f6aad9cd19f">
<img width="1197" alt="Screenshot 2024-11-01 at 12 45 36 PM"
src="https://github.com/user-attachments/assets/e78a5a40-cbdf-4d85-9ffe-873505800fcc">
2024-11-06 12:53:00 -05:00
Danny Kopping cafb963bf4 chore: clarify section description to indicate that notifications can be disabled (#15381)
The current description of "Configure your notification preferences.
Icons on the right of each notification indicate delivery method, either
SMTP or Webhook." doesn't really say what this page is for.

I've adjusted the wording, and also changed the tooltip of the delivery
method icon to be more clear.

Signed-off-by: Danny Kopping <danny@coder.com>
2024-11-06 18:43:39 +01:00
Bruno Quaresma 7f510051fb refactor: increase group name limit to 255 (#15377)
Close https://github.com/coder/coder/issues/15184
2024-11-06 14:39:50 -03:00
Marcin Tojek 17363098e2 fix: use correct Content-Type for template archive (#15410)
Fixes: https://github.com/coder/coder/issues/14124
2024-11-06 18:38:48 +01:00
Bruno Quaresma 18c2386e9e chore(site): fix reset password storybook flake (#15380)
Fix https://github.com/coder/internal/issues/69
2024-11-06 14:24:32 -03:00
Spike Curtis 335e4ab6bf chore: refactor sending telemetry (#15345)
Implements a tailnet API Telemetry controller by refactoring from `workspacesdk`.

chore re: #14729
2024-11-06 20:23:23 +04:00
Spike Curtis 9126cd78a6 chore: refactor DERP setting loop (#15344)
Implements a Tailnet API DERP controller by refactoring from `workspacesdk`

chore re: #14729
2024-11-06 20:04:05 +04:00
Ethan f0a4de5e1a fix: use NoLock dbmem subqueries for GetWorkspaceAgentScriptTimingsByBuildID (#15405)
Closes https://github.com/coder/internal/issues/202.

Addresses the problem mentioned in the issue, and also makes sure
subtests don't reuse `testing.T` from the main test.
2024-11-06 23:43:58 +11:00
Jaayden Halko 4ec6871cea chore: update missing RBAC action descriptions (#15389)
Add missing action descriptions so that these appear when in the
frontend when creating/updating custom roles.
2024-11-05 18:16:10 -05:00
Edward Angert 0961468398 fix: add root-level code of conduct link (#15386)
closes #15369

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-05 17:15:26 -05:00
Stephen Kirby 1532ea7d2d docs: bump versions in docs for 2.17 (#15387) 2024-11-05 12:53:34 -06:00
Edward Angert 62fa7e5ab8 docs: disable markdown link check on mailto links (#15382)
to satisfy CI

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-05 12:35:46 -05:00
Vincent Vielle 4fe2c5f09a fix: improve password validation flow (#15132)
Refers to #14984 

Currently, password validation is done backend side and is not explicit
enough so it can be painful to create first users.
We'd like to make this validation easier - but also duplicate it
frontend side to make it smoother.

Flows involved : 
- First user set password
- New user set password
- Change password

---------

Co-authored-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>
2024-11-05 17:22:32 +01:00
Ethan 8b5a18cade fix(site): watch build logs while job is pending or running (#15341)
Closes #15292.

Currently, if the frontend never sees a build job enter 'running', it'll
never end up watching the logs. If we start watching the logs earlier
we're able to catch cases where the job goes `pending` -> `failed`, such
as when the build fails immediately.
2024-11-06 01:20:27 +11:00
Ethan 3c60dc3bb5 fix(site): show error on duplicate template rename attempt (#15348)
Fixes #15311.
2024-11-06 01:18:38 +11:00
Steven Masley 2d00b50eb6 chore: remove excess join in GetQuotaConsumedForUser query (#15338)
Filter is applied in original workspace query. We do not need to join
`workspaces` twice. Use build_number instead of `created_at`
for determining the last build.
2024-11-05 08:12:56 -06:00
Spike Curtis 886dcbec84 chore: refactor coordination (#15343)
Refactors the way clients of the Tailnet API (clients of the API, which include both workspace "agents" and "clients") interact with the API.  Introduces the idea of abstract "controllers" for each of the RPCs in the API, and implements a Coordination controller by refactoring from `workspacesdk`.

chore re: #14729
2024-11-05 13:50:10 +04:00
dependabot[bot] 765314ce18 ci: bump the github-actions group with 4 updates (#15359)
Bumps the github-actions group with 4 updates:
[crate-ci/typos](https://github.com/crate-ci/typos),
[google-github-actions/auth](https://github.com/google-github-actions/auth),
[google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud)
and
[google-github-actions/get-gke-credentials](https://github.com/google-github-actions/get-gke-credentials).

Updates `crate-ci/typos` from 1.26.8 to 1.27.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/crate-ci/typos/releases">crate-ci/typos's
releases</a>.</em></p>
<blockquote>
<h2>v1.27.0</h2>
<h2>[1.27.0] - 2024-11-01</h2>
<h3>Features</h3>
<ul>
<li>Updated the dictionary with the <a
href="https://redirect.github.com/crate-ci/typos/issues/1106">October
2024</a> changes</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/crate-ci/typos/blob/master/CHANGELOG.md">crate-ci/typos's
changelog</a>.</em></p>
<blockquote>
<h1>Change Log</h1>
<p>All notable changes to this project will be documented in this
file.</p>
<p>The format is based on <a href="http://keepachangelog.com/">Keep a
Changelog</a>
and this project adheres to <a href="http://semver.org/">Semantic
Versioning</a>.</p>
<!-- raw HTML omitted -->
<h2>[Unreleased] - ReleaseDate</h2>
<h2>[1.27.0] - 2024-11-01</h2>
<h3>Features</h3>
<ul>
<li>Updated the dictionary with the <a
href="https://redirect.github.com/crate-ci/typos/issues/1106">October
2024</a> changes</li>
</ul>
<h2>[1.26.8] - 2024-10-24</h2>
<h2>[1.26.7] - 2024-10-24</h2>
<h2>[1.26.6] - 2024-10-24</h2>
<h2>[1.26.5] - 2024-10-24</h2>
<h2>[1.26.4] - 2024-10-24</h2>
<h2>[1.26.3] - 2024-10-24</h2>
<h3>Fixes</h3>
<ul>
<li>Accept <code>additionals</code></li>
</ul>
<h2>[1.26.2] - 2024-10-24</h2>
<h3>Fixes</h3>
<ul>
<li>Accept <code>tesselate</code> variants</li>
</ul>
<h2>[1.26.1] - 2024-10-23</h2>
<h3>Fixes</h3>
<ul>
<li>Respect <code>--force-exclude</code> for binary files</li>
</ul>
<h2>[1.26.0] - 2024-10-07</h2>
<h3>Compatibility</h3>
<ul>
<li><em>(pre-commit)</em> Requires 3.2+</li>
</ul>
<h3>Fixes</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/crate-ci/typos/commit/d01f29c66d1bf1a08730750f61d86c210b0d039d"><code>d01f29c</code></a>
chore: Release</li>
<li><a
href="https://github.com/crate-ci/typos/commit/52e950bb130b2bdee93bba2b1973c8f7d8ac5c46"><code>52e950b</code></a>
chore: Release</li>
<li><a
href="https://github.com/crate-ci/typos/commit/19cfc03ea4e6fd581972b77eb3761351a4db7ee6"><code>19cfc03</code></a>
docs: Update changelog</li>
<li><a
href="https://github.com/crate-ci/typos/commit/f80b1564bd618fb5325b8c0d52849ac7da0bbaea"><code>f80b156</code></a>
Merge pull request <a
href="https://redirect.github.com/crate-ci/typos/issues/1140">#1140</a>
from epage/oct</li>
<li><a
href="https://github.com/crate-ci/typos/commit/6b5c8079a9416f5aba90f4cc1348921aa72d9538"><code>6b5c807</code></a>
feat(dict): Oct updates</li>
<li><a
href="https://github.com/crate-ci/typos/commit/d64f202a88f87f2e3fbbd1f5a45ab2ec3ef9b832"><code>d64f202</code></a>
chore(deps): Update compatible (<a
href="https://redirect.github.com/crate-ci/typos/issues/1137">#1137</a>)</li>
<li><a
href="https://github.com/crate-ci/typos/commit/e903c4628799da0b9fc51e03d200e4fa62ba2c0a"><code>e903c46</code></a>
Merge pull request <a
href="https://redirect.github.com/crate-ci/typos/issues/1136">#1136</a>
from PigeonF/PigeonF/push-mlqnlvmswwmp</li>
<li><a
href="https://github.com/crate-ci/typos/commit/b994765ef920d85d7a7115db2e9afce611cdcf93"><code>b994765</code></a>
chore: Fix typo &quot;potemtial&quot; -&gt; &quot;potential&quot;</li>
<li>See full diff in <a
href="https://github.com/crate-ci/typos/compare/0d9e0c2c1bd7f770f6eb90f87780848ca02fc12c...d01f29c66d1bf1a08730750f61d86c210b0d039d">compare
view</a></li>
</ul>
</details>
<br />

Updates `google-github-actions/auth` from 2.1.6 to 2.1.7
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/google-github-actions/auth/releases">google-github-actions/auth's
releases</a>.</em></p>
<blockquote>
<h2>v2.1.7</h2>
<h2>What's Changed</h2>
<ul>
<li>fix: update relase workflows by <a
href="https://github.com/verbanicm"><code>@​verbanicm</code></a> in <a
href="https://redirect.github.com/google-github-actions/auth/pull/452">google-github-actions/auth#452</a></li>
<li>Release: v2.1.7 by <a
href="https://github.com/google-github-actions-bot"><code>@​google-github-actions-bot</code></a>
in <a
href="https://redirect.github.com/google-github-actions/auth/pull/453">google-github-actions/auth#453</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/google-github-actions/auth/compare/v2.1.6...v2.1.7">https://github.com/google-github-actions/auth/compare/v2.1.6...v2.1.7</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/google-github-actions/auth/commit/6fc4af4b145ae7821d527454aa9bd537d1f2dc5f"><code>6fc4af4</code></a>
Release: v2.1.7 (<a
href="https://redirect.github.com/google-github-actions/auth/issues/453">#453</a>)</li>
<li><a
href="https://github.com/google-github-actions/auth/commit/212f83afe868cc88aa354e1efbf778eff05d970a"><code>212f83a</code></a>
fix: update relase workflows (<a
href="https://redirect.github.com/google-github-actions/auth/issues/452">#452</a>)</li>
<li>See full diff in <a
href="https://github.com/google-github-actions/auth/compare/8254fb75a33b976a221574d287e93919e6a36f70...6fc4af4b145ae7821d527454aa9bd537d1f2dc5f">compare
view</a></li>
</ul>
</details>
<br />

Updates `google-github-actions/setup-gcloud` from 2.1.1 to 2.1.2
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/google-github-actions/setup-gcloud/releases">google-github-actions/setup-gcloud's
releases</a>.</em></p>
<blockquote>
<h2>v2.1.2</h2>
<h2>What's Changed</h2>
<ul>
<li>fix: update release workflows by <a
href="https://github.com/verbanicm"><code>@​verbanicm</code></a> in <a
href="https://redirect.github.com/google-github-actions/setup-gcloud/pull/698">google-github-actions/setup-gcloud#698</a></li>
<li>Release: v2.1.2 by <a
href="https://github.com/google-github-actions-bot"><code>@​google-github-actions-bot</code></a>
in <a
href="https://redirect.github.com/google-github-actions/setup-gcloud/pull/699">google-github-actions/setup-gcloud#699</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/google-github-actions/setup-gcloud/compare/v2.1.1...v2.1.2">https://github.com/google-github-actions/setup-gcloud/compare/v2.1.1...v2.1.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/google-github-actions/setup-gcloud/commit/6189d56e4096ee891640bb02ac264be376592d6a"><code>6189d56</code></a>
Release: v2.1.2 (<a
href="https://redirect.github.com/google-github-actions/setup-gcloud/issues/699">#699</a>)</li>
<li><a
href="https://github.com/google-github-actions/setup-gcloud/commit/413dc083dd5818edda432148520965d8255c729a"><code>413dc08</code></a>
fix: update release workflows (<a
href="https://redirect.github.com/google-github-actions/setup-gcloud/issues/698">#698</a>)</li>
<li>See full diff in <a
href="https://github.com/google-github-actions/setup-gcloud/compare/f0990588f1e5b5af6827153b93673613abdc6ec7...6189d56e4096ee891640bb02ac264be376592d6a">compare
view</a></li>
</ul>
</details>
<br />

Updates `google-github-actions/get-gke-credentials` from 2.2.1 to 2.2.2
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/google-github-actions/get-gke-credentials/releases">google-github-actions/get-gke-credentials's
releases</a>.</em></p>
<blockquote>
<h2>v2.2.2</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix package name by <a
href="https://github.com/sethvargo"><code>@​sethvargo</code></a> in <a
href="https://redirect.github.com/google-github-actions/get-gke-credentials/pull/312">google-github-actions/get-gke-credentials#312</a></li>
<li>fix: update release workflows by <a
href="https://github.com/verbanicm"><code>@​verbanicm</code></a> in <a
href="https://redirect.github.com/google-github-actions/get-gke-credentials/pull/313">google-github-actions/get-gke-credentials#313</a></li>
<li>Release: v2.2.2 by <a
href="https://github.com/google-github-actions-bot"><code>@​google-github-actions-bot</code></a>
in <a
href="https://redirect.github.com/google-github-actions/get-gke-credentials/pull/315">google-github-actions/get-gke-credentials#315</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/google-github-actions/get-gke-credentials/compare/v2.2.1...v2.2.2">https://github.com/google-github-actions/get-gke-credentials/compare/v2.2.1...v2.2.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/google-github-actions/get-gke-credentials/commit/206d64b64b0eba0a6e2f25113d044c31776ca8d6"><code>206d64b</code></a>
Release: v2.2.2 (<a
href="https://redirect.github.com/google-github-actions/get-gke-credentials/issues/315">#315</a>)</li>
<li><a
href="https://github.com/google-github-actions/get-gke-credentials/commit/0fead37d80f46cbcae8eb09300bd8186eb3b2d31"><code>0fead37</code></a>
fix: update release workflows (<a
href="https://redirect.github.com/google-github-actions/get-gke-credentials/issues/313">#313</a>)</li>
<li><a
href="https://github.com/google-github-actions/get-gke-credentials/commit/d7d8311fd5e889897561404341b15a5c01310725"><code>d7d8311</code></a>
Fix package name (<a
href="https://redirect.github.com/google-github-actions/get-gke-credentials/issues/312">#312</a>)</li>
<li>See full diff in <a
href="https://github.com/google-github-actions/get-gke-credentials/compare/6051de21ad50fbb1767bc93c11357a49082ad116...206d64b64b0eba0a6e2f25113d044c31776ca8d6">compare
view</a></li>
</ul>
</details>
<br />


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>

---------

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>
2024-11-05 19:43:41 +11:00
Ethan 871cc05e99 chore: add a dns.OSConfigurator implementation that uses the CoderVPN protocol (#15342)
Closes #14733.
2024-11-05 19:23:16 +11:00
Muhammad Atif Ali 076399b3bd chore: correct typos and configure permissions in pr-deploy.yaml (#15372) 2024-11-05 09:41:48 +05:00
dependabot[bot] 98e584b36f chore: bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1 (#15371)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 08:59:20 +05:00
Steven Masley 8024c1dff4 fix: allow workspace owners to view timings (#15364)
Anyone with authz access to a workspace should be able to read timings
information of its builds.

To do this without `AsSystemContext` would do an extra 4 db calls.
2024-11-04 20:45:43 -06:00
Muhammad Atif Ali 2cf745766c chore: use typos extension in vscode (#15136)
This synchronises the spellchecker with our CI.

We use https://github.com/crate-ci/typos in CI, so let us use typos in
vscode too.

https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode
2024-11-04 10:26:04 -08:00
Cian Johnston dc29b81286 fix(site/static/icon): add filebrowser icon (#15367)
Fixes https://github.com/coder/coder/issues/15365

We used to hit
https://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svg
for the filebrowser icon but coder/modules#334 modified the icon URL to
point to a self-hosted icon.

I simply copied the icon from the `coder/modules` repo.
2024-11-04 18:17:16 +00:00
dependabot[bot] cfc4cb07b6 chore: bump @types/node from 20.16.10 to 20.17.6 in /site (#15351) 2024-11-04 10:56:00 -07:00
Muhammad Atif Ali f25a07502a chore: fix links in README.md (#15366) 2024-11-04 22:55:40 +05:00
dependabot[bot] 735e965bdd chore: bump @types/lodash from 4.17.9 to 4.17.13 in /site (#15334) 2024-11-04 14:35:02 -03:00
Hugo Dutka 1bfa7d42e8 chore: add postgres template caching for tests (#15336)
This PR is the first in a series aimed at closing
[#15109](https://github.com/coder/coder/issues/15109).

### Changes

- **Template Database Creation:**  
`dbtestutil.Open` now has the ability to create a template database if
none is provided via `DB_FROM`. The template database’s name is derived
from a hash of the migration files, ensuring that it can be reused
across tests and is automatically updated whenever migrations change.

- **Optimized Database Handling:**  
Previously, `dbtestutil.Open` would spin up a new container for each
test when `DB_FROM` was unset. Now, it first checks for an active
PostgreSQL instance on `localhost:5432`. If none is found, it creates a
single container that remains available for subsequent tests,
eliminating repeated container startups.

These changes address the long individual test times (10+ seconds)
reported by some users, likely due to the time Docker took to start and
complete migrations.
2024-11-04 17:23:31 +01:00
Muhammad Atif Ali 1c29944862 chore: update link to licensed features in README.md (#15362) 2024-11-04 20:19:23 +05:00
dependabot[bot] ffa82659a2 chore: bump the vite group across 1 directory with 2 updates (#15321)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 15:52:11 +05:00
dependabot[bot] a8caa65124 chore: bump github.com/charmbracelet/lipgloss from 0.13.0 to 1.0.0 (#15354)
Bumps
[github.com/charmbracelet/lipgloss](https://github.com/charmbracelet/lipgloss)
from 0.13.0 to 1.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/charmbracelet/lipgloss/releases">github.com/charmbracelet/lipgloss's
releases</a>.</em></p>
<blockquote>
<h2>v1.0.0</h2>
<h1>At last: v1.0.0</h1>
<!-- raw HTML omitted -->
<p>This is an honorary release indicating that Lip Gloss is now stable.
Thank you, open source community, for all your love, support,
contributions, and great style.</p>
<p>Stay tuned for a v2 alpha!</p>
<h2>v0.13.1</h2>
<h1>Table improvements, on stream</h1>
<p><a href="https://github.com/bashbunni"><code>@​bashbunni</code></a>
went to town in this release and fixed a bunch of bugs, mostly around
table. Best of all, she did most of it <a
href="https://www.twitch.tv/bashbunni">on stream</a>.</p>
<h2>Changelog</h2>
<h3>Table</h3>
<ul>
<li>fix(table): use table height by <a
href="https://github.com/Broderick-Westrope"><code>@​Broderick-Westrope</code></a>
in <a
href="https://redirect.github.com/charmbracelet/lipgloss/pull/358">charmbracelet/lipgloss#358</a></li>
<li>fix(table): unset data rows without causing nil pointer err by <a
href="https://github.com/bashbunni"><code>@​bashbunni</code></a> in <a
href="https://redirect.github.com/charmbracelet/lipgloss/pull/372">charmbracelet/lipgloss#372</a></li>
<li>fix(table): shared indices for first row of data and headers
(StyleFunc bug) by <a
href="https://github.com/bashbunni"><code>@​bashbunni</code></a> in <a
href="https://redirect.github.com/charmbracelet/lipgloss/pull/377">charmbracelet/lipgloss#377</a></li>
<li>fix(table): do not shrink table with offset by <a
href="https://github.com/bashbunni"><code>@​bashbunni</code></a> in <a
href="https://redirect.github.com/charmbracelet/lipgloss/pull/373">charmbracelet/lipgloss#373</a></li>
<li>fix(table): include margins for cell width by <a
href="https://github.com/bashbunni"><code>@​bashbunni</code></a> in <a
href="https://redirect.github.com/charmbracelet/lipgloss/pull/401">charmbracelet/lipgloss#401</a></li>
</ul>
<h3>Other Stuff</h3>
<ul>
<li>fix(render): strip carriage returns from strings by <a
href="https://github.com/bashbunni"><code>@​bashbunni</code></a> in <a
href="https://redirect.github.com/charmbracelet/lipgloss/pull/386">charmbracelet/lipgloss#386</a></li>
</ul>
<h2>Bonus</h2>
<ul>
<li>docs(example): rainbow string by <a
href="https://github.com/caarlos0"><code>@​caarlos0</code></a> in <a
href="https://redirect.github.com/charmbracelet/lipgloss/pull/96">charmbracelet/lipgloss#96</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/Broderick-Westrope"><code>@​Broderick-Westrope</code></a>
made their first contribution in <a
href="https://redirect.github.com/charmbracelet/lipgloss/pull/358">charmbracelet/lipgloss#358</a></li>
<li><a href="https://github.com/swrenn"><code>@​swrenn</code></a> made
their first contribution in <a
href="https://redirect.github.com/charmbracelet/lipgloss/pull/364">charmbracelet/lipgloss#364</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/charmbracelet/lipgloss/compare/v0.13.0...v0.13.1">https://github.com/charmbracelet/lipgloss/compare/v0.13.0...v0.13.1</a></p>
<hr />
<p><!-- raw HTML omitted --><!-- raw HTML omitted --><!-- raw HTML
omitted --></p>
<p>Thoughts? Questions? We love hearing from you. Feel free to reach out
on <a href="https://twitter.com/charmcli">Twitter</a>, <a
href="https://mastodon.technology/@charm">The Fediverse</a>, or on <a
href="https://charm.sh/chat">Discord</a>.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/761d265f761271293f20f9bf62884b15f2d7c0cc"><code>761d265</code></a>
feat(deps): bump github.com/charmbracelet/x/ansi from 0.4.0 to
0.4.2</li>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/342e7b051b45419b6f052c1d4b83e904e14414ff"><code>342e7b0</code></a>
chore(ci): sync golangci-lint config</li>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/da324b123d09dc2d194c6911d440371ed463e4c8"><code>da324b1</code></a>
feat(deps): bump github.com/charmbracelet/x/ansi from 0.3.2 to
0.4.0</li>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/78fd6fd42f6e6b028bac3dcc8dcd9652fc15afa0"><code>78fd6fd</code></a>
chore(ci): sync golangci-lint config</li>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/407dc3d2cf84b9abeae83e7a12277a84ab01eab4"><code>407dc3d</code></a>
feat(ci): add lint-sync workflow</li>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/284c0c5c55441a0d11bd07c5496593e676f4dfd0"><code>284c0c5</code></a>
docs(list): fix list examples in godoc (<a
href="https://redirect.github.com/charmbracelet/lipgloss/issues/404">#404</a>)</li>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/d8581323b63a3bb43c6d5247a00353d7cbd1d236"><code>d858132</code></a>
fix(table): include margins in cell width (<a
href="https://redirect.github.com/charmbracelet/lipgloss/issues/401">#401</a>)</li>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/80b4221fc123fbe3374dee85216be698cf7c8556"><code>80b4221</code></a>
chore(lint): update linter (<a
href="https://redirect.github.com/charmbracelet/lipgloss/issues/405">#405</a>)</li>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/fa2f4b06ca711f1be00f83bc9a64d49e6bbb9ee7"><code>fa2f4b0</code></a>
docs(readme): update example screenshot with blend</li>
<li><a
href="https://github.com/charmbracelet/lipgloss/commit/68ca8486fcd181ba9d7df258c5ef0979b53090b9"><code>68ca848</code></a>
docs: update contributing guidelines (<a
href="https://redirect.github.com/charmbracelet/lipgloss/issues/396">#396</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/charmbracelet/lipgloss/compare/v0.13.0...v1.0.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/charmbracelet/lipgloss&package-manager=go_modules&previous-version=0.13.0&new-version=1.0.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>
2024-11-04 20:28:05 +11:00
dependabot[bot] cf96d91625 chore: bump dayjs from 1.11.4 to 1.11.13 in /site (#15332)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 11:34:35 +05:00
dependabot[bot] 3796344d3f chore: bump github.com/elastic/go-sysinfo from 1.14.0 to 1.15.0 (#15353)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 11:33:50 +05:00
dependabot[bot] a1b03fa6d2 chore: bump google.golang.org/api from 0.203.0 to 0.204.0 (#15356)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 11:33:33 +05:00
dependabot[bot] 4a8fe424df chore: bump github.com/open-policy-agent/opa from 0.69.0 to 0.70.0 (#15358)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-03 22:33:18 -08:00
dependabot[bot] 56326307f2 chore: bump github.com/hashicorp/terraform-json from 0.22.1 to 0.23.0 (#15355)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 11:33:04 +05:00
dependabot[bot] 98bb560f63 chore: bump the react group across 2 directories with 2 updates (#15319)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 06:11:44 +00:00
Muhammad Atif Ali 3a5a42ffa9 chore: update workflow permissions (#15349) 2024-11-04 11:09:40 +05:00
Muhammad Atif Ali 065263a852 chore: update dependabot config and pin Docker images (#15194) 2024-11-04 11:01:54 +05:00
dependabot[bot] b529393f6f chore: bump @chakra-ui/react from 2.9.3 to 2.10.3 in /offlinedocs (#15326)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 11:01:34 +05:00
dependabot[bot] 6153880e9c chore: bump @swc/jest from 0.2.36 to 0.2.37 in /site (#15331)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 11:00:35 +05:00
dependabot[bot] 9f867a48c3 chore: bump typescript from 5.6.2 to 5.6.3 in /site (#15335)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 11:00:27 +05:00
dependabot[bot] 7b81b3fb8a chore: bump @types/lodash from 4.14.196 to 4.17.13 in /offlinedocs (#15325)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 10:55:22 +05:00
dependabot[bot] 8a72e9a4d2 chore: bump next from 14.2.14 to 14.2.16 in /offlinedocs (#15324)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 10:55:14 +05:00
dependabot[bot] 48253581ed chore: bump chromatic from 11.3.0 to 11.16.3 in /site (#15329)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 10:54:43 +05:00
Benjamin Peinhardt 040e5cf9f3 docs: provide example regexes to properly escape . characters (#14983) 2024-11-03 10:01:06 -06:00
Edward Angert 1f93b80e09 chore: fix docs/admin links and upgrade notice (#15043)
- Update links to /docs/admin to match the new structure
- TODO: remove the release string from the "upgrade available"
instructions link
- [x]
https://github.com/coder/coder/blob/update-upgrade-config-links/cli/server.go#L646


![2024-10-11_11-35-40](https://github.com/user-attachments/assets/fd95e821-d5ad-4c91-a38a-066046c7072c)

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-11-01 19:43:51 +00:00
Stephen Kirby 399c830b51 chore(docs): add info on new build timings in docs (#15310)
Adds information on workspace build timings in workspace lifecycle and
template troubleshooting docs.
2024-11-01 12:17:50 -05:00
Bruno Quaresma e232aee011 feat(site): add agent connection timings (#15276)
Local preview:

<img width="1260" alt="Screenshot 2024-10-29 at 16 16 01"
src="https://github.com/user-attachments/assets/10fdb20d-1f2a-4b0a-a8a1-171050ee620d">


Close https://github.com/coder/internal/issues/116

---------

Co-authored-by: Danny Kopping <danny@coder.com>
2024-11-01 13:29:00 -03:00
Edward Angert 18ef954a03 docs: add new best practice doc to speed up templates and workspaces (#15296)
closes https://github.com/coder/coder/issues/14858

- [x] TODO: update `build-timeline.png`
- [x] TODO: `Best practices` doesn't show up in the sidebar until you're
actually in the doc 🤔


[preview](https://coder.com/docs/@bp-speed-up-templates/tutorials/best-practices/speed-up-templates)

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
Co-authored-by: Ben Potter <ben@coder.com>
2024-11-01 11:24:35 -05:00
dependabot[bot] 13b97cf3dc chore: bump @storybook/addon-actions from 8.1.11 to 8.3.5 in /site (#15330) 2024-11-01 09:58:48 -06:00
dependabot[bot] 8da30a1e59 chore: update typescript from 5.6.2 to 5.6.3 in /offlinedocs (#15323) 2024-11-01 09:58:14 -06:00
dependabot[bot] 85f05ad396 chore: bump @types/jest from 29.5.13 to 29.5.14 in /site in the jest group (#15320) 2024-11-01 12:47:47 -03:00
Steven Masley 854044e811 chore: fix concurrent CommitQuota transactions for unrelated users/orgs (#15261)
The failure condition being fixed is `w1` and `w2` could belong
to different users, organizations, and templates and still cause a
serializable failure if run concurrently. This is because the old query 
did a `seq scan` on the `workspace_builds` table. Since that is the 
table being updated, we really want to prevent that.

So before this would fail for any 2 workspaces. Now it only fails if
`w1` and `w2` are owned by the same user and organization.
2024-11-01 11:05:49 -04:00
dependabot[bot] 47f9a8aeb8 chore: bump eslint-config-next from 14.2.14 to 14.2.16 in /offlinedocs (#15327)
Bumps
[eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next)
from 14.2.14 to 14.2.16.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/next.js/releases">eslint-config-next's
releases</a>.</em></p>
<blockquote>
<h2>v14.2.15</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>support breadcrumb style catch-all parallel routes <a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/65063">#65063</a></li>
<li>Provide non-dynamic segments to catch-all parallel routes <a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/65233">#65233</a></li>
<li>Fix client reference access causing metadata missing <a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70732">#70732</a></li>
<li>feat(next/image): add support for decoding prop <a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70298">#70298</a></li>
<li>feat(next/image): add images.localPatterns config <a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70529">#70529</a></li>
<li>fix(next/image): handle undefined images.localPatterns config in
images-manifest.json</li>
<li>fix: Do not omit alt on getImgProps return type, ImgProps <a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70608">#70608</a></li>
<li>[i18n] Routing fix <a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70761">#70761</a></li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/ztanner"><code>@​ztanner</code></a>, <a
href="https://github.com/agadzik"><code>@​agadzik</code></a>, <a
href="https://github.com/huozhi"><code>@​huozhi</code></a>, <a
href="https://github.com/styfle"><code>@​styfle</code></a>, <a
href="https://github.com/icyJoseph"><code>@​icyJoseph</code></a> and <a
href="https://github.com/wyattjoh"><code>@​wyattjoh</code></a> for
helping!</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/next.js/commit/3c01e3a9a17e5cc8d060b87e57d30ef544fe5dcd"><code>3c01e3a</code></a>
v14.2.16</li>
<li><a
href="https://github.com/vercel/next.js/commit/737c29e49f9532cce3da8e25d88bc82cf5f5fe9a"><code>737c29e</code></a>
v14.2.15</li>
<li>See full diff in <a
href="https://github.com/vercel/next.js/commits/v14.2.16/packages/eslint-config-next">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-config-next&package-manager=npm_and_yarn&previous-version=14.2.14&new-version=14.2.16)](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>
2024-11-01 10:14:51 -03:00
Ethan 5f60a8d9e3 fix: create contexts per sub-test to fix flake (#15314)
Flake seen here:
https://github.com/coder/coder/actions/runs/11624011543/job/32371950701

https://coder.com/blog/go-testing-contexts-and-t-parallel
2024-11-01 23:22:36 +11:00
Spike Curtis 005ea536a5 fix: fix Listen/Unlisten race on Pubsub (#15315)
Fixes #15312

When we need to `Unlisten()` for an event, instead of immediately removing the event from the `p.queues`, we store a channel to signal any goroutines trying to Subscribe to the same event when we are done. On `Subscribe`, if the channel is present, wait for it before calling `Listen` to ensure the ordering is correct.
2024-11-01 14:35:26 +04:00
Cian Johnston fbbefa228d chore(.gitignore): add .zed_server to .gitignore (#15316) 2024-11-01 09:58:52 +00:00
Mathias Fredriksson bd9151d224 fix(coderd/database/pubsub): prevent listeners read outside mutex lock (#15303)
https://github.com/coder/coder/actions/runs/11611105362/job/32331771969#logs

```
2024-10-31T11:36:45.9225038Z WARNING: DATA RACE
2024-10-31T11:36:45.9225120Z Write at 0x00c0000d8030 by goroutine 26:
2024-10-31T11:36:45.9225200Z   runtime.mapdelete()
2024-10-31T11:36:45.9225412Z       /opt/hostedtoolcache/go/1.22.8/x64/src/runtime/map.go:696 +0x0
2024-10-31T11:36:45.9225647Z   github.com/coder/coder/v2/coderd/database/pubsub.(*PGPubsub).subscribeQueue.func2()
2024-10-31T11:36:45.9225906Z       /home/runner/work/coder/coder/coderd/database/pubsub/pubsub.go:277 +0x131
2024-10-31T11:36:45.9225993Z   runtime.deferreturn()
2024-10-31T11:36:45.9226210Z       /opt/hostedtoolcache/go/1.22.8/x64/src/runtime/panic.go:602 +0x5d
2024-10-31T11:36:45.9226283Z   testing.tRunner()
2024-10-31T11:36:45.9226519Z       /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1689 +0x21e
2024-10-31T11:36:45.9226603Z   testing.(*T).Run.gowrap1()
2024-10-31T11:36:45.9226831Z       /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1742 +0x44
2024-10-31T11:36:45.9226836Z 
2024-10-31T11:36:45.9226934Z Previous read at 0x00c0000d8030 by goroutine 112:
2024-10-31T11:36:45.9227159Z   github.com/coder/coder/v2/coderd/database/pubsub.(*PGPubsub).subscribeQueue.func2()
2024-10-31T11:36:45.9227462Z       /home/runner/work/coder/coder/coderd/database/pubsub/pubsub.go:284 +0x1b6
2024-10-31T11:36:45.9227661Z   github.com/coder/coder/v2/enterprise/replicasync.(*Manager).subscribe.func3()
2024-10-31T11:36:45.9227936Z       /home/runner/work/coder/coder/enterprise/replicasync/replicasync.go:228 +0x53
2024-10-31T11:36:45.9227941Z 
2024-10-31T11:36:45.9228019Z Goroutine 26 (running) created at:
2024-10-31T11:36:45.9228096Z   testing.(*T).Run()
2024-10-31T11:36:45.9228318Z       /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1742 +0x825
2024-10-31T11:36:45.9228498Z   github.com/coder/coder/v2/enterprise/replicasync_test.TestReplica()
2024-10-31T11:36:45.9228777Z       /home/runner/work/coder/coder/enterprise/replicasync/replicasync_test.go:33 +0x4b
2024-10-31T11:36:45.9228847Z   testing.tRunner()
2024-10-31T11:36:45.9229063Z       /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1689 +0x21e
2024-10-31T11:36:45.9229142Z   testing.(*T).Run.gowrap1()
2024-10-31T11:36:45.9229366Z       /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1742 +0x44
2024-10-31T11:36:45.9229369Z 
2024-10-31T11:36:45.9229443Z Goroutine 112 (finished) created at:
2024-10-31T11:36:45.9229685Z   github.com/coder/coder/v2/enterprise/replicasync.(*Manager).subscribe()
2024-10-31T11:36:45.9229952Z       /home/runner/work/coder/coder/enterprise/replicasync/replicasync.go:226 +0x568
2024-10-31T11:36:45.9230092Z   github.com/coder/coder/v2/enterprise/replicasync.New()
2024-10-31T11:36:45.9230361Z       /home/runner/work/coder/coder/enterprise/replicasync/replicasync.go:101 +0x1344
2024-10-31T11:36:45.9230547Z   github.com/coder/coder/v2/enterprise/replicasync_test.TestReplica.func1()
2024-10-31T11:36:45.9230836Z       /home/runner/work/coder/coder/enterprise/replicasync/replicasync_test.go:48 +0x26a
2024-10-31T11:36:45.9230904Z   testing.tRunner()
2024-10-31T11:36:45.9231127Z       /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1689 +0x21e
2024-10-31T11:36:45.9231207Z   testing.(*T).Run.gowrap1()
2024-10-31T11:36:45.9231431Z       /opt/hostedtoolcache/go/1.22.8/x64/src/testing/testing.go:1742 +0x44
```
2024-11-01 11:24:29 +04:00
Ethan b1298a3c1e feat: add WorkspaceUpdates tailnet RPC (#14847)
Closes #14716
Closes #14717

Adds a new user-scoped tailnet API endpoint (`api/v2/tailnet`) with a new RPC stream for receiving updates on workspaces owned by a specific user, as defined in #14716. 

When a stream is started, the `WorkspaceUpdatesProvider` will begin listening on the user-scoped pubsub events implemented in #14964. When a relevant event type is seen (such as a workspace state transition), the provider will query the DB for all the workspaces (and agents) owned by the user. This gets compared against the result of the previous query to produce a set of workspace updates. 

Workspace updates can be requested for any user ID, however only workspaces the authorised user is permitted to `ActionRead` will have their updates streamed.
Opening a tunnel to an agent requires that the user can perform `ActionSSH` against the workspace containing it.
2024-11-01 14:53:53 +11:00
Ethan f941e78079 chore: add db query to retrieve workspaces & their agents (#14792)
Second PR for #14716.

Adds a query that, given a user ID, returns all the workspaces they own, that can also be `ActionRead` by the requesting user.

```
type GetWorkspacesAndAgentsByOwnerIDRow struct {
	WorkspaceID      uuid.UUID            `db:"workspace_id" json:"workspace_id"`
	WorkspaceName    string               `db:"workspace_name" json:"workspace_name"`
	JobStatus        ProvisionerJobStatus `db:"job_status" json:"job_status"`
	Transition       WorkspaceTransition  `db:"transition" json:"transition"`
	Agents           []AgentIDNamePair    `db:"agents" json:"agents"`
}
```
 `JobStatus` and `Transition` are set using the latest build/job of the workspace. Deleted workspaces are not included.
2024-11-01 14:36:12 +11:00
Ethan 31506e694b chore: send workspace pubsub events by owner id (#14964)
We currently send empty payloads to pubsub channels of the form `workspace:<workspace_id>` to notify listeners of updates to workspaces (such as for refreshing the workspace dashboard).

To support https://github.com/coder/coder/issues/14716, we'll instead send `WorkspaceEvent` payloads to pubsub channels of the form `workspace_owner:<owner_id>`. This enables a listener to receive events for all workspaces owned by a user.
This PR replaces the usage of the old channels without modifying any existing behaviors.

```
type WorkspaceEvent struct {
	Kind        WorkspaceEventKind `json:"kind"`
	WorkspaceID uuid.UUID          `json:"workspace_id" format:"uuid"`
	// AgentID is only set for WorkspaceEventKindAgent* events
	// (excluding AgentTimeout)
	AgentID *uuid.UUID `json:"agent_id,omitempty" format:"uuid"`
}
```

We've defined `WorkspaceEventKind`s based on how the old channel was used, but it's not yet necessary to inspect the types of any of the events, as the existing listeners are designed to fire off any of them.

```
WorkspaceEventKindStateChange     WorkspaceEventKind = "state_change"
WorkspaceEventKindStatsUpdate     WorkspaceEventKind = "stats_update"
WorkspaceEventKindMetadataUpdate  WorkspaceEventKind = "mtd_update"
WorkspaceEventKindAppHealthUpdate WorkspaceEventKind = "app_health"

WorkspaceEventKindAgentLifecycleUpdate  WorkspaceEventKind = "agt_lifecycle_update"
WorkspaceEventKindAgentLogsUpdate       WorkspaceEventKind = "agt_logs_update"
WorkspaceEventKindAgentConnectionUpdate WorkspaceEventKind = "agt_connection_update"
WorkspaceEventKindAgentLogsOverflow     WorkspaceEventKind = "agt_logs_overflow"
WorkspaceEventKindAgentTimeout          WorkspaceEventKind = "agt_timeout"
```
2024-11-01 14:17:05 +11:00
Colin Adler 088f21965b feat: add audit logs for dormancy events (#15298) 2024-10-31 17:55:42 -05:00
Mathias Fredriksson 14565615be test(coderd/database/pubsub): fix data race in err assignment (#15306) 2024-10-31 22:37:19 +02:00
Danielle Maywood 330acd1270 chore: create ResourceNotificationMessage and AsNotifier (#15301)
Closes https://github.com/coder/coder/issues/15213

This PR enables sending notifications without requiring the auth system
context, instead using a new auth notifier context.
2024-10-31 17:01:51 +00:00
Steven Masley 9d03e0429f fix: workspaces query to correctly user username from users table (#15305)
The subquery on the users table was incorrectly using the username from
the `workspaces` table, not the `users` table.

This passed `sqlc-vet` because the column did exist in the query, it
just was not the correct one.
2024-10-31 12:33:07 -04:00
Bruno Quaresma 4849b4d8ac refactor(site): refactor DAU chart to avoid seat consumption focus (#15307)
Related to
[https://github.com/coder/coder/issues/15297](https://github.com/coder/coder/issues/15297#issuecomment-2450052538)

- Clearly display this as Daily Active Users
- Remove the user limit bar at the top for licensed deployments
- Explain in the tooltip that this is for measuring user activity and
has no connection to license consumption
2024-10-31 12:26:30 -03:00
Mathias Fredriksson 6e54bd9183 test(coderd/notifications): fix data race in tests and smpttest (#15304) 2024-10-31 15:48:49 +02:00
Cian Johnston 591cefa428 fix(coderd/provisionerdserver): prevent NPE if no user link exists (#15289) 2024-10-30 19:16:59 +00:00
Colin Adler 3de98c25db feat: add prometheus metric for tracking user statuses (#15281) 2024-10-30 18:41:16 +00:00
Stephen Kirby e9fbfcc45b chore(docs): include custom roles examples and mention of password reset (#15294)
Added example custom roles for admin inspiration, mention of headless
authentication use case, and user-activated password reset.
2024-10-30 11:41:52 -05:00
Kayla Washburn-Love 85ff8e0267 chore: tweak e2e test timeouts (#15275) 2024-10-30 10:07:19 -06:00
Ethan 371a2e12ab fix: check correct default during template push from stdin (#15293)
I used the wrong default in #14643 - not sure how or why I didn't catch
that..
2024-10-30 15:05:10 +00:00
Steven Masley 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
Muhammad Atif Ali afacb07140 chore: tighten GitHub workflow permissions (#15282) 2024-10-30 16:17:42 +05:00
Muhammad Atif Ali df6afd3354 fix(install.sh): fix installation script for remote hosts (#15288) 2024-10-30 15:49:28 +05:00
Danielle Maywood 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
Stephen Kirby 25738388d5 chore(docs): add documentation on custom roles (#15280)
These docs were overwritten in the restructure merge.
2024-10-29 20:58:26 -05:00
Kayla Washburn-Love bbd2dd80e2 fix: show template name on workspace page when template display name is unset (#15262) 2024-10-29 12:30:13 -06:00
Garrett Delfosse 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
Colin Adler ceb168be95 fix(flake.nix): remove preBuild to fix building on Linux (#15259) 2024-10-29 12:57:13 -05:00
Jon Ayers 097fdaffe2 chore: add quota to source-controlled template (#15271) 2024-10-29 16:31:46 +00:00
Bruno Quaresma 3c7808c575 fix(site): update workspace timings to use theme colors (#15269)
Fix https://github.com/coder/coder/issues/15266

After fix:
<img width="1210" alt="Screenshot 2024-10-29 at 09 37 02"
src="https://github.com/user-attachments/assets/35ff0361-6323-4e26-b4f2-05da6f1651c6">
<img width="1200" alt="Screenshot 2024-10-29 at 09 36 49"
src="https://github.com/user-attachments/assets/c2e55364-9f21-4bd1-bda6-aedf106a9742">
<img width="1202" alt="Screenshot 2024-10-29 at 09 36 40"
src="https://github.com/user-attachments/assets/2d0222d9-cf25-4ef9-8d74-f426fbae7bec">
2024-10-29 13:02:24 -03:00
Joobi S B 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
Danielle Maywood 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
Bruno Quaresma 4cad6f75a9 fix(site): fix workspace timings verbiage (#15268) 2024-10-29 09:05:41 -03:00
Danielle Maywood 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
Michael Smith 1d925ab043 fix: ensure user admins can always see users table (#15226)
Closes #15212

## Changes made
- Updated logic so that proxy config is only requested when appropriate,
instead of for all users on all deployment pages
- Split up the main context provider for the `/deployment` and
`/organizations` routes, and updated layout logic for
`ManagementSettingsLayout` layout component. This ensures the sidebar is
always visible, even if request errors happen
- Added additional routing safeguards to make sure that even if a user
can view one page in the deployment section, they won't be able to
navigate directly to any arbitrary deployment page
- Updated logic for sidebar navigation to ensure that nav items only
appear when the user truly has permission
- Centralized a lot of the orgs logic into the `useAuthenticated` hook
- Added additional check cases to the `permissions.tsx` file, to give
more granularity, and added missing type-checking
- Extended the API for the `RequirePermissions` component to let it
redirect users anywhere
- Updated some of our testing setup files to ensure that types were
defined correctly

---------

Co-authored-by: McKayla Washburn <mckayla@hey.com>
2024-10-29 01:06:33 -04:00
Jon Ayers fd60e1c2ba fix: fix security workflow not installing protoc properly (#15263) 2024-10-29 01:30:43 +00:00
Stephen Kirby 971388762c chore(docs): change mentions of enterprise to premium (#15258)
Matches our latest licensing verbiage.
2024-10-28 15:56:51 -05:00
dependabot[bot] 742413e149 chore: bump google.golang.org/api from 0.202.0 to 0.203.0 (#15246)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-28 20:47:19 +00:00
Jon Ayers fb4219f57d fix: parse int to correct bit size (#15257) 2024-10-28 20:31:01 +00:00
Colin Adler 074faec7d7 chore: update Terraform to 1.9.8 (#15256) 2024-10-28 15:24:57 -05:00
Colin Adler 516ba9e28e chore: update Go to 1.22.8 (#15255) 2024-10-28 15:09:43 -05:00
Steven Masley 7cb20d7b26 chore: name unlabeled db transaction metrics (#15251) 2024-10-28 13:15:29 -04:00
dependabot[bot] ecb22461bb chore: bump github.com/gohugoio/hugo from 0.134.1 to 0.136.5 (#15247)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-28 17:13:51 +00:00
dependabot[bot] 1636124ed1 chore: bump github.com/fatih/color from 1.17.0 to 1.18.0 (#15248)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-28 17:11:31 +00:00
dependabot[bot] cdd40fb292 ci: bump the github-actions group with 2 updates (#15245)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-28 21:59:30 +05:00
Ethan 1d33990e78 fix: ensure make gen runs on any changes (#15253)
Previously, `make gen` ran on CI whenever a non-docs change was made.
Based off the problem described in #15252, it sounds like CI should
*always* be running `gen`.

(Because I broke it, currently PR `gen` is getting skipped unless the
`ci` category is updated)
2024-10-29 03:46:18 +11:00
Vincent Vielle 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
Ethan 03940f5fef chore: ensure make gen runs on CI when docs are updated (#15252)
https://github.com/coder/coder/pull/15203 was merged with a failing
`make gen`, as it only updated the docs. This makes it so this can't
happen again.

The capitalization of the Go type used in the auto-generated docs
(`codersdk.OAuth2GithubConfig`) wasn't updated as it would technically
be a breaking change for the sdk.
2024-10-28 15:22:37 +00:00
Edward Angert 007f0a35a4 fix: adjust instances of Github to GitHub (#15203)
s/Github/GitHub

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-10-28 07:43:30 -04:00
Phorcys c8f68cbc46 feat: use hashicorp/cloud-init provider for AWS-linux example (#15240)
Same as #15050 but for the `aws-linux` template.
Tested, works as expected.
2024-10-28 07:43:45 +00:00
Phorcys 91c337a2ff feat: use hashicorp/cloud-init provider in AWS devcontainer template (#15050)
This PR makes templates uses the
[hashicorp/cloud-init](https://registry.terraform.io/providers/hashicorp/cloudinit/latest/docs)
provider instead of hardcoding a cloud-init config.
2024-10-27 13:17:03 +00:00
Steven Masley 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
Steven Masley 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
Colin Adler 27f5ff2dd1 chore: correctly document SCIM authentication (#15234) 2024-10-25 12:40:13 -05:00
Steven Masley 900e2cd39c chore: implement better 404 for unimplemented scim endpoints (#15232)
Prior to this, html was returned.
2024-10-25 13:23:12 -04:00
Colin Adler 487b37b228 feat(enterprise): support bearer tokens in SCIM authentication (#15233) 2024-10-25 11:52:57 -05:00
Garrett Delfosse 0dd942e197 fix: stop incrementing activity on empty agent stats (#15204) 2024-10-25 16:49:44 +00:00
Jon Ayers 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
Steven Masley 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
Cian Johnston 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
Cian Johnston 5ad47471b5 chore(provisioner/terraform): extract terraform parsing logic to package tfparse (#15230)
Related to https://github.com/coder/coder/issues/15087

Extracts the logic for extracting variables and workspace tags
to a separate package `tfparse`.

---------

Co-authored-by: Danielle Maywood <danielle@themaywoods.com>
2024-10-25 14:48:12 +01:00
Spike Curtis 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
Cian Johnston 5bcaa93198 chore(enterprise/coderd/license): fix time-related flake in license expiration warning test (#15228)
Fixes a time-related test flake in enterprise/coderd/license/license_test.go
2024-10-25 12:19:50 +01:00
Eric Paulsen b62f3e6af5 feat(helm): add topologySpreadConstraints value (#15168) 2024-10-25 09:14:39 +01:00
Vincent Vielle 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
Steven Masley f258232be9 chore: return json for disabled scim routes (#15222)
Customers reporting html pages returned to SCIM. Likely a disabled SCIM.
We should just report a more consumable error by the SCIM provider.

Previous behavior was a status code 200 HTML page
2024-10-24 16:26:16 -04:00
Garrett Delfosse 81e99bec6b fix: close server pty connections on client disconnect (#15201) 2024-10-24 15:12:35 -04:00
Colin Adler 69c1d981e3 fix(site): sanitize login redirect (#15208) 2024-10-24 13:59:26 -05:00
Charlie Voiselle 7efdf811ae chore: fix incorrect quote in Workspace Delete confirmation modal (#15216)
Tiny PR to change left-hand double quote on right side to right-hand double quote.
2024-10-24 14:43:10 -04:00
Danielle Maywood 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
Jon Ayers bcd68ee249 fix: fix build in security workflow (#15209)
- Fixes an issue where building the Docker image failed due to moving
the directory hosting the Dockerfile
- Removed the Palo Alto scanning since our subscription there is set to
expire. Trivy is still running though.
2024-10-24 01:21:18 +01:00
Steven Masley 163631e79c chore: use system context for fetching template information (#15205)
The authz check is Update() on the original template. This is not ideal,
but it follows the existing behavior. We are implicitly granting this
read access since template admins need to be able to see what
users/groups exist to assign.
2024-10-23 17:03:17 -05:00
Cian Johnston fed70bdeb8 fix(helm/coder): set serviceAccount.disableCreate=false by default, add tests (#15197)
* Sets `serviceaccount.disableCreate=false` by default (accidentally
changed by #14817)
* Reverts changes made in https://github.com/coder/coder/pull/15196
2024-10-23 21:11:02 +01:00
Edward Angert 0fba291ffe docs: add date to Quickstart guide (#15199)
and try to trick the CI into passing + building the page 😬

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-10-23 12:56:17 -05:00
Ethan 57386ed677 fix: make helm golden files to fix ci (#15196)
The go tests that would have checked for the outdated golden files
didn't get run as part of https://github.com/coder/coder/pull/14817
because only `helm/**` files were modified.
2024-10-23 08:38:52 -07:00
Edward Angert ed5da65a54 chore(docs): add Quickstart doc to tutorials (#14744)
New doc to get users up and running quickly

preview: https://coder.com/docs/@quickstart-guide/tutorials/quickstart

## To Do

- [x] update or remove Codium steps
- [x] add to sidebar
- [x] add to README and others as needed
- [x] reference https://github.com/coder/coder/pull/11946 and the
discussion to influence this PR

closes https://github.com/coder/internal/issues/107

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-10-23 11:31:29 -04:00
Edward Angert d7baa49d6d docs: add primary to wsproxy ls (#15185)
Add primary to `coder wsproxy ls` results in
<https://coder.com/docs/admin/networking/workspace-proxies#step-2-deploy-the-proxy>

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-10-23 11:15:55 -04:00
Edward Angert 20a9e9bdfb chore(docs): remove workspace proxy map (#15070)
remove workspace proxy map

- replace later with another image or diagram

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2024-10-23 11:15:32 -04:00
Bruno Quaresma d89ecebb4e feat(site): add workspace timings (#15068)
Demo:

https://github.com/user-attachments/assets/046a7224-48e4-4e66-a2ff-a8e1252ad18b
2024-10-23 10:09:37 -03:00
MaxTNielsen cd92220ab8 feat(helm): add setting to disable service account creation (#14817)
Add a setting to disable service account creation
2024-10-23 13:25:57 +01:00
dependabot[bot] b828412edd chore: bump google.golang.org/api from 0.201.0 to 0.202.0 (#15188)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 03:05:58 -07:00
Cian Johnston 84f0cf215f chore(docs): update external provisioners helm docs (#15155)
Closes https://github.com/coder/coder/issues/14985

Updates external provisioner documentation to show steps for using
provisioner keys via Helm:

---------

Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
2024-10-23 09:25:53 +01:00
dependabot[bot] f61c59fed9 chore: bump github.com/unrolled/secure from 1.14.0 to 1.17.0 (#15187)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 07:54:32 +00:00
dependabot[bot] b7f9c1aa2e chore: bump google.golang.org/api from 0.200.0 to 0.201.0 (#15162)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 07:51:05 +00:00
dependabot[bot] d613390162 chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.68.0 to 1.69.0 (#15160)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 07:50:28 +00:00
dependabot[bot] 6cad5dbd52 chore: bump github.com/chromedp/chromedp from 0.10.0 to 0.11.0 (#15159)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 07:49:20 +00:00
dependabot[bot] fa6c859e83 chore: bump github.com/aws/aws-sdk-go-v2/config from 1.27.27 to 1.28.0 (#15161)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 07:48:52 +00:00
dependabot[bot] eabf618479 chore: bump go.uber.org/mock from 0.4.0 to 0.5.0 (#15163)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 07:48:20 +00:00
dependabot[bot] b67a850659 ci: bump the github-actions group with 4 updates (#15158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 12:40:46 +05:00
Spike Curtis 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
Steven Masley 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
Danielle Maywood 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
Vincent Vielle 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
Cian Johnston c42f487668 fix(helm/provisioner): fail if psk and key are both set (#15157)
Relates to https://github.com/coder/coder/issues/14985

Context:
https://github.com/coder/coder/pull/15122#discussion_r1808458819

Specifying both `provisionerDaemon.pskSecretName` and
`provisionerDaemon.keySecretName` will now result in an error.

This prevents a potential `CrashLoopBackoff` debug session due to the
following error:

```
error: cannot provide both provisioner key --key and pre-shared key --psk
```
2024-10-22 08:38:47 +01:00
Bruno Quaresma 76bfa9ba17 fix(site): fix validation server error on change password form (#15170)
Before:


![image](https://github.com/user-attachments/assets/4fd83c78-4d30-4a92-af2c-7c986a03b426)

After:

<img width="528" alt="Screenshot 2024-10-21 at 13 07 34"
src="https://github.com/user-attachments/assets/797ddeaa-8fb4-4d22-9a1b-93809b92432b">


Fix https://github.com/coder/coder/issues/15152
2024-10-21 16:22:29 +00:00
Cian Johnston 212aeff724 fix(cli): fix potential panic in traceError if unwrapped err is nil (#15166)
Seen while investigating #12721:

Root cause was a developer error, but this definitely shouldn't panic.

Before:
```
/ # coder stat
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1f12eb0]

goroutine 1 [running]:
github.com/coder/coder/v2/cli.traceError({0x90e89a0?, 0x40007a8210})
        /home/runner/work/coder/coder/cli/root.go:1119 +0x70
github.com/coder/coder/v2/cli.cliHumanFormatError({0x40003065a0, 0x1c8}, {0x90e89a0, 0x40007a8210}, 0x40007a81e0?)
        /home/runner/work/coder/coder/cli/root.go:985 +0x190
github.com/coder/coder/v2/cli.cliHumanFormatError({0x40000d0f00, 0x139}, {0x90e89a0, 0x40007a81e0}, 0x40001c4480?)
        /home/runner/work/coder/coder/cli/root.go:985 +0x1d8
github.com/coder/coder/v2/cli.cliHumanFormatError({0x40000d0b40, 0xf}, {0x90e5f00, 0x40006a3a80}, 0x90e5d40?)
        /home/runner/work/coder/coder/cli/root.go:985 +0x1d8
github.com/coder/coder/v2/cli.cliHumanFormatError({0x0, 0x0}, {0x90e5ce0, 0x40003b14c0}, 0x2?)
        /home/runner/work/coder/coder/cli/root.go:985 +0x1d8
github.com/coder/coder/v2/cli.formatRunCommandError(0x40007a8108, 0x400079fce7)
        /home/runner/work/coder/coder/cli/root.go:1057 +0x30c
github.com/coder/coder/v2/cli.cliHumanFormatError({0x0, 0x0}, {0x90e5ec0, 0x40007a8108}, 0xaa0aed0?)
        /home/runner/work/coder/coder/cli/root.go:980 +0xe0
github.com/coder/coder/v2/cli.cliHumanFormatError({0x0, 0x0}, {0x90e5160, 0x40007a8120}, 0x90e50e0?)
        /home/runner/work/coder/coder/cli/root.go:966 +0x144
github.com/coder/coder/v2/cli.(*PrettyErrorFormatter).Format(0x400079fda0, {0x90e5160?, 0x40007a8120?})
        /home/runner/work/coder/coder/cli/root.go:927 +0x48
github.com/coder/coder/v2/cli.(*RootCmd).RunWithSubcommands(0x400068ed80, {0x400053a2c8, 0x30, 0x57})
        /home/runner/work/coder/coder/cli/root.go:175 +0x278
main.main()
        /home/runner/work/coder/coder/enterprise/cmd/coder/main.go:11 +0x40
```

After:
```
Encountered an error running "coder stat", see "coder stat --help" for more information
error: <nil>
```
2024-10-21 17:12:57 +01:00
Danielle Maywood 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
Danielle Maywood 13f6645ab9 fix(cli): improve container detection when cgroupns=private (#15156)
Fixes https://github.com/coder/coder/issues/12721

If a container in docker is started with `--cgroupns=private` (which is
the default behaviour in docker) then `/proc/1/cgroup` has the following
content:
```
0::/
```

If a container in docker is started with `--cgroupns=host` then
`/proc/1/cgroup` has the following content (hash will vary):
```
0::/docker/aa86ac98959eeedeae0ecb6e0c9ddd8ae8b97a9d0fdccccf7ea7a474f4e0bb1f
```

Currently we are determining if a host is containerized by assuming the
second scenario. This means the existing behaviour of sniffing
`/proc/1/cgroup` is not always sufficient for checking if a host is
containerized.

According to [the cgroups(7)
man-page](https://man7.org/linux/man-pages/man7/cgroups.7.html) there
exists a `cgroup.type` file in a nonroot cgroup. This exists in Linux
versions after `4.14`.

> Linux 4.14 added thread mode for cgroups v2.

> With the addition of thread mode, each nonroot cgroup now contains a
new file, cgroup.type

This means we can check for the existence of
`/sys/fs/cgroup/cgroup.type` to see if we are in a container or not.
2024-10-21 15:28:32 +01:00
Ethan c5a4095610 fix: include custom agent headers in tailnet to support DERP connections (#15145)
Fixes #15131.
2024-10-21 20:59:21 +11:00
Spike Curtis 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
Spike Curtis 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
Danny Kopping b9d441ff5f fix: use concurrency-safe bytes buffer to avoid race (#15142)
Fixes https://github.com/coder/internal/issues/93

`bytes.Buffer` is not concurrency-safe.

`cmd` could write to the buffer concurrently while we're reading the
buffer in

```
require.Eventually(t, func() bool {
	return bytes.Contains(output.Bytes(), []byte("ERROR: Downloaded agent binary returned unexpected version output"))
}, testutil.WaitShort, testutil.IntervalSlow)
```

Not sure about the `os: process already finished` flake, though.

---------

Signed-off-by: Danny Kopping <danny@coder.com>
2024-10-21 17:24:18 +11:00
Ethan 9b8e707517 chore: skip ssh exec-ing test on windows (#15146)
See coder/internal#117
2024-10-21 04:17:20 +00:00
Kayla Washburn-Love d2c1562a94 chore: cleanup some query handling (#15130) 2024-10-18 11:35:55 -06:00
Bruno Quaresma 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
Cian Johnston 413928b57a feat(helm/provisioner): add support for provisioner keys, add note re psk (#15122)
- Adds `provisionerDaemon.keySecretName` and
`provisionerDaemon.keySecretKey`
- Omitting `provisionerDaemon.pskSecretName` will now cause the PSK
secret to no longer be created.
- Adds a note in `NOTES.txt` regarding provisioner PSKs.
- Adds validation that either `provisionerDaemon.keySecretName` or
`provisionerDaemon.pskSecretName` is specified, and will fail the
install in this case.
2024-10-18 11:33:33 +01:00
Spike Curtis d18e8304d6 fix: reduce parallelism and increase worker size on go-test-race (#15106)
Sets parallelism on go-test-race to 4 concurrent tests and 4 concurrent
packages. Increases to 16-core runner.
2024-10-18 10:45:31 +04:00
jatin 7f98fa3abb chore: remove duplicated harden-runner step (#15127) 2024-10-17 13:12:57 -05:00
Garrett Delfosse b54950cc6e fix: order provisioner keys by creation date (#15125)
Closes https://github.com/coder/internal/issues/110

The flake reported in the issue has already been fixed by
https://github.com/coder/coder/pull/14875, but this further covers that
we return a list the same order every time.
2024-10-17 13:57:52 -04:00
Garrett Delfosse 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
Ethan c81fd1d868 fix: correct default wsproxy table columns (#15124)
Closes #15123
2024-10-17 13:09:53 +00:00
Marcin Tojek bab17a3556 test: improve logging around TestAgentScript (#15121) 2024-10-17 13:06:34 +02:00
Joobi S B 5ebc748e94 feat: allow promoting an existing template version to active from CLI (#15051)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-10-17 14:15:14 +05:00
Ethan 46cce333b1 fix: check unstaged files during ci lint (#15120) 2024-10-17 05:37:43 +00:00
Kayla Washburn-Love 40fb57aa23 chore: turn e2e enterprise tests into e2e premium tests (#14979) 2024-10-16 16:54:30 -06:00
Vincent Vielle 02f6203dc7 chore(cli): rename build options to ephemeral parameters in cli (#15030)
This PR aims to rename `build-option` to `ephemeral-parameters` based on
#10488 conversation.

`build-option` has been renamed `ephemeral-parameter` and can be used to
define a value for an ephemeral parameter in the template.

`build-options` has been renamed `prompt-ephemeral-parameters` and can
be used to prompt the user to put values for the ephemeral parameters in
the template.

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
Co-authored-by: defelmnq <yvincent@coder.com>
2024-10-16 23:54:12 +02:00
Colin Adler 512cbf1682 chore: update github.com/gomarkdown/markdown (#15112) 2024-10-16 20:03:12 +00:00
Sas Swart 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
Jon Ayers f537193682 chore: refactor keycache implementation to reduce duplication (#15100) 2024-10-16 20:01:45 +01:00
Muhammad Atif Ali 8e254cbb07 chore: integrate step-security/harden-runner in workflows (#15099)
Redoing #15097
Part of #14879
2024-10-16 11:23:00 -07:00
Vincent Vielle ccbb687ca0 feat(cli): extend duration to longer units (#15040)
This PR is a proposal to improve the situation described in #14750 

For some precise commands - we would like to be able to use durations
bigger than hours, minutes..

This PR extends the Duration proposed by Go with : 
- `d` - a day or 24hours.
- `y` - a year or 365 days.

I also removed the default value for lifetime and instead fetch the
maxLifetime value from codersdk - so by default if no value set we use
the value defined in the config.
2024-10-16 17:02:56 +02:00
Steven Masley 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
Marcin Tojek 416d67ba2c test: use barrier in TestInflightDispatchesMetric (#15107)
Fixes: https://github.com/coder/internal/issues/109
2024-10-16 14:12:19 +02:00
Marcin Tojek 21feb42fc4 test: ignore slog errors in TestUserLatencyInsights (#15105) 2024-10-16 13:20:28 +02:00
Spike Curtis d676ad56fe chore: log provider stack traces on text file busy (#15078)
re: #14726

If we see "text file busy" in the errors while initializing terraform,
attempt to query the pprof endpoint set up by
https://github.com/coder/terraform-provider-coder/pull/295 and log at
CRITICAL.

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2024-10-16 14:29:09 +04:00
Spike Curtis a77c9079af fix: pin shfmt to 3.7.0 in dogfood to match CI (#15103)
Pins our dogfood Dockerfile to match CI version of `shfmt`
2024-10-16 14:17:27 +04:00
Marcin Tojek 2564f9c823 test: scaletest/reconnectingpty: use TerminalReader (#15079)
Fixes: https://github.com/coder/internal/issues/98
2024-10-16 11:10:32 +02:00
Spike Curtis 687b4dd41c fix: match go version in go.mod and CI (#15104)
Causing CI to re-download Go to match the version in go.mod, and failing
on Windows, e.g.
https://github.com/coder/coder/actions/runs/11361195564/job/31600881001
2024-10-16 12:23:48 +04:00
Cian Johnston 29763b1b4c chore(docs): add notes regarding provisioner tags and untagged jobs (#15081)
Relates to https://github.com/coder/coder/issues/15047

---------

Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
2024-10-16 09:22:39 +01:00
Sas Swart 75b5d71216 fix(docs): fix a typo in the devcontainer documentation (#15102)
This PR fixes a minor typo in our documentation:
https://coder.com/docs/admin/templates/managing-templates/devcontainers
2024-10-16 10:05:31 +02:00
Sas Swart 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
dependabot[bot] 5317c500c8 ci: bump aquasecurity/trivy-action from 0.25.0 to 0.27.0 in the github-actions group (#15061)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 23:28:04 +05:00
dependabot[bot] cc0b264d36 chore: bump google.golang.org/api from 0.199.0 to 0.200.0 (#15063)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-15 23:27:22 +05:00
Cian Johnston 06a40185cb chore(examples): add missing devcontainer templates to examples.go (#15080) 2024-10-15 17:26:42 +01:00
Cian Johnston 89ff48744c chore(docs): fix broken or missing links (#15085)
Fixes a number of TODOs and broken links.
2024-10-15 16:50:49 +01:00
Vincent Vielle 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
Bruno Quaresma b8420ecaaf test(coderd): fix flake on TestWorkspaceBuildTimings (#15077)
Fix https://github.com/coder/coder/issues/15073
2024-10-15 09:43:39 -03:00
Marcin Tojek 1523d935b5 test: skip scaletest/reconnectingpty Test_Runner (#15076)
Related: https://github.com/coder/internal/issues/98
2024-10-15 12:40:22 +00:00
Marcin Tojek c6396e3125 test: skip scaletest/reconnectingpty Test_Runner (#15075)
Related: https://github.com/coder/internal/issues/98
2024-10-15 14:07:45 +02:00
Spike Curtis 17f2584318 fix: add psmock to gen and make-fresh targets (#15072)
Fixes

```
+ make -j build/coder_linux_amd64 build/coder_linux_arm64 build/coder_linux_armv7 build/coder_2.16.0-devel+7da231bc9_windows_amd64.zip build/coder_2.16.0-devel+7da231bc9_linux_amd64.tar.gz build/coder_2.16.0-devel+7da231bc9_linux_amd64.deb
coderd/database/pubsub/psmock/doc.go:4: running "mockgen": exec: "mockgen": executable file not found in $PATH
make: *** [Makefile:569: coderd/database/pubsub/psmock/psmock.go] Error 1
```

during builds.
2024-10-15 08:49:26 +00:00
Spike Curtis 3565227d02 chore: disable erroneous linting of function names in vpn (#15055)
Disables bogus linting e.g. https://github.com/coder/coder/actions/runs/11305350065/job/31444754200?pr=15011
2024-10-15 11:45:56 +04:00
Jon Ayers 7da231bc92 fix: fix error handling to prevent spam in proc prio management (#15071) 2024-10-15 02:17:10 +00:00
Jon Ayers 384873a114 feat: add wsproxy implementation for key fetching (#14917) 2024-10-14 20:04:10 +01:00
Stephen Kirby 531565645f chore(docs): make version support more explicit (#14785)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-10-14 18:05:25 +00:00
Edward Angert 88c6a75d48 docs: reorganize and edit docs README (#14706)
Edit the docs readme for consistency and better flow

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-10-14 13:39:54 -04:00
Muhammad Atif Ali 57a65c15bf chore: use commit sha for GitHub actions (#15019)
Use specific commit SHAs for GitHub actions across various workflows to
enhance reliability and reproducibility. This change ensures that
actions run against a known version, reducing the risk of unexpected
issues due to updates in the third-party action repositories.

This contributes to improving the score in #14879
2024-10-14 08:49:55 -07:00
Sas Swart 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
Bruno Quaresma 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
Phorcys 79d24d2101 feat: allow for different docker socket path in docker-based templates (#15035) (#15049)
This PR fixes #15035, I have tested it on my instance and it works as
expected.
2024-10-12 21:35:52 +02:00
dependabot[bot] 3eb2b5573b chore: bump github.com/jedib0t/go-pretty/v6 from 6.5.0 to 6.6.0 (#15007)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 11:47:34 +00:00
dependabot[bot] 914ce1b43a chore: bump protobufjs from 7.2.5 to 7.4.0 in /site (#14951)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 16:41:58 +05:00
dependabot[bot] 0fe4650c7a chore: bump the vite group across 1 directory with 3 updates (#14898)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 16:40:28 +05:00
dependabot[bot] 61287dc60c chore: bump github.com/tidwall/gjson from 1.17.0 to 1.18.0 (#15003)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 16:40:09 +05:00
dependabot[bot] dee694ca46 chore: bump github.com/aws/aws-sdk-go-v2 from 1.31.0 to 1.32.2 (#15046)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 16:39:44 +05:00
dependabot[bot] bb8c7e7e35 chore: bump github.com/aws/smithy-go from 1.21.0 to 1.22.0 (#15004)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 16:39:30 +05:00
dependabot[bot] 23b1515514 chore: bump github.com/open-policy-agent/opa from 0.68.0 to 0.69.0 (#15010)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 04:39:10 -07:00
dependabot[bot] 6cc1b975e5 chore: bump github.com/valyala/fasthttp from 1.55.0 to 1.56.0 (#15008)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 04:38:59 -07:00
dependabot[bot] bac4fcb73b chore: bump github.com/prometheus/common from 0.59.1 to 0.60.0 (#15009)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 11:36:00 +00:00
dependabot[bot] 994e807140 chore: bump the react group across 2 directories with 1 update (#14946)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 16:25:29 +05:00
Muhammad Atif Ali 20b3f8fbf3 chore: use a smaller runner for e2e test (#15034)
We run our e2e-tests on a 16-core machine with `--max-workers=1`
Using a standard runner with 2 cores, the machine runs the tests in the
same amount of time while reducing the cost 8 times.

Update: `test-e2e` fails on the 2core-8GB runner, so using a 4-core-16GB runner for that.
2024-10-12 11:23:13 +00:00
Joobi S B 191449078c feat: implement feature to support template version while creating workspace using cli (#14880) 2024-10-11 18:00:11 +05:00
Vincent Vielle 0ef5340d20 fix: change message when trying to update a workspace already up-to-date (#14975)
Related to #14940  -

We replace the wording from Workspace isn't outdated to Workspace is
up-to-date when the workspace already is up-to-date.
2024-10-10 12:56:53 +02:00
Muhammad Atif Ali ab6cb1a787 docs: fix links for revere-proxy docs (#15026) 2024-10-10 05:31:19 +00:00
Sas Swart 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
Joobi S B 26df33ac88 docs: explain --rich-parameter-file format (#14941) 2024-10-09 09:34:24 +05:00
dependabot[bot] a0787b71a1 chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.67.0 to 1.68.0 (#15005)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-08 09:13:45 +05:00
dependabot[bot] 71d31713c5 ci: bump the github-actions group across 1 directory with 2 updates (#15016)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-10-08 09:04:43 +05:00
dependabot[bot] 93e3c868eb chore: bump google.golang.org/api from 0.197.0 to 0.199.0 (#15006)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-08 08:58:55 +05:00
dependabot[bot] a33c38d46d chore: bump the x group with 6 updates (#15001)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-08 08:33:00 +05:00
Muhammad Atif Ali 5afd022443 chore(README.md): add setup coder GitHub action link (#14991) 2024-10-08 08:10:59 +05:00
Muhammad Atif Ali e8d5fdfb1a chore: add OpenSSF badge (#15012) 2024-10-08 08:05:33 +05:00
Vincent Vielle 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
dependabot[bot] 3046f5c959 chore: bump @fontsource/ibm-plex-mono from 5.0.5 to 5.1.0 in /site (#14958)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 14:46:43 +05:00
dependabot[bot] 7c7060f6a1 chore: bump @types/react-color from 3.0.6 to 3.0.12 in /site (#14954)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 02:44:54 -07:00
dependabot[bot] e017d22e1b chore: bump eslint-config-next from 14.2.13 to 14.2.14 in /offlinedocs (#14947)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 14:44:23 +05:00
dependabot[bot] 919fe9c632 chore: bump ssh2 and @types/ssh2 in /site (#14953)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 02:44:07 -07:00
dependabot[bot] 7f5db44ef6 chore: bump micromatch from 4.0.7 to 4.0.8 in /site (#14996)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 14:43:46 +05:00
dependabot[bot] 4516f5d79c chore: bump express from 4.20.0 to 4.21.0 in /site (#14959)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 14:09:18 +05:00
Muhammad Atif Ali b815fcc150 chore(docs): fix a wrong link in v2.0.0 changelog (#14994) 2024-10-07 12:38:44 +05:00
Muhammad Atif Ali 61a41027fc chore(README.md): add openssf best practices badge (#14938)
In preparation for #14879
2024-10-05 11:12:15 -07:00
Muhammad Atif Ali 999ae7ba56 chore(docs): fix broken links and update file paths (#14990) 2024-10-05 18:08:50 +00:00
Stephen Kirby 9eefd2a636 chore(docs): correct broken links in restructure (#14989)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-10-05 17:44:02 +00:00
Muhammad Atif Ali 163f96b71a fix(docs/admin/security): fix broken link of CVE (#14988) 2024-10-05 17:21:27 +00:00
Muhammad Atif Ali 419eba5fb6 docs: restructure docs (#14421)
Closes #13434 
Supersedes #14182

---------

Co-authored-by: Ethan <39577870+ethanndickson@users.noreply.github.com>
Co-authored-by: Ethan Dickson <ethan@coder.com>
Co-authored-by: Ben Potter <ben@coder.com>
Co-authored-by: Stephen Kirby <58410745+stirby@users.noreply.github.com>
Co-authored-by: Stephen Kirby <me@skirby.dev>
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
2024-10-05 10:52:04 -05:00
Spike Curtis 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
Jaayden Halko ea3b13c78e chore: storybook additions and cleanup (#14968) 2024-10-04 16:19:24 -04:00
dependabot[bot] 7d281c308f chore: bump storybook from 8.1.11 to 8.3.5 in /site (#14977) 2024-10-04 12:06:59 -03:00
dependabot[bot] 53adbaea70 chore: bump micromatch from 4.0.5 to 4.0.8 in /offlinedocs (#14969)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-04 19:11:11 +05:00
dependabot[bot] 1c60622eba chore: bump rollup from 4.20.0 to 4.24.0 in /site (#14970) 2024-10-04 19:03:25 +05:00
Marcin Tojek 9acf6acd76 test: use static port for Prometheus (#14972)
Fixes: https://github.com/coder/internal/issues/92
2024-10-04 13:17:18 +02:00
Danielle Maywood 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
Spike Curtis 8785a51b09 feat: include Coder service prefix on agents (#14944)
fixes #14715

Configures agents to use an address both in the Tailscale service prefix and the new Coder service prefix. Also modifies the Coordinator auth to allow the new prefix.

Updates `coder/tailscale` to include https://github.com/coder/tailscale/pull/62 which fixes a bug around forwarding TCP connections to localhost.  This functionality is tested in the modifications to `TestAgent_Dial`.
2024-10-04 10:16:33 +04:00
Spike Curtis 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
Jon Ayers 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
Steven Masley 50d9206950 chore: fix rbac_gen to allow parallel make gen (#14966)
Closes https://github.com/coder/coder/issues/14702
2024-10-03 20:28:04 -05:00
Kayla Washburn-Love 8b6a06dbd5 chore: consolidate ManageSettingsLayout code (#14885)
Clean up a bunch of tangles that only existed to service the
`"multi-organization"` experiment, which has now been removed
2024-10-03 22:00:52 +00:00
dependabot[bot] 04af56d54b chore: bump @testing-library/react from 14.1.0 to 14.3.1 in /site (#14950) 2024-10-03 14:20:58 -06:00
dependabot[bot] cc7899cc7d chore: bump uuid from 9.0.0 to 9.0.1 in /site (#14956)
Bumps [uuid](https://github.com/uuidjs/uuid) from 9.0.0 to 9.0.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md">uuid's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1">9.0.1</a>
(2023-09-12)</h2>
<h3>build</h3>
<ul>
<li>Fix CI to work with Node.js 20.x</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/uuidjs/uuid/commit/b3f142f7efa6d335cd667413b8a5860d2dd04ebf"><code>b3f142f</code></a>
chore(release): 9.0.1</li>
<li><a
href="https://github.com/uuidjs/uuid/commit/fc5d64346a8a93324b7f8f87bdc6b96164f35ba0"><code>fc5d643</code></a>
chore: add node@12 back to CI, update readme (<a
href="https://redirect.github.com/uuidjs/uuid/issues/733">#733</a>)</li>
<li><a
href="https://github.com/uuidjs/uuid/commit/462128b660e477c8878a991073547c01ffaf76e6"><code>462128b</code></a>
ci: update node versions for cI (<a
href="https://redirect.github.com/uuidjs/uuid/issues/732">#732</a>)</li>
<li><a
href="https://github.com/uuidjs/uuid/commit/4de23a6030e65ac72b3b015680f08e7e292681ed"><code>4de23a6</code></a>
test: remove missing getRandomValues test (<a
href="https://redirect.github.com/uuidjs/uuid/issues/709">#709</a>)</li>
<li><a
href="https://github.com/uuidjs/uuid/commit/6eef540aa3407b15e1e7573f45ff17098e9343ea"><code>6eef540</code></a>
chore: adapt bundlewatch config to new main branch name (<a
href="https://redirect.github.com/uuidjs/uuid/issues/705">#705</a>)</li>
<li><a
href="https://github.com/uuidjs/uuid/commit/60ffc406a38128f6dbc8c1d581681843dcf5d0c1"><code>60ffc40</code></a>
chore: run npm audit fix for json5 (<a
href="https://redirect.github.com/uuidjs/uuid/issues/704">#704</a>)</li>
<li><a
href="https://github.com/uuidjs/uuid/commit/862562e7a20834532045ecf45266c391cf12e5c7"><code>862562e</code></a>
ci: run browser tests on pull_request_target (<a
href="https://redirect.github.com/uuidjs/uuid/issues/703">#703</a>)</li>
<li><a
href="https://github.com/uuidjs/uuid/commit/e6b0c909b47f963b63e594bdafa31e958bf2a4d3"><code>e6b0c90</code></a>
chore: minor typos in non-code areas (<a
href="https://redirect.github.com/uuidjs/uuid/issues/702">#702</a>)</li>
<li><a
href="https://github.com/uuidjs/uuid/commit/8f028c4ea42ce41a9a9dc5fa634abe525b2e2066"><code>8f028c4</code></a>
chore: upgrade and fix the stale-issues workflow (<a
href="https://redirect.github.com/uuidjs/uuid/issues/699">#699</a>)</li>
<li><a
href="https://github.com/uuidjs/uuid/commit/1ebda6cbfe9ec731a6f6f80c8b1938267a97afbb"><code>1ebda6c</code></a>
chore: add SECURITY.md, fixes <a
href="https://redirect.github.com/uuidjs/uuid/issues/696">#696</a> (<a
href="https://redirect.github.com/uuidjs/uuid/issues/697">#697</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=uuid&package-manager=npm_and_yarn&previous-version=9.0.0&new-version=9.0.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 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>
2024-10-03 23:50:57 +05:00
dependabot[bot] 496b486a2d chore: bump monaco-editor from 0.50.0 to 0.52.0 in /site (#14957)
Bumps [monaco-editor](https://github.com/microsoft/monaco-editor) from
0.50.0 to 0.52.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/microsoft/monaco-editor/releases">monaco-editor's
releases</a>.</em></p>
<blockquote>
<h2>v0.52.0</h2>
<h2>Changes:</h2>
<ul>
<li><a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4691">#4691</a>:
Prepare monaco-editor for release 0.52</li>
<li><a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4665">#4665</a>:
Updates nvm to align with vscode nvm file.</li>
<li><a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4652">#4652</a>:
Removing <code>editor.main.nls.js</code></li>
</ul>
<p>This list of changes was <a
href="https://dev.azure.com/monacotools/Monaco/_build/results?buildId=294033&amp;view=logs">auto
generated</a>.</p>
<h2>v0.52.0-rc2</h2>
<h2>Changes:</h2>
<ul>
<li><a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4665">#4665</a>:
Updates nvm to align with vscode nvm file.</li>
<li><a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4652">#4652</a>:
Removing <code>editor.main.nls.js</code></li>
</ul>
<p>This list of changes was <a
href="https://dev.azure.com/monacotools/Monaco/_build/results?buildId=293791&amp;view=logs">auto
generated</a>.</p>
<h2>v0.51.0</h2>
<h2>Changes:</h2>
<ul>
<li><a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4649">#4649</a>:
Add changes for monaco editor release 0.51.0</li>
<li><a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4630">#4630</a>:
Remove locker and info-needed-closer workflows.</li>
<li><a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4573">#4573</a>:
Adding some detail in MAINTAINING.md for trigger build step</li>
<li><a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4586">#4586</a>:
Update Q# Keywords</li>
</ul>
<p>This list of changes was <a
href="https://dev.azure.com/monacotools/Monaco/_build/results?buildId=289445&amp;view=logs">auto
generated</a>.</p>
<h2>v0.51.0-rc3</h2>
<p>No release notes provided.</p>
<h2>v0.51.0-rc2</h2>
<p>No release notes provided.</p>
<h2>v0.51.0-rc</h2>
<p>No release notes provided.</p>
<h2>v0.51.0-dev-20240807</h2>
<p>No release notes provided.</p>
<h2>v0.51.0-dev-20240806</h2>
<p>No release notes provided.</p>
<h2>v0.51.0-dev-20240805</h2>
<p>No release notes provided.</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md">monaco-editor's
changelog</a>.</em></p>
<blockquote>
<h2>[0.52.0]</h2>
<ul>
<li>Comment added inside of <code>IModelContentChangedEvent</code></li>
</ul>
<h2>[0.51.0]</h2>
<ul>
<li>New fields <code>IEditorOptions.placeholder</code> and
<code>IEditorOptions.compactMode</code></li>
<li>New fields <code>IGotoLocationOptions.multipleTests</code> and
<code>IGotoLocationOptions.alternativeTestsCommand</code></li>
<li>New field <code>IInlineEditOptions.backgroundColoring</code></li>
<li>New experimental field
<code>IEditorOptions.experimental.useTrueInlineView</code></li>
<li>New options <code>CommentThreadRevealOptions</code> for
comments</li>
</ul>
<p>Contributions to <code>monaco-editor</code>:</p>
<ul>
<li><a href="https://github.com/ScottCarda-MS"><code>@​ScottCarda-MS
(Scott Carda)</code></a>: Update Q# Keywords [PR <a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4586">#4586</a>](<a
href="https://redirect.github.com/microsoft/monaco-editor/pull/4586">microsoft/monaco-editor#4586</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/f6dc0eb8fce67e57f6036f4769d92c1666cdf546"><code>f6dc0eb</code></a>
Merge pull request <a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4691">#4691</a>
from microsoft/chubby-cardinal</li>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/53e8e1ce30a0b1e5c4ec57ebd67fa17a3ec007ef"><code>53e8e1c</code></a>
adding changelog md change</li>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/7959d5c66eff5d904852579c6c4718efebb8363d"><code>7959d5c</code></a>
update pacakge.json</li>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/3c7eb57085d23d24c3b5527c45324440ea55c865"><code>3c7eb57</code></a>
undo the package upgrade change</li>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/f262e8f93182869139f6789070607c928b91e8bb"><code>f262e8f</code></a>
Defines setInterval/setTimeout on faked globalThis in unit test</li>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/b31d22b9ee8e8081751069dc72d397f782cf8eb5"><code>b31d22b</code></a>
Updates nvm to align with vscode nvm file. (<a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4665">#4665</a>)</li>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/b8a83d53567c061c234f393899117988fd899c52"><code>b8a83d5</code></a>
Merge pull request <a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4652">#4652</a>
from microsoft/annoyed-dragon</li>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/e52ff427290808dff6809b3f77866ae7a62a119b"><code>e52ff42</code></a>
removing <code>editor.main.nls.js</code></li>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/67d664a32968e19e2eb08b696a92463804182ae4"><code>67d664a</code></a>
Merge pull request <a
href="https://redirect.github.com/microsoft/monaco-editor/issues/4649">#4649</a>
from microsoft/unique-locust</li>
<li><a
href="https://github.com/microsoft/monaco-editor/commit/88c558b55d10f6c15b79ae4249309df4c21c4a13"><code>88c558b</code></a>
adding changes for monaco editor release</li>
<li>Additional commits viewable in <a
href="https://github.com/microsoft/monaco-editor/compare/v0.50.0...v0.52.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=monaco-editor&package-manager=npm_and_yarn&previous-version=0.50.0&new-version=0.52.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>
2024-10-03 23:50:24 +05:00
Benjamin Peinhardt 20bfd1f874 fix: fix bug with trailing version info not being properly stripped (#14963)
Fixes a bug where excess version info was not being stripped properly from
documentation links.
2024-10-03 17:30:25 +00:00
Bruno Quaresma 52f03dbdf2 fix(site): fix build logs scrolling on safari (#14884)
Fix https://github.com/coder/coder/issues/9687
2024-10-03 13:27:35 -03:00
dependabot[bot] bcdb8a4c9f chore: bump @swc/jest from 0.2.24 to 0.2.36 in /site (#14955)
Bumps [@swc/jest](https://github.com/swc-project/pkgs) from 0.2.24 to
0.2.36.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/swc-project/pkgs/commits">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@swc/jest&package-manager=npm_and_yarn&previous-version=0.2.24&new-version=0.2.36)](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>
2024-10-03 10:33:37 -03:00
dependabot[bot] 31abfb2c04 chore: bump @chakra-ui/react from 2.8.2 to 2.9.3 in /offlinedocs (#14948)
Bumps
[@chakra-ui/react](https://github.com/chakra-ui/chakra-ui/tree/HEAD/packages/components/react)
from 2.8.2 to 2.9.3.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/chakra-ui/chakra-ui/commits/HEAD/packages/components/react">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@chakra-ui/react&package-manager=npm_and_yarn&previous-version=2.8.2&new-version=2.9.3)](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>
2024-10-03 10:33:25 -03:00
Spike Curtis 3d87f78ce5 docs: add statement about minimum network quality (#14745)
We've had some reports about difficulty connecting to workspaces under very challenging networking conditions. This PR adds some advice about minimum network quality when connecting to workspaces with Coder.
2024-10-03 16:37:05 +04:00
Roger Chao b4f26a8c78 docs: fix to provisioners.md to add a missing character (#14937)
Changed yaml example references from provisioneraemon: to
provisionerDaemon:
2024-10-02 17:50:08 -04:00
Stephen Kirby 3a48ba798d chore: set 2.13.x to "Not Supported" in release calendar (#14936) 2024-10-02 16:43:24 -05:00
Stephen Kirby a7d44150a8 docs: bump stable version to v2.15.1 (#14927)
This PR was automatically created by the [release
script](https://github.com/coder/coder/blob/main/scripts/release.sh).

Please review the changes and merge if they look good and the release is
complete.

You can follow the release progress
[here](https://github.com/coder/coder/actions/workflows/release.yaml)
and view the published release
[here](https://github.com/coder/coder/releases/tag/v2.15.1) (once
complete).
2024-10-02 16:14:40 -05:00
zx d0a8424819 feat: remove dark blue theme (#14890) 2024-10-02 09:30:33 -06:00
dependabot[bot] 0589267301 chore: bump react-router-dom from 6.24.0 to 6.26.2 in /site (#14908)
Bumps
[react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom)
from 6.24.0 to 6.26.2.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 11:05:16 -04:00
dependabot[bot] 7f66bf56a4 chore: bump @mui/x-tree-view from 7.13.0 to 7.18.0 (#14894)
Bumps the mui group with 1 update in the /site directory:
[@mui/x-tree-view](https://github.com/mui/mui-x/tree/HEAD/packages/x-tree-view).

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 10:51:58 -04:00
Michael Smith 680e28bdce fix: display workspace avatars correctly when URLs fail to load (#14814)
## Changes made
- Updated custom avatar components to favor background color by default
- Updated `AvatarData` component to let you manually specify the source
of the text used when images fail to load, and updated the orgs
breadcrumb segment to use it
- Added some logic for handling emoji images better
2024-10-02 14:46:25 +00:00
Marcin Tojek 0aa84b18a1 feat: expose Markdown fields in webhook payload (#14931)
Fixes: https://github.com/coder/coder/issues/14930
2024-10-02 15:38:22 +02:00
dependabot[bot] 2f043d7ab9 chore: bump @emotion/css from 11.13.0 to 11.13.4 in /site in the emotion group across 1 directory (#14896)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 08:28:51 +00:00
dependabot[bot] 4a4d2ecd60 chore: bump github.com/valyala/fasthttp from 1.55.0 to 1.56.0 (#14874)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 13:27:54 +05:00
Ethan b22bd816c9 fix: fix ci build running protoc (#14929) 2024-10-02 16:45:13 +10:00
dependabot[bot] 3c5a5ae2e0 chore: bump typescript from 5.5.4 to 5.6.2 in /offlinedocs (#14900)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 09:13:24 +05:00
Stephen Kirby 5507b58fe7 chore(docs): bump stable version (#14926) 2024-10-01 17:16:13 -05:00
dependabot[bot] f724b03a90 chore: bump typescript from 5.5.4 to 5.6.2 in /site (#14911) 2024-10-01 15:58:12 -06:00
dependabot[bot] e058d6c463 chore: bump @biomejs/biome from 1.8.3 to 1.9.3 in /site (#14914) 2024-10-01 15:25:30 -06:00
dependabot[bot] 414771e40d chore: bump @types/jest from 29.5.12 to 29.5.13 in /site in the jest group across 1 directory (#14897) 2024-10-01 21:02:41 +00:00
dependabot[bot] c4e37228f0 chore: bump storybook-addon-remix-react-router from 3.0.0 to 3.0.1 in /site (#14907)
Bumps
[storybook-addon-remix-react-router](https://github.com/JesusTheHun/storybook-addon-remix-react-router)
from 3.0.0 to 3.0.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/releases">storybook-addon-remix-react-router's
releases</a>.</em></p>
<blockquote>
<h2>v3.0.1</h2>
<h3>   🐞 Bug Fixes</h3>
<ul>
<li>Move package.json import to client side try <code>with</code> and
<code>assert</code>  -  by <a
href="https://github.com/JesusTheHun"><code>@​JesusTheHun</code></a> <a
href="https://github.com/JesusTheHun/storybook-addon-react-router-v6/commit/9972434"><!--
raw HTML omitted -->(99724)<!-- raw HTML omitted --></a></li>
</ul>
<h5>    <a
href="https://github.com/JesusTheHun/storybook-addon-react-router-v6/compare/v3.0.0...v3.0.1">View
changes on GitHub</a></h5>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/96bfaeb923db9513bccea69dabe13f76655b8521"><code>96bfaeb</code></a>
ci: use npm unambiguous syntax</li>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/83d0c3b079706c3689d2adda2eaa7d94d241319e"><code>83d0c3b</code></a>
ci: use npm unambiguous syntax</li>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/99724340000c24198db323ff96cde8df42a4ca16"><code>9972434</code></a>
fix: move package.json import to client side</li>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/85777c95205cf26734b66340db842d5743a48e11"><code>85777c9</code></a>
chore: remove obsolete argument</li>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/96b3af6cb06724c1c4f712357daa6785d2413522"><code>96b3af6</code></a>
docs: less alarming rename message</li>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/e8b13193d2fe560ed76d64c274db8791a70cf7de"><code>e8b1319</code></a>
docs: fix badges [skip ci]</li>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/fb1dfc9e5856044fcbeb00731300f22178833b77"><code>fb1dfc9</code></a>
docs: use legacy npm badge to avoid user confusion</li>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/77a194c0737257daee24bc376ca8610506b6a9a3"><code>77a194c</code></a>
ci: remove duplicate issue template [skip ci]</li>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/829510bdf5feb8699906393d2f319cdb9cebf33f"><code>829510b</code></a>
ci: test on push, release manually</li>
<li><a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/commit/c39e21662e7ba1b3ac48dab656de4a67eef68c2f"><code>c39e216</code></a>
Merge remote-tracking branch 'origin/main'</li>
<li>Additional commits viewable in <a
href="https://github.com/JesusTheHun/storybook-addon-remix-react-router/compare/v3.0.0...v3.0.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=storybook-addon-remix-react-router&package-manager=npm_and_yarn&previous-version=3.0.0&new-version=3.0.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 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>
2024-10-02 01:37:42 +05:00
dependabot[bot] ef54a0b8f6 chore: bump next from 14.2.10 to 14.2.14 in /offlinedocs (#14924)
Bumps [next](https://github.com/vercel/next.js) from 14.2.10 to 14.2.14.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/next.js/releases">next's
releases</a>.</em></p>
<blockquote>
<h2>v14.2.14</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>Fix: clone response in first handler to prevent race (<a
href="https://redirect.github.com/vercel/next.js/issues/70082">#70082</a>)
(<a
href="https://redirect.github.com/vercel/next.js/issues/70649">#70649</a>)</li>
<li>Respect reexports from metadata API routes (<a
href="https://redirect.github.com/vercel/next.js/issues/70508">#70508</a>)
(<a
href="https://redirect.github.com/vercel/next.js/issues/70647">#70647</a>)</li>
<li>Externalize node binary modules for app router (<a
href="https://redirect.github.com/vercel/next.js/issues/70646">#70646</a>)</li>
<li>Fix revalidateTag() behaviour when invoked in server components (<a
href="https://redirect.github.com/vercel/next.js/issues/70446">#70446</a>)
(<a
href="https://redirect.github.com/vercel/next.js/issues/70642">#70642</a>)</li>
<li>Fix prefetch bailout detection for nested loading segments (<a
href="https://redirect.github.com/vercel/next.js/issues/70618">#70618</a>)</li>
<li>Add missing node modules to externals (<a
href="https://redirect.github.com/vercel/next.js/issues/70382">#70382</a>)</li>
<li>Feature: next/image: add support for images.remotePatterns.search
(<a
href="https://redirect.github.com/vercel/next.js/issues/70302">#70302</a>)</li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/styfle"><code>@​styfle</code></a>, <a
href="https://github.com/ztanner"><code>@​ztanner</code></a>, <a
href="https://github.com/ijjk"><code>@​ijjk</code></a>, <a
href="https://github.com/huozhi"><code>@​huozhi</code></a> and <a
href="https://github.com/wyattjoh"><code>@​wyattjoh</code></a> for
helping!</p>
<h2>v14.2.13</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>Fix missing cache-control on SSR app route (<a
href="https://redirect.github.com/vercel/next.js/issues/70265">#70265</a>)</li>
<li>feat: add polyfill of URL.canParse for browser compatibility (<a
href="https://redirect.github.com/vercel/next.js/issues/70228">#70228</a>)</li>
<li>Fix vercel og package memory leak (<a
href="https://redirect.github.com/vercel/next.js/issues/70214">#70214</a>)</li>
<li>Fix startTime error on Android 9 with Chrome 74 (<a
href="https://redirect.github.com/vercel/next.js/issues/67391">#67391</a>)</li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/raeyoung-kim"><code>@​raeyoung-kim</code></a>,
<a href="https://github.com/huozhi"><code>@​huozhi</code></a>, <a
href="https://github.com/devjiwonchoi"><code>@​devjiwonchoi</code></a>,
and <a href="https://github.com/ijjk"><code>@​ijjk</code></a> for
helping!</p>
<h2>v14.2.12</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>update prefetching jsdoc &amp; documentation (<a
href="https://redirect.github.com/vercel/next.js/issues/68047">#68047</a>)</li>
<li>Ensure we chunk revalidate tag requests (<a
href="https://redirect.github.com/vercel/next.js/issues/70189">#70189</a>)</li>
<li>(backport) fix(eslint): allow typescript-eslint v8 (<a
href="https://redirect.github.com/vercel/next.js/issues/70090">#70090</a>)</li>
<li>[ppr] Don't mark RSC requests as /_next/data requests (backport of
<a
href="https://redirect.github.com/vercel/next.js/issues/66249">#66249</a>)
(<a
href="https://redirect.github.com/vercel/next.js/issues/70083">#70083</a>)</li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/alvarlagerlof"><code>@​alvarlagerlof</code></a>,
<a href="https://github.com/wyattjoh"><code>@​wyattjoh</code></a>, <a
href="https://github.com/delbaoliveira"><code>@​delbaoliveira</code></a>,
and <a href="https://github.com/ijjk"><code>@​ijjk</code></a> for
helping!</p>
<h2>v14.2.11</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>fix: correct metadata url suffix (<a
href="https://redirect.github.com/vercel/next.js/pull/69959">vercel/next.js#69959</a>)</li>
<li>fix: setting assetPrefix to URL format breaks HMR (<a
href="https://redirect.github.com/vercel/next.js/issues/70040">#70040</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/next.js/commit/dbbec6ada34399df739f45273b50c38fc5b4a881"><code>dbbec6a</code></a>
v14.2.14</li>
<li><a
href="https://github.com/vercel/next.js/commit/887a419d2f74c791eb3a39efbca29d55fdc10d32"><code>887a419</code></a>
fix: clone response in first handler to prevent race (<a
href="https://redirect.github.com/vercel/next.js/issues/70082">#70082</a>)
(<a
href="https://redirect.github.com/vercel/next.js/issues/70649">#70649</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/73f6b7dc056cf19f795f213c3b133cb991cd877c"><code>73f6b7d</code></a>
Respect reexports from metadata API routes (<a
href="https://redirect.github.com/vercel/next.js/issues/70508">#70508</a>)
(<a
href="https://redirect.github.com/vercel/next.js/issues/70647">#70647</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/e1da07e75a7b8cf96d4d1d6f8c2b6aa3b81f9a4a"><code>e1da07e</code></a>
Externalize node binary modules for app router (<a
href="https://redirect.github.com/vercel/next.js/issues/70646">#70646</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/0ffea650b9a031e4fc5458c0df8100d9bb25f3cc"><code>0ffea65</code></a>
Fix <code>revalidateTag()</code> behaviour when invoked in server
components (<a
href="https://redirect.github.com/vercel/next.js/issues/70446">#70446</a>)
(#...</li>
<li><a
href="https://github.com/vercel/next.js/commit/190faf4d9f4ff907e59947d0dc4740a9224efda4"><code>190faf4</code></a>
Fully skip flakey assertion</li>
<li><a
href="https://github.com/vercel/next.js/commit/3020a118c021e17a57dabb5c379e1a4095f15cbc"><code>3020a11</code></a>
reduce timeout errors</li>
<li><a
href="https://github.com/vercel/next.js/commit/f81e6811e7eb09055e7eea48d8d705874ccdcdcc"><code>f81e681</code></a>
Update flakey tests (<a
href="https://redirect.github.com/vercel/next.js/issues/70643">#70643</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/50e41a251ecf4596eeba42d7013b07c39c541ee7"><code>50e41a2</code></a>
backport: fix prefetch bailout detection for nested loading segments (<a
href="https://redirect.github.com/vercel/next.js/issues/70618">#70618</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/e19d91cf6820acefdf935fe1d06c5276e1cb5e96"><code>e19d91c</code></a>
add missing node modules to externals (<a
href="https://redirect.github.com/vercel/next.js/issues/70382">#70382</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/vercel/next.js/compare/v14.2.10...v14.2.14">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=next&package-manager=npm_and_yarn&previous-version=14.2.10&new-version=14.2.14)](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>
2024-10-02 01:37:19 +05:00
dependabot[bot] 70f428b2f6 chore: bump @types/node from 20.14.8 to 20.16.10 in /offlinedocs (#14903)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
from 20.14.8 to 20.16.10.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=20.14.8&new-version=20.16.10)](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>
2024-10-01 16:18:57 -04:00
dependabot[bot] 06aa139d26 chore: bump @types/node from 20.14.8 to 20.16.10 in /site (#14910)
Bumps
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
from 20.14.8 to 20.16.10.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=20.14.8&new-version=20.16.10)](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>
2024-10-01 16:18:35 -04:00
dependabot[bot] 1d3eda5c1f chore: bump @chromatic-com/storybook from 1.6.0 to 1.9.0 in /site (#14906)
Bumps
[@chromatic-com/storybook](https://github.com/chromaui/addon-visual-tests)
from 1.6.0 to 1.9.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/chromaui/addon-visual-tests/releases"><code>@​chromatic-com/storybook</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v1.9.0</h2>
<h4>🚀 Enhancement</h4>
<ul>
<li>Relay client-side fetch requests to the server using the Storybook
channel API <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/331">#331</a>
(<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<h4>Authors: 1</h4>
<ul>
<li>Gert Hengeveld (<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<h2>v1.8.0</h2>
<h4>🚀 Enhancement</h4>
<ul>
<li>Add <code>paramKey: &quot;chromatic&quot;</code> to allow disabling
the VTA panel through story parameters <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/334">#334</a>
(<a href="https://github.com/mellm0"><code>@​mellm0</code></a>)</li>
</ul>
<h4>Authors: 1</h4>
<ul>
<li>Mell (<a
href="https://github.com/mellm0"><code>@​mellm0</code></a>)</li>
</ul>
<h2>v1.7.0</h2>
<h4>🚀 Enhancement</h4>
<ul>
<li>Update story status reporting for Storybook 8.3 and use new
<code>SET_FILTER</code> event <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/332">#332</a>
(<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<h4>Authors: 1</h4>
<ul>
<li>Gert Hengeveld (<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<h2>v1.6.1</h2>
<h4>🐛 Bug Fix</h4>
<ul>
<li>Fix closing multiple notifications of the same type <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/329">#329</a>
(<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
<li>Add backport releases to changelog <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/327">#327</a>
(<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<h4>Authors: 1</h4>
<ul>
<li>Gert Hengeveld (<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/chromaui/addon-visual-tests/blob/main/CHANGELOG.md"><code>@​chromatic-com/storybook</code>'s
changelog</a>.</em></p>
<blockquote>
<h1>v1.9.0 (Fri Sep 06 2024)</h1>
<h4>🚀 Enhancement</h4>
<ul>
<li>Relay client-side fetch requests to the server using the Storybook
channel API <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/331">#331</a>
(<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<h4>Authors: 1</h4>
<ul>
<li>Gert Hengeveld (<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<hr />
<h1>v1.8.0 (Thu Aug 29 2024)</h1>
<h4>🚀 Enhancement</h4>
<ul>
<li>Add <code>paramKey: &quot;chromatic&quot;</code> to allow disabling
the VTA panel through story parameters <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/334">#334</a>
(<a href="https://github.com/mellm0"><code>@​mellm0</code></a>)</li>
</ul>
<h4>Authors: 1</h4>
<ul>
<li>Mell (<a
href="https://github.com/mellm0"><code>@​mellm0</code></a>)</li>
</ul>
<hr />
<h1>v1.7.0 (Tue Aug 20 2024)</h1>
<h4>🚀 Enhancement</h4>
<ul>
<li>Update story status reporting for Storybook 8.3 and use new
<code>SET_FILTER</code> event <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/332">#332</a>
(<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<h4>Authors: 1</h4>
<ul>
<li>Gert Hengeveld (<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<hr />
<h1>v1.6.1 (Thu Jul 04 2024)</h1>
<h4>🐛 Bug Fix</h4>
<ul>
<li>Fix closing multiple notifications of the same type <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/329">#329</a>
(<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
<li>Add backport releases to changelog <a
href="https://redirect.github.com/chromaui/addon-visual-tests/pull/327">#327</a>
(<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<h4>Authors: 1</h4>
<ul>
<li>Gert Hengeveld (<a
href="https://github.com/ghengeveld"><code>@​ghengeveld</code></a>)</li>
</ul>
<hr />
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/6b99afbc494861590c20fe4d066a290c9038eb9e"><code>6b99afb</code></a>
Bump version to: 1.9.0 [skip ci]</li>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/51be970546e6d6f50b47365674dd19dfe8b6ff1c"><code>51be970</code></a>
Update CHANGELOG.md [skip ci]</li>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/f0c702ffc69a1b4b9606f37220f6ec1c2bd68ff3"><code>f0c702f</code></a>
Merge pull request <a
href="https://redirect.github.com/chromaui/addon-visual-tests/issues/331">#331</a>
from chromaui/312-api-channel-proxy</li>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/67b13f2aa668a470a2830b60b779c92ef16a6e84"><code>67b13f2</code></a>
Merge branch 'main' into 312-api-channel-proxy</li>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/b781bdfcc70cc7a19991525aa1931eeed08ea169"><code>b781bdf</code></a>
Bump version to: 1.8.0 [skip ci]</li>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/cd6d96984b30c436f3f3cae056632b052df333a3"><code>cd6d969</code></a>
Update CHANGELOG.md [skip ci]</li>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/97ad16438ce4e47f267f472369756a22f0bd6142"><code>97ad164</code></a>
Merge pull request <a
href="https://redirect.github.com/chromaui/addon-visual-tests/issues/334">#334</a>
from mellm0/add-param-key</li>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/ca3d66e836ace90636372b15ec58a32dadcc5a75"><code>ca3d66e</code></a>
chore: change param key to chromatic</li>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/c58f4390aaff68de50546263ee08e7764263895c"><code>c58f439</code></a>
Merge branch 'main' into add-param-key</li>
<li><a
href="https://github.com/chromaui/addon-visual-tests/commit/9277872cd84f3f858659374f3a44fc43f7f0e510"><code>9277872</code></a>
Merge branch 'main' into 312-api-channel-proxy</li>
<li>Additional commits viewable in <a
href="https://github.com/chromaui/addon-visual-tests/compare/v1.6.0...v1.9.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@chromatic-com/storybook&package-manager=npm_and_yarn&previous-version=1.6.0&new-version=1.9.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>
2024-10-01 14:09:17 -05:00
Benjamin Peinhardt 302b7fa048 revert: "chore: bump @types/lodash from 4.14.196 to 4.17.9 in /offlinedocs" (#14922)
Reverts coder/coder#14899
Some tests actually failed I just didn't see it.
2024-10-01 13:52:29 -05:00
Muhammad Atif Ali baf8e30458 chore(dogfood): dogfood latest version of modules (#14918)
This will help us catch bugs before our users.
2024-10-01 23:35:36 +05:00
dependabot[bot] f9ec468c6d chore: bump @types/lodash from 4.14.196 to 4.17.9 in /offlinedocs (#14899)
Bumps
[@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash)
from 4.14.196 to 4.17.9.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/lodash&package-manager=npm_and_yarn&previous-version=4.14.196&new-version=4.17.9)](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>
2024-10-01 13:34:51 -05:00
Ben Potter 5a20121fe7 chore: fix label for orgs docs (#14920) 2024-10-01 18:00:38 +00:00
Ben Potter d04eaf8392 docs: add organizations, provisioners, and premium license docs (#14778)
- [x] Mention Orgs is beta and add a link to get feedback
- [x] Add docs on new provisioner authentication architecture and
deprecate the old one
- [x] Add/update docs for IdP sync
  - [x] Organization Sync
  - [x] Group Sync
  - [x] Role Sync
- [x] Modify `coder.com` codebase to add `Premium` and `Beta` pill, and
allow multiple pills: https://github.com/coder/coder.com/pull/638
- [x] Replace all mentions of "Enterprise" with "Premium" in docs
  - [x] edit: change it to "Licensing"
- [x] Remove the enterprise page and change all links to
coder.com/pricing
- [x] Merge #14786
- [x] Add redirects for coder.com to redirect the `using-organizations`
guide to the new orgs one and /enterprise to /premium
https://github.com/coder/coder.com/pull/645
- [x] Custom roles
- [x] https://github.com/coder/coder/pull/14786
- [x] Remove all mentions of orgs experiment
- [x] Update in-product copy & links to link to the new docs pages

Anything I am missing?

---

[Preview
this](https://coder.com/docs/@orgs-licenses/admin/organizations)

---------

Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
2024-10-01 12:34:16 -05:00
dependabot[bot] b786166ddf chore: bump github.com/unrolled/secure from 1.14.0 to 1.16.0 (#14871)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 22:33:43 +05:00
dependabot[bot] 0623531ab8 ci: bump contributor-assistant/github-action from 2.6.0 to 2.6.1 in the github-actions group (#14870)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 17:33:10 +00:00
dependabot[bot] 3ca78dde86 chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.67.0 to 1.68.0 (#14767)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 22:32:36 +05:00
dependabot[bot] eacdba24bc chore: bump google.golang.org/api from 0.197.0 to 0.199.0 (#14873)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 22:32:20 +05:00
Garrett Delfosse 533d655ac0 feat: show user-auth provisioners (#14883)
Closes https://github.com/coder/coder/issues/14867

What this changes:
- Displays `user-auth` grouped provisioners
- Added tags to provisioners in cases where it matters

<img width="1378" alt="image"
src="https://github.com/user-attachments/assets/ecc8da0a-24b4-469d-99e7-aa1f183046b7">

---------

Co-authored-by: Ben Potter <ben@coder.com>
Co-authored-by: McKayla Washburn <mckayla@hey.com>
2024-10-01 13:12:30 -04:00
Jon Ayers 21b92ef893 feat: add cache abstraction for fetching signing keys (#14777)
- Adds the database implementation for fetching and caching keys
used for JWT signing. It's been merged into the `keyrotate` pkg and
renamed to `cryptokeys` since they're coupled concepts.
2024-10-01 11:04:51 -05:00
Spike Curtis f7ddbb744f feat: add CoderVPN protocol definition & implementation (#14855)
closes #14731

Defines and implements the CoderVPN control protocol, which will be used to communicate with desktop client applications.
2024-10-01 19:40:42 +04:00
dependabot[bot] 38d8e3ad6a chore: bump eslint from 8.57.0 to 8.57.1 in /offlinedocs (#14904)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 19:10:33 +05:00
Mathias Fredriksson ca80dd657b chore(site): update @playwright/test to version 1.47.2 (#14912)
Playwright version detection in `scripts/remote_playwright.sh` was also fixed.
2024-10-01 13:59:49 +00:00
Danny Kopping 11f7b1b3f5 chore: remove notifications experiment (#14869)
Notifications have proved stable in the [mainline release of
v2.15](https://github.com/coder/coder/releases/tag/v2.15.0), and in
preparation for v2.16 we're moving this to stable.
2024-10-01 13:43:47 +00:00
dependabot[bot] edb4485afd chore: bump the react group across 2 directories with 2 updates (#14895)
Bumps the react group with 1 update in the /offlinedocs directory:
[@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react).
Bumps the react group with 2 updates in the /site directory:
[@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react)
and
[@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom).

Updates `@types/react` from 18.3.3 to 18.3.10
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react">compare
view</a></li>
</ul>
</details>
<br />

Updates `@types/react` from 18.2.6 to 18.3.10
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react">compare
view</a></li>
</ul>
</details>
<br />

Updates `@types/react-dom` from 18.2.4 to 18.3.0
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom">compare
view</a></li>
</ul>
</details>
<br />


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>

---------

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>
2024-10-01 10:40:54 -03:00
dependabot[bot] 1de12b0310 chore: bump eslint-config-next from 14.2.7 to 14.2.13 in /offlinedocs (#14902)
Bumps
[eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next)
from 14.2.7 to 14.2.13.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/next.js/releases">eslint-config-next's
releases</a>.</em></p>
<blockquote>
<h2>v14.2.13</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>Fix missing cache-control on SSR app route (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70265">#70265</a>)</li>
<li>feat: add polyfill of URL.canParse for browser compatibility (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70228">#70228</a>)</li>
<li>Fix vercel og package memory leak (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70214">#70214</a>)</li>
<li>Fix startTime error on Android 9 with Chrome 74 (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/67391">#67391</a>)</li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/raeyoung-kim"><code>@​raeyoung-kim</code></a>,
<a href="https://github.com/huozhi"><code>@​huozhi</code></a>, <a
href="https://github.com/devjiwonchoi"><code>@​devjiwonchoi</code></a>,
and <a href="https://github.com/ijjk"><code>@​ijjk</code></a> for
helping!</p>
<h2>v14.2.12</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>update prefetching jsdoc &amp; documentation (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/68047">#68047</a>)</li>
<li>Ensure we chunk revalidate tag requests (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70189">#70189</a>)</li>
<li>(backport) fix(eslint): allow typescript-eslint v8 (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70090">#70090</a>)</li>
<li>[ppr] Don't mark RSC requests as /_next/data requests (backport of
<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/66249">#66249</a>)
(<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70083">#70083</a>)</li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/alvarlagerlof"><code>@​alvarlagerlof</code></a>,
<a href="https://github.com/wyattjoh"><code>@​wyattjoh</code></a>, <a
href="https://github.com/delbaoliveira"><code>@​delbaoliveira</code></a>,
and <a href="https://github.com/ijjk"><code>@​ijjk</code></a> for
helping!</p>
<h2>v14.2.11</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>fix: correct metadata url suffix (<a
href="https://redirect.github.com/vercel/next.js/pull/69959">vercel/next.js#69959</a>)</li>
<li>fix: setting assetPrefix to URL format breaks HMR (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70040">#70040</a>)</li>
<li>Update revalidateTag to batch tags in one request (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/65296">#65296</a>)</li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/huozhi"><code>@​huozhi</code></a>, <a
href="https://github.com/devjiwonchoi"><code>@​devjiwonchoi</code></a>,
and <a href="https://github.com/ijjk"><code>@​ijjk</code></a> for
helping!</p>
<h2>v14.2.10</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>Remove invalid fallback revalidate value (<a
href="https://redirect.github.com/vercel/next.js/pull/69990">vercel/next.js#69990</a>)</li>
<li>Revert server action optimization (<a
href="https://redirect.github.com/vercel/next.js/pull/69925">vercel/next.js#69925</a>)</li>
<li>Add ability to customize Cache-Control (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/69802">#69802</a>)</li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/huozhi"><code>@​huozhi</code></a> and <a
href="https://github.com/ijjk"><code>@​ijjk</code></a> for helping!</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/next.js/commit/f550237aa564bd59bfef7462350ac6c502f0206d"><code>f550237</code></a>
v14.2.13</li>
<li><a
href="https://github.com/vercel/next.js/commit/6d7ced47babace09f5ab1cf5a43ba26d88d984ac"><code>6d7ced4</code></a>
v14.2.12</li>
<li><a
href="https://github.com/vercel/next.js/commit/77910c84be4dfb867fe127089c077c05e8a4225c"><code>77910c8</code></a>
(backport) fix(eslint): allow typescript-eslint v8 (<a
href="https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next/issues/70090">#70090</a>)</li>
<li><a
href="https://github.com/vercel/next.js/commit/bfbc92aab5c727444ed21e0b84bd55cda2e22067"><code>bfbc92a</code></a>
v14.2.11</li>
<li><a
href="https://github.com/vercel/next.js/commit/937651fede26a1cdd8a83aa4636719e466fa7f20"><code>937651f</code></a>
v14.2.10</li>
<li><a
href="https://github.com/vercel/next.js/commit/6fa8982f8eb766663fd1e11e43621e53fd8e016c"><code>6fa8982</code></a>
v14.2.9</li>
<li><a
href="https://github.com/vercel/next.js/commit/63b999c3ba9fda5ed577d56438200b60b07085e1"><code>63b999c</code></a>
v14.2.8</li>
<li><a
href="https://github.com/vercel/next.js/commit/c021c2f7f72485482d4fac870f0dbd5be369dedb"><code>c021c2f</code></a>
feat: enable <code>@​typescript-eslint/recommended</code> in
create-next-app --typescript (...</li>
<li>See full diff in <a
href="https://github.com/vercel/next.js/commits/v14.2.13/packages/eslint-config-next">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-config-next&package-manager=npm_and_yarn&previous-version=14.2.7&new-version=14.2.13)](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>
2024-10-01 10:07:58 -03:00
dependabot[bot] dc40231b74 chore: bump @types/lodash from 4.17.6 to 4.17.9 in /site (#14909)
Bumps
[@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash)
from 4.17.6 to 4.17.9.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/lodash&package-manager=npm_and_yarn&previous-version=4.17.6&new-version=4.17.9)](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>
2024-10-01 10:07:34 -03:00
Marcin Tojek 3f79022848 test: ignore log errors (#14892)
Fixes: https://github.com/coder/coder/issues/14891
2024-10-01 12:38:50 +02:00
Ethan 35a5475166 chore: add site flag to buildinfo (#14868) 2024-10-01 10:01:17 +00:00
Ethan 2a3a00cf82 fix: remove redundant flaking test (#14888) 2024-10-01 09:01:24 +00:00
Spike Curtis d6766f706d fix: sort provisioner key tags in cli output (#14875)
I'm seeing flakes like

```
    provisionerkeys_test.go:68: 2024-09-30 05:58:44.686: cmd: matched newline = "CREATED AT            NAME          TAGS            "
    provisionerkeys_test.go:72: 2024-09-30 05:58:44.686: cmd: matched newline = "2024-09-30T05:58:44Z  dont-test-me  my=way foo=bar  "
    provisionerkeys_test.go:74: 
        	Error Trace:	/Users/runner/work/coder/coder/enterprise/cli/provisionerkeys_test.go:74
        	Error:      	"2024-09-30T05:58:44Z  dont-test-me  my=way foo=bar  " does not contain "foo=bar my=way"
        	Test:       	TestProvisionerKeys/CRUD
```

e.g.
https://github.com/coder/coder/actions/runs/11100237276/job/30835714478?pr=14855

Since the tags are a map, we weren't outputting them in a consistent
order on the CLI, leading to flakes.

This sorts the tags by key when converting to a string, for a
consistent, canonical output.
2024-10-01 09:11:19 +04:00
Joobi S B ba90bb0ab3 feat: implement feature to create a token on behalf of another user in the cli (#14813)
This PR addresses https://github.com/coder/coder/issues/13160
2024-09-30 20:15:28 +00:00
Kayla Washburn-Love e70ad2b4b3 fix: always show upload and scratch in create template gallery (#14327) 2024-09-30 12:38:08 -06:00
Roger Chao 5246f8d142 docs: fix process-logging.md to replace deprecated items (#14842)
Updated datasource to use data.coder_workspace_owners for user labels to
avoid deprecation warning messages.
2024-09-27 15:49:48 -07:00
Jaayden Halko e6cd3005d3 feat: add warning dialog when removing member from organization (#14695)
resolves #14705 


<img width="684" alt="Screenshot 2024-09-27 at 4 34 02 PM"
src="https://github.com/user-attachments/assets/5c3b6c3e-2afc-4405-8bed-d9ea80607411">
2024-09-27 17:20:01 -04:00
Kayla Washburn-Love b80550957f chore: remove mutli-organization experiment from the frontend (#14863) 2024-09-27 14:57:56 -06:00
Kayla Washburn-Love 894c758f06 feat: display legacy idp mappings in idp sync settings (#14866)
Closes #14788
2024-09-27 14:57:24 -06:00
Steven Masley 33988fedcd chore: allow user admins to configure idp sync (#14861) 2024-09-27 14:07:15 -05:00
Steven Masley 2c8b264d78 chore: remove multi-organization and custom role experiment (#14862)
Closes https://github.com/coder/coder/issues/14704

---------

Co-authored-by: Kayla Washburn-Love <mckayla@hey.com>
2024-09-27 14:06:16 -05:00
Jaayden Halko 339eebacae feat: display builtin roles alongside custom roles (#14843)
Since its currently not possible to update or delete built-in roles. The
purpose of this PR is to display the built-in roles so that users know
they exist and what permissions each role contains.


<img width="1185" alt="Screenshot 2024-09-26 at 9 18 05 PM"
src="https://github.com/user-attachments/assets/017a51d7-ec98-409c-9c8e-b66ac7abb948">
2024-09-27 14:07:57 -04:00
Garrett Delfosse 5cc5bbea04 fix: improve provisioner key cli usability (#14834)
What this changes:
- Unhides the `--key` flag on provisioner start
- Deprecates and hides `provisionerd` command group in favor of
`provisioner(s)`
- Removes org id from `coder provisioner keys list`
2024-09-27 10:34:41 -05:00
Cian Johnston 62047e5f68 chore(docs): update devcontainer docs (#14850)
Fixes https://github.com/coder/envbuilder/issues/131
2024-09-27 14:14:59 +01:00
Cian Johnston 3b5cabb566 feat(examples/templates/aws-devcontainer): add root volume parameter, growpart automatically (#14839)
Fixes https://github.com/coder/coder/issues/14833
2024-09-27 09:51:31 +01:00
Marcin Tojek a3ffab6ceb docs: enable Slack notifications (#14830) 2024-09-27 10:08:42 +02:00
Jon Ayers 3fdeaf7b24 feat: add endpoint for fetching workspace proxy keys (#14789) 2024-09-26 21:01:49 +01:00
Steven Masley 5c977c6be7 chore: rename 'first-organization' to 'coder' (#14808)
Rename the first-organization original name. Users can change from the
original name.
2024-09-26 13:20:44 -05:00
Steven Masley b23e6a05c8 chore: rename organization 'name' to organization 'slug' (#14835) 2024-09-26 12:17:49 -05:00
Ethan fb28979537 fix(docs): add coderd_workspace_latest_build_status prometheus metric (#14828) 2024-09-27 02:55:24 +10:00
Steven Masley 3894bab038 chore: include error detail for ui error display (#14837)
Not including an error detail asks the user to check the dev console.
Which is unhelpful in this expected situation
2024-09-26 11:48:50 -05:00
Cian Johnston e4470e1617 hotfix(examples/templates/aws-devcontainer): fix code-server module address (#14836) 2024-09-26 16:28:09 +00:00
Jaayden Halko 9ea2f6f267 fix: show paywall and correctly display auto create groups for IDP sync (#14800)
* fix: show paywall and correctly display auto create groups

* fix: update stories

* fix: format

* chore: cleanup

* fix: update stories
2024-09-26 12:12:04 -04:00
Cian Johnston 4be5b2ff98 chore(examples/templates/aws-devcontainer): update to use envbuilder provider` (#14831)
* chore(examples/templates/aws-devcontainer): update to use envbuilder provider
* fix(devcontainer-gcp): set builder image properly
2024-09-26 17:07:14 +01:00
Michael Smith 8403dd5c36 fix: make sure avatar data for owner displays correctly (#14812) 2024-09-26 03:57:21 +00:00
Kayla Washburn-Love 4dcf5ef323 chore: add paywall to provisioners page (#14803)
* chore: add paywall to provisioners page

* きれい

* move some things into the page view

* I guess I'm not allowed to use proper nouns

* :|
2024-09-25 16:54:49 -06:00
Michael Smith aef400c2c5 fix: update presentation of beta badges for organizations UI (#14806)
* fix: make badges capitalized

* fix: remove beta badges from all headers for organizations
2024-09-25 17:48:32 -04:00
Steven Masley 9ef9044d9c chore: remove read all provisioners from users (#14801)
* chore: remove read all provisioners from users

Reading provisioner daemons now extends from org member,
not site wide member.

* update rbac perm test
* add unit test
2024-09-25 15:38:58 -05:00
Kayla Washburn-Love 2cffb55457 fix: avoid showing "multiple tags" for simple tag sets on provisioners page (#14804) 2024-09-25 12:48:34 -06:00
Steven Masley 6cd1219289 chore: reword license backend error to only mention premium (#14799)
Phrasing for "enterprise" removed.
2024-09-25 13:41:21 -05:00
Danielle Maywood 575925c050 feat: add one time passcode columns to users table (#14797) 2024-09-25 17:46:51 +01:00
Cian Johnston bb3850adc2 fix(envbuilder-dogfood): configure provider correctly (#14796) 2024-09-25 17:14:45 +01:00
dependabot[bot] 86a82b5a2a ci: bump the github-actions group with 2 updates (#14770)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-25 19:40:06 +05:00
dependabot[bot] 718b30cada chore: bump github.com/moby/moby from 27.2.0+incompatible to 27.3.1+incompatible (#14764)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-25 18:25:35 +05:00
dependabot[bot] b371bc89c0 chore: bump github.com/aws/aws-sdk-go-v2 from 1.30.3 to 1.31.0 (#14766)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-25 18:24:21 +05:00
dependabot[bot] 676191643b chore: bump google.golang.org/grpc from 1.66.1 to 1.67.0 (#14769)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-25 18:23:51 +05:00
Marcin Tojek c6e44282b2 docs: mark Teams integration as beta (#14793) 2024-09-25 12:34:54 +02:00
Stephen Kirby d8ddd07ee5 fix external auth typos (#14790) 2024-09-24 22:35:26 -05:00
Ethan b7c574f679 feat!: add summary to coder ping (#14762) 2024-09-25 13:24:23 +10:00
Marcin Tojek e086d7813b docs: enable Microsoft Teams Notifications (#14781) 2024-09-24 17:18:02 +02:00
Joobi S B c127d90efc chore: add ability to include custom protoc-gen-go dependency in nix flake (#14728) 2024-09-24 12:57:07 +00:00
Ethan 326886d3c2 chore: go mod tidy during fmt/go (#14779) 2024-09-24 21:39:34 +10:00
Danielle Maywood ae522c558d feat: add agent timings (#14713)
* feat: begin impl of agent script timings

* feat: add job_id and display_name to script timings

* fix: increment migration number

* fix: rename migrations from 251 to 254

* test: get tests compiling

* fix: appease the linter

* fix: get tests passing again

* fix: drop column from correct table

* test: add fixture for agent script timings

* fix: typo

* fix: use job id used in provisioner job timings

* fix: increment migration number

* test: behaviour of script runner

* test: rewrite test

* test: does exit 1 script break things?

* test: rewrite test again

* fix: revert change

Not sure how this came to be, I do not recall manually changing
these files.

* fix: let code breathe

* fix: wrap errors

* fix: justify nolint

* fix: swap require.Equal argument order

* fix: add mutex operations

* feat: add 'ran_on_start' and 'blocked_login' fields

* fix: update testdata fixture

* fix: refer to agent_id instead of job_id in timings

* fix: JobID -> AgentID in dbauthz_test

* fix: add 'id' to scripts, make timing refer to script id

* fix: fix broken tests and convert bug

* fix: update testdata fixtures

* fix: update testdata fixtures again

* feat: capture stage and if script timed out

* fix: update migration number

* test: add test for script api

* fix: fake db query

* fix: use UTC time

* fix: ensure r.scriptComplete is not nil

* fix: move err check to right after call

* fix: uppercase sql

* fix: use dbtime.Now()

* fix: debug log on r.scriptCompleted being nil

* fix: ensure correct rbac permissions

* chore: remove DisplayName

* fix: get tests passing

* fix: remove space in sql up

* docs: document ExecuteOption

* fix: drop 'RETURNING' from sql

* chore: remove 'display_name' from timing table

* fix: testdata fixture

* fix: put r.scriptCompleted call in goroutine

* fix: track goroutine for test + use separate context for reporting

* fix: appease linter, handle trackCommandGoroutine error

* fix: resolve race condition

* feat: replace timed_out column with status column

* test: update testdata fixture

* fix: apply suggestions from review

* revert: linter changes
2024-09-24 10:51:49 +01:00
Ethan b8944074c4 chore: improve coder server ux (#14761) 2024-09-24 13:16:36 +10:00
Jaayden Halko a3ebcd7a1e feat: integrate backend with idp sync page (#14755)
* feat: idp sync initial commit

* fix: hookup backend data for groups and roles

* chore: cleanup

* feat: separate groups and roles into tabs

* feat: implement export policy button

* feat: handle missing groups

* chore: add story for missing groups

* chore: add stories for export policy button

* fix: updates for PR review

* chore: update tests

* chore: document uuid regex

* chore: remove unused

* fix: fix stories
2024-09-23 22:07:46 -04:00
Ethan b4f54f3eea fix: use latest build version name on workspace page (#14771) 2024-09-23 13:06:03 +00:00
Kayla Washburn-Love db4945dc27 chore: consolidate on showOrganizations usage (#14756) 2024-09-20 23:30:42 -06:00
Michael Smith 661d22621a feat: create UI badges for labeling beta features (#14661)
* chore: finish draft work for FeatureBadge component

* fix: add visually-hidden helper text for screen readers

* chore: add stories for highlighted state

* fix: update base styles

* chore: remove debug display option

* chore: update Popover to propagate events

* wip: commit progress on FeatureBadge update

* wip: commit more progress

* chore: update tag definitions to satify Biome

* chore: update all colors for preview role

* fix: make sure badge shows as hovered while inside tooltip

* wip: commit progress on adding story for controlled variant

* fix: sort imports

* refactor: change component API to be more obvious/ergonomic

* fix: add biome-ignore comments to more base files

* fix: update import order again

* chore: revert biome-ignore comment

* chore: update body text for tooltip

* chore: update dark preivew role to use sky palette

* chore: update color palettes for light/darkBlue themes

* chore: add beta badge to organizations subheader

* chore: add beta badge to organizations settings page

* chore: beef up font weight for form header

* fix: update text contrast for org menu list

* chore: add beta badge to deployment dropdown

* fix: run biome on imports

* chore: remove API for controlling FeatureBadge hover styling externally

* chore: add xs size for badge

* fix: update font weight for xs feature badges

* chore: add beta badges to all org headers

* fix: turn badges and tooltips into separate concerns

* fix: update hover styling

* docs: update wording on comment

* fix: apply formatting

* chore: rename FeatureBadge to FeatureStageBadge

* refactor: redefine FeatureStageBadge

* chore: update stories

* fix: add blur behavior to popover

* chore: revert theme colors

* chore: create featureStage branding namespace

* fix: make sure cleanup function is set up properly

* docs: update wording on comment for clarity

* refactor: move styles down
2024-09-20 21:13:39 +00:00
Kayla Washburn-Love 3338f32489 fix: improve provisioner details layout and show count line (#14749)
* きれい

* とても大きい

* improve storybook test

* ボタン

* アイコンの名前

* ジェ
2024-09-20 14:59:09 -06:00
Muhammad Atif Ali 35017822d5 chore(dogfood): add cursor IDE (#14748) 2024-09-20 23:19:28 +05:00
Garrett Delfosse 50124fefdc feat: remove org flag requirement for provisioners (#14722) 2024-09-20 12:45:31 -04:00
Kayla Washburn-Love 96e9a4f85c feat(site): add warnings and status indicator to provisioner groups (#14708) 2024-09-20 09:55:04 -06:00
Danielle Maywood 86f68b220e feat: add 'display_name' column to 'workspace_agent_scripts' (#14747)
* feat: add 'display_name' column to 'workspace_agent_scripts'

* fix: backfill from workspace_agent_log_sources

* fix: run 'make gen'
2024-09-20 14:26:13 +01:00
Muhammad Atif Ali db7b411094 chore(site): add cursor ide icon (#14743) 2024-09-20 17:37:06 +05:00
Spike Curtis 6d992984a4 fix: set TCPMaxRetries to 5 for reasonable timeouts on send (#14746) 2024-09-20 14:38:48 +04:00
dependabot[bot] 7c77a3cc83 chore: bump vite from 5.4.1 to 5.4.6 in /site (#14736)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-20 00:39:40 +05:00
Frederik Dudzik 07d1478f34 fix(docs): add dotfiles module reference (#14675)
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-09-19 19:15:43 +00:00
Kayla Washburn-Love 15f19431d7 chore: fix comment (#14738) 2024-09-19 12:39:41 -06:00
Jon Ayers 2d5c068525 feat: implement key rotation system (#14710) 2024-09-19 19:12:44 +01:00
dependabot[bot] dbe6b6c224 chore: bump next from 14.2.7 to 14.2.10 in /offlinedocs (#14737)
Bumps [next](https://github.com/vercel/next.js) from 14.2.7 to 14.2.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/compare/v14.2.7...v14.2.10)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-19 11:46:47 -06:00
dependabot[bot] b0c86220a7 chore: bump golang.org/x/tools from 0.24.0 to 0.25.0 in the x group (#14681)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-19 22:32:46 +05:00
dependabot[bot] f2a12a06d1 chore: bump go.nhat.io/otelsql from 0.13.0 to 0.14.0 (#14682)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-19 22:32:12 +05:00
dependabot[bot] 115c52c5b0 chore: bump google.golang.org/api from 0.196.0 to 0.197.0 (#14683)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-19 22:31:20 +05:00
dependabot[bot] 4228c1f308 chore: bump github.com/hashicorp/hc-install from 0.8.0 to 0.9.0 (#14684)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-19 22:31:11 +05:00
Garrett Delfosse 922f4c545f fix: handle new agent stat format correctly (#14576)
---------

Co-authored-by: Ethan Dickson <ethan@coder.com>
2024-09-20 01:52:14 +10:00
Ethan 37885e2e82 fix: make cli respect deployment --docs-url (#14568) 2024-09-18 21:47:53 +10:00
Marcin Tojek 20a3801600 fix: use floats in report template (#14714) 2024-09-18 11:26:34 +00:00
Ethan fccf6f1e0e feat!: add --default-token-lifetime (#14631) 2024-09-18 21:23:42 +10:00
Marcin Tojek 6de59371ea feat: notifications: report failed workspace builds (#14571) 2024-09-18 09:11:44 +02:00
Steven Masley 1e5438eadb feat: remove user from groups on org membership delete (#14701)
* feat: remove user from groups on org membership delete

Groups inherently provide authz access to certain resources. If a
user is removed from an organization, they should be removed
from all their groups in said organization.
2024-09-17 19:41:34 -05:00
Steven Masley c145f113fe chore: remove db import from cli package (#14709) 2024-09-17 22:07:58 +00:00
Kayla Washburn-Love 5be02a293e feat: show tags for psk provisioners (#14628) 2024-09-17 15:36:42 -06:00
Kayla Washburn-Love de3945c291 chore: add help tooltips explaining provisioner types (#14625)
* work

* do the stuff

* 🧹

* feat: show more detailed provisioner version info

* 🧹

* descriptive lil help guys :)

* 🧹

* hook up to api

* :)

* v2.99.99
2024-09-17 15:20:35 -06:00
Kayla Washburn-Love bbc7b5085d feat: show more detailed provisioner version info (#14593) 2024-09-17 15:06:33 -06:00
Kayla Washburn-Love dda6bdc174 feat: group provisioners by authentication method (#14580) 2024-09-17 14:47:14 -06:00
Steven Masley d96adad56f chore: add cli command to fetch group sync settings as json (#14694)
* chore: add cli command to fetch group sync settings as json
2024-09-17 14:08:33 -05:00
Jon Ayers 45160c7679 feat: add schema for key rotation (#14662) 2024-09-17 18:08:18 +01:00
Steven Masley 45420b95f3 chore: allow removing users from the default org (#14699)
* chore: allow removing users from the default org

Removed as no longer in experimental
2024-09-17 10:42:47 -05:00
Steven Masley ce21b2030a feat: implement patch and get api methods for role sync (#14692)
* feat: implement patch and get api methods for role sync
2024-09-17 10:38:42 -05:00
Steven Masley be516f9686 chore: unhide multi-organization cli commands (#14693)
* chore: unhide multi-organization cli commands

Multi-org is going into GA, unhide cli commands
2024-09-17 10:22:20 -05:00
Bruno Quaresma 370f0b9020 fix(coderd): check if timings can be read (#14697) 2024-09-17 10:57:57 -03:00
Danielle Maywood 14d3e300d3 fix: use ANSI colors codes instead of RGB (#14665)
* chore: add command for showing colors

* fix: use ANSI color codes instead of RGB

* feat: add '--no-color' flag

* fix: revert colors

* chore: change colors

* fix: update golden files

* fix: replace blue with brightBlue

* fix: drop '> ' for unfocused prompts

* fix: run 'make fmt'

* chore: allow disabling color with env flags

* fix: apply fixes from feedback

* fix: run 'make gen'

* fix: refactor janky code

* fix: re-add public function

* fix: re-add init for non-color tests

* fix: move styles to 'init' that can be

* fix: stop overwriting entire DefaultStyles

* fix: make code and field obey --no-color

* fix: rip out '--no-color' due to race condition

We still support `NO_COLOR` env variable through termenv's
`EnvColorProfile`. The reason for the race condition is that
`DefaultStyles` is a global that we shouldn't mutate after `init`
is called, but we have to mutate it after `init` has ran to have
serpent collect the cli flags and env vars for us.

* fix: apply nit

* fix: simplify code && hide command

* fix: newline shouldn't be themed

* fix: appease the linter
2024-09-17 14:21:24 +01:00
Spike Curtis 6ff9a05832 fix: close SSH sessions bottom-up if top-down fails (#14678) 2024-09-17 14:46:49 +04:00
Colin Adler ff1eabebe5 feat: add SCIM support for multi-organization (#14691)
* chore: use legacy "AssignDefault" option for legacy behavior in SCIM (#14696)
* chore: reference legacy assign default option for legacy behavior

AssignDefault is a boolean flag mainly for single org and legacy
deployments. Use this flag to determine SCIM behavior.

---------

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
2024-09-17 00:17:38 +00:00
Steven Masley 71393743dc feat: implement organization role sync (#14649)
* chore: implement organization and site wide role sync in idpsync
* chore: remove old role sync, insert new idpsync package
2024-09-16 19:03:25 -05:00
Michael Smith 5aa54be6ca chore: update workspaces page filter to include organization controls (#14597)
* chore: move schedule controls to the right side of the screen

* chore: add org display to workspace topbar

* fix: force organizations to be readonly array

* fix update type mismatch for organizations again

* refactor: tuck main loading skeleton for filter into base definition

* refactor: give filter files different names to reduce confusion

* refactor: remove separate base filter skeleton

* fix: update responsive logic for audit table filter

* chore: add organizations option group to workspaces table

* refactor: make prop contracts more explicit

* refactor: centralize the organizations dropdown logic

* fix: update imports and formatting

* fix: update quota querying logic to use new endpoint

* fix: add logic for handling long workspace or org names

* chore: add links for workspaces by org

* chore: expand tooltip styling for org

* chore: expand tooltip styling for owner

* refactor: split off breadcrumbs for readability

* fix: display correct template version name in dropdown

* fix: update overflow styling for breadcrumb segments

* fix: favor org display name

* fix: centralize org display name logic

* fix: make sure skeletons stay synced with org feature toggles

* fix: ensure that mock query cache key and component key are properly synced for storybook

* docs: clean up wording on SearchField comment

* fix: shrink mix width threshold for search field

* chore: add navigation test for workspace details page (#14629)

* chore: add tests for WorkspacePage cross-page navigation

* fix: update story to use mock organizations menu
2024-09-16 20:45:49 +00:00
Michael Smith 910225698e chore: update workspaces top bar to display org name (#14596)
* chore: move schedule controls to the right side of the screen

* chore: add org display to workspace topbar

* fix: force organizations to be readonly array

* fix update type mismatch for organizations again

* fix: update quota querying logic to use new endpoint

* fix: add logic for handling long workspace or org names

* chore: add links for workspaces by org

* chore: expand tooltip styling for org

* chore: expand tooltip styling for owner

* refactor: split off breadcrumbs for readability

* fix: display correct template version name in dropdown

* fix: update overflow styling for breadcrumb segments

* fix: favor org display name

* fix: centralize org display name logic

* fix: ensure that mock query cache key and component key are properly synced for storybook
2024-09-16 16:16:59 -04:00
Garrett Delfosse 335eb05223 feat: add keys to organization provision daemons (#14627) 2024-09-16 20:02:08 +00:00
Jaayden Halko 4afce19fb7 feat: use monospace font for idp fields (#14672) 2024-09-16 15:48:50 -04:00
Bruno Quaresma 705b9ccda8 feat(coderd): add workspace timings endpoint (#14648) 2024-09-16 16:31:05 -03:00
Steven Masley c330af0e4d chore: add group_ids filter to /groups endpoint (#14688)
Allow filtering groups by IDs.
2024-09-16 13:01:46 -05:00
Kayla Washburn-Love 5ed065d88d feat: get and update group IdP Sync settings (#14647)
---------

Co-authored-by: Steven Masley <stevenmasley@gmail.com>
2024-09-16 12:01:37 -05:00
Spike Curtis 2df9a3e554 fix: fix tailnet remoteCoordination to wait for server (#14666)
Fixes #12560

When gracefully disconnecting from the coordinator, we would send the Disconnect message and then close the dRPC stream.  However, closing the dRPC stream can cause the server not to process the Disconnect message, since we use the stream context in a `select` while sending it to the coordinator.

This is a product bug uncovered by the flake, and probably results in us failing graceful disconnect some minority of the time.

Instead, the `remoteCoordination` (and `inMemoryCoordination` for consistency) should send the Disconnect message and then wait for the coordinator to hang up (on some graceful disconnect timer, in the form of a context).
2024-09-16 09:24:30 +04:00
Michael Smith 7ea8a2253e fix: add type-safety for Storybook preview.jsx config file (#14671)
* fix: add type-safety to Storybook preview.jsx file

* fix: add clarifying comments

* fix: add type-safety to preview config
2024-09-13 17:26:52 -04:00
Jaayden Halko c6bc7414aa feat: add premium license behavior for create organization page (#14650)
* fix: type

* chore: paywall improvements

* feat: update create org for premium license

* fix: remove []

* feat: update licensing pills to reflect new premium tier (#14670)

* feat: update licensing pills to reflect new premium tier

* fix: format
2024-09-13 14:37:42 -04:00
Danielle Maywood 9006b21758 fix: only allow submitting form if changes have been made (#14602)
* fix: only allow submitting form if dirty

* test: add test for submit button behaviour

* fix: apply 'make fmt'

* chore: rename 'Submit' to 'Submit and restart'

* test: fix tests
2024-09-13 16:19:17 +01:00
Steven Masley f5601cd783 chore: bump golang.org/x/oauth2 from 0.22.0 to 0.23.0 in the x group across 1 directory (#14669)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 19:43:35 +05:00
Mathias Fredriksson 7780087526 ci(.github): run release-labels when draft PRs are ready (#14667) 2024-09-13 12:41:45 +00:00
Mathias Fredriksson 93b4675748 docs: update available experiments (#14659) 2024-09-13 15:17:51 +05:00
Mathias Fredriksson 95fc962871 ci(.github): remove success from release-labels job (#14664)
It used to depend on another job which has since been removed.
2024-09-13 11:28:27 +03:00
Ethan 9dc8e0f4c5 fix(docs): update terraform backend link (#14663) 2024-09-13 15:17:57 +10:00
Jon Ayers bfdc29f466 fix: suppress benign errors when listing processes (#14660) 2024-09-12 23:00:04 +01:00
Mathias Fredriksson bf87c97ede fix(scripts): allow docs_update_experiments.sh to be run on macOS (#14658) 2024-09-12 21:28:07 +00:00
dependabot[bot] 7ef6780d45 chore: bump express from 4.19.2 to 4.20.0 in /site (#14656)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-12 14:27:35 -07:00
dependabot[bot] 628563d94b chore: bump github.com/golang-migrate/migrate/v4 from 4.17.0 to 4.18.1 (#14606)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-12 19:17:41 +00:00
dependabot[bot] bacad93dde chore: bump go.mozilla.org/pkcs7 from 0.0.0-20200128120323-432b2356ecb1 to 0.9.0 (#14608)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-12 19:16:50 +00:00
dependabot[bot] c334d9c91a chore: bump github.com/opencontainers/runc from 1.1.13 to 1.1.14 (#14555)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-12 19:14:33 +00:00
dependabot[bot] f3b35c504f chore: bump github.com/prometheus/common from 0.57.0 to 0.59.1 (#14607)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 00:03:33 +05:00
dependabot[bot] 0664efbe2d chore: bump github.com/gohugoio/hugo from 0.133.1 to 0.134.1 (#14609)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 00:02:43 +05:00
dependabot[bot] 168b4ff5ac chore: bump github.com/charmbracelet/bubbles from 0.19.0 to 0.20.0 (#14611)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 00:02:37 +05:00
dependabot[bot] 9ecb9b967b chore: bump google.golang.org/api from 0.195.0 to 0.196.0 (#14610)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 00:02:03 +05:00
dependabot[bot] c44d013519 chore: bump alpine from 3.20.2 to 3.20.3 in /scripts (#14614)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 00:01:57 +05:00
dependabot[bot] 26ebd70b12 ci: bump crate-ci/typos from 1.24.3 to 1.24.5 in the github-actions group (#14613)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 00:01:41 +05:00
Jon Ayers 9f4972901c fix: avoid logging no such process errors for process priority (#14655) 2024-09-12 18:00:42 +00:00
Ethan 33e896d404 chore: add lint for codersdk dependencies (#14638) 2024-09-12 15:34:03 +10:00
Ethan efd532e1d7 chore: read template tar from stdin if stdin is not a tty (#14643) 2024-09-12 14:36:20 +10:00
Spike Curtis d6154c4310 chore: remove tailnet v1 API support (#14641)
Drops support for v1 of the tailnet API, which was the original coordination protocol where we only sent node updates, never marked them lost or disconnected.

v2 of the tailnet API went GA for CLI clients in Coder 2.8.0, so clients older than that would stop working.
2024-09-12 07:56:31 +04:00
Spike Curtis fb3523b37f chore: remove legacy AgentIP address (#14640)
Removes the support for the Agent's "legacy IP" which was a hardcoded IP address all agents used to use, before we introduced "single tailnet". Single tailnet went GA in 2.7.0.
2024-09-12 07:40:19 +04:00
Steven Masley 6a846cdbb8 chore: support multi-org group sync with runtime configuration (#14578)
- Implement multi-org group sync
- Implement runtime configuration to change sync behavior
- Legacy group sync migrated to new package
2024-09-11 13:43:50 -05:00
Jaayden Halko 7de576b596 feat: add premium license banner for custom roles page (#14595)
* feat: initial commit for premium banners

* feat: update design and copy

* fix: fix format

* fix: cleanup

* fix: paywall stories and popoverpaywall

* fix: updates for review comments

* chore: remove references to enterprise license

* chore:n remove references to enterprise license

* fix: format

* chore: simplify branding colors

* fix: fix color references
2024-09-11 14:02:34 -04:00
Joobi S B 3301212972 feat: turn off notification via email (#14520) 2024-09-11 11:10:24 -03:00
Spike Curtis 5bd19f8ba3 fix: fix flake in TestWorkspaceAgentClientCoordinate_ResumeToken (#14642)
fixes #14365

I bet what's going on is that in `connectToCoordinatorAndFetchResumeToken()` we call `Coordinate()`, send a message on the `Coordinate` client and then close it in rapid succession. We don't wait around for a response from the coordinator, so dRPC is likely aborting the call `Coordinate()` in the backend because the stream is closed before it even gets a chance.

Instead of using the Coordinator to record the peer ID assigned on the API call, we can wrap the resume token provider, since we call that API _and_ wait for a response. This also affords the opportunity to directly assert we get called with the right token.
2024-09-11 16:32:47 +04:00
Danny Kopping 1b5f3418d3 chore: align active version terminology and link to docs (#14639) 2024-09-11 12:25:07 +02:00
Ethan 4f2202fe34 fix: fix TestPing/1Ping flake (#14634) 2024-09-11 14:22:23 +10:00
Ethan c8580a415a feat: expose current agent connections by type via prometheus (#14612) 2024-09-11 14:13:30 +10:00
Jaayden Halko 40688e40df chore: improve content of frontend contributing guide (#14619)
* chore: update frontend contributing guide

* chore: cleanup language

* chore: cleanup

* chore: updates for comments
2024-09-10 15:52:05 -04:00
Danielle Maywood 90b29df145 feat: add groups column to members page in organizations (#14620)
* feat: add groups column to members page in organizations

* fix: run 'make fmt'

* fix: stop displaying groups member is in for other organisations

* fix: run 'make fmt'
2024-09-10 19:05:25 +01:00
Justin Fowler 85cc695dc6 fix(site): strip version build info from docs link URLs (#14601) 2024-09-10 10:15:23 -06:00
Ammar Bandukwala 0787c42d32 chore(.github): disable stalebot (#14637) 2024-09-10 10:51:44 -05:00
Danny Kopping 914f35a3a3 chore: document RBAC usage (#14065) 2024-09-10 15:15:30 +00:00
Jon Ayers 328e69629c fix: limit OAuth redirects to local paths (#14585)
- This prevents a malicious user from crafting a redirect
  URL to a nefarious site under their control.
2024-09-10 15:58:50 +01:00
Ethan 2a9234e9ba fix: remove coderdtest dependency from codersdk (#14633) 2024-09-10 20:55:50 +10:00
Yahya d1db11ab21 fix(helm): use list instead of dict for tolerations (#14604)
Fixes #14603
2024-09-10 01:02:57 +01:00
Steven Masley cb9d40fb8a feat: implement runtime configuration package with multi-org support (#14624)
runtime configuration package
---------

Signed-off-by: Danny Kopping <danny@coder.com>
Co-authored-by: Danny Kopping <danny@coder.com>
2024-09-09 14:14:52 -05:00
Michael Smith 9da646704b fix: prefer organization display name for workspaces table (#14617)
* fix: prefer organization display name for workspaces table

* fix: update story to account for organization name changes

* fix: resolve typo in regex search for test
2024-09-09 11:35:28 -04:00
Eric Paulsen eb646f036e docs: fix SCIM env var (#14618) 2024-09-09 11:14:51 -04:00
Danielle Maywood 25f1ddbf5e feat: add 'hidden' option to 'coder_app' to hide app from UI (#14570)
Add 'hidden' property to 'coder_app' resource to allow hiding apps from the UI.
2024-09-09 14:39:32 +01:00
Ethan 918bea18c1 fix: prevent dbmem reading other groups when getting group members (#14581) 2024-09-09 14:33:11 +10:00
Jaayden Halko 6b9e1d4771 feat: create idp sync page skeleton (#14543)
* feat: initial commit for idp skeleton page

* feat: add optional tooltip icon to settings header

* feat: add help tooltip

* feat: add mock data and update pageview for mock data

* feat: initial stories

* feat: error circle

* feat: cleanup

* feat: update StatusIndicator for outlined variant

* feat: use StatusIndicator instead of Circle

* chore: cleanup

* fix: remove ternaries in css

* fix: updates for PR review comments

* chore: add story for compact empty state

* feat: extract IdpField and improve field spacing
2024-09-06 15:30:41 -04:00
Bruno Quaresma 84d312cfea fix(site): only show method warning if some template is using it (#14565)
Previously, we were showing the warning regardless of whether a template was using the misconfigured notification method or not. However, we realized this could be too noisy, so we decided to display the warning only when the user has a template configured to use the misconfigured method.
2024-09-06 14:59:58 -03:00
Steven Masley 92b81c4164 test: add some default group/roles claims to testidp (#14591)
Allows testing group/role sync with the fake
2024-09-06 12:35:17 -05:00
Michael Smith 0d6056633d fix: increase text contrast for 'create workspace' button (#14588) 2024-09-06 13:15:53 -04:00
Danny Kopping 8b1c46fbe0 fix: analyze build times over 30 days not 30 months (#14584) 2024-09-06 17:03:01 +02:00
Bruno Quaresma 0f342ed12f test(site): move users page test to storybook (#14579)
By using [Storybook interaction tests](https://storybook.js.org/tutorials/ui-testing-handbook/react/en/interaction-testing/), we improve the developer experience, as we can see what is happening in the browser, use browser tools to debug, and snapshot the component after interactions, making our tests more reliable and easier to maintain.

Fixes https://github.com/coder/coder/issues/14535
2024-09-06 09:56:51 -03:00
Ethan 208a5beb95 fix: improve duplicate template version name error (#14572) 2024-09-06 16:13:34 +10:00
Michael Smith c2491746ba feat: show organization name in workspaces table (#14547)
* chore: add organization label to workspace template column

* chore: add test for presence of showOrganizations context value

* fix: organize imports

* fix: expose table row subtitles only to screen readers
2024-09-05 12:32:21 -04:00
Eric Paulsen c1bb5abcb7 docs: add new marketecture (#14567) 2024-09-05 08:16:59 -04:00
Ethan cd7ce8ecfb docs: add networking troubleshooting page (#14548) 2024-09-05 13:32:08 +10:00
Kayla Washburn-Love 84922e239f feat: add provisioners view to organization settings (#14501) 2024-09-04 16:21:24 -06:00
Bruno Quaresma c3f0db3671 test(site): make loading snapshots more predictable (#14564)
Abstracts the Spinner component to control the display of the CircularProgress component. This allows us to make it static during Chromatic tests, making loading tests easier to visualize.
2024-09-04 15:20:41 -03:00
Mathias Fredriksson 8f07d3357e feat(agent/agentssh): use tcp for X11 forwarding (#14560)
Fixes #14198
2024-09-04 20:06:08 +03:00
Marcin Tojek e6d8f674ad feat: generate golden files for notification templates (#14537) 2024-09-04 18:26:57 +02:00
Cian Johnston bcf9bc3c90 feat(cli): add --provisioner-log-debug option (#14558)
Allows starting a build in debug mode from the CLI without needing
to have the build fail first by adding `--provisioner-log-debug`.
2024-09-04 14:39:35 +01:00
Cian Johnston bd90740166 chore(docs): remove dead links to mark's unmaintained vs-code-server template (#14559) 2024-09-04 13:19:11 +01:00
Spike Curtis 7b39f6b0d4 fix: improves coordination logging (#14556) 2024-09-04 15:10:43 +04:00
dependabot[bot] 2e6dbd18b3 chore: bump github.com/moby/moby from 27.1.1+incompatible to 27.2.0+incompatible (#14526)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-04 10:48:01 +00:00
Danielle Maywood 1958436b1d chore: replace AlecAivazis/survey with charmbracelet/bubbletea (#14475)
Replaces the unmaintained https://github.com/AlecAivazis/survey library with https://github.com/charmbracelet/bubbletea.
2024-09-04 11:38:08 +01:00
Cian Johnston 2ed88d593a ci: disable update-flake in PRs (#14554) 2024-09-04 10:18:18 +00:00
Cian Johnston 5366f2576f fix(provisionerd/runner): do not log entire resources (#14538)
fix(coderd/workspaceagentsrpc): do not log entire agent
fix(provisionerd/runner): do not log entire resources
2024-09-04 10:23:34 +01:00
Ethan 8f85464fe6 feat(codersdk): export name validators (#14551) 2024-09-04 08:34:39 +00:00
Ethan 01a904c133 feat(codersdk): export name validators (#14550)
* feat(codersdk): export name validators

* review
2024-09-04 18:17:53 +10:00
Jaayden Halko 093d243811 feat: add resource-action pills to custom roles table (#14354)
* feat: add resource-action pills to custom roles table

* fix: remove permission from theme and change name to colorRoles

* fix: revert name from colorRoles to roles

* fix: format

* fix: custom role with no permissions

* feat: extract permissions pull list component and add tests

* chore: undo color roles name change

* feat: add experimental pill colors

* fix: format

* chore: update experiment name

* chore: cleanup
2024-09-03 16:39:18 -04:00
Phorcys 44210631cd chore(docs): correct inaccuracies in the "Docker in Workspaces" page (#14546) 2024-09-03 20:50:39 +02:00
Bruno Quaresma 242b1ea4ca fix(site): fix agent logs streaming for third party apps (#14541) 2024-09-03 15:01:02 -03:00
dependabot[bot] fcb0ce1f1b chore: bump cronstrue from 2.43.0 to 2.50.0 in /site (#14512)
Bumps [cronstrue](https://github.com/bradymholt/cronstrue) from 2.43.0 to 2.50.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.43.0...v2.50.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>
2024-09-03 11:46:23 -06:00
Stephen Kirby 5cffac29da chore(docs): add version updates and vscode extensions doc path (#14542)
* docs fixups for 2.15

* release-calendar
2024-09-03 17:28:40 +00:00
Steven Masley 7c8c02733d chore: disallow sdk imports from the db package, switch enum to string(#14539)
* chore: disallow sdk imports from the db package
* convert to string
2024-09-03 10:32:33 -05:00
dependabot[bot] 48430625a0 ci: bump crate-ci/typos from 1.24.1 to 1.24.3 in the github-actions group (#14521)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-09-03 17:17:12 +05:00
Marcin Tojek c74fed11ac fix: add missing down migration (#14536) 2024-09-03 13:04:06 +02:00
Danny Kopping f23a05075e feat: support optional SMTP auth (#14533) 2024-09-03 11:51:34 +02:00
Spike Curtis 0eca1fcb8b fix: fix TestPendingUpdatesMetric flaky assertion (#14534) 2024-09-03 13:47:34 +04:00
dependabot[bot] 2f18f4583b chore: bump github.com/gohugoio/hugo from 0.131.0 to 0.133.1 (#14523)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 09:45:36 +00:00
dependabot[bot] 1d331dd049 chore: bump github.com/coder/serpent from 0.7.1-0.20240822034013-1b2301f8c920 to 0.8.0 (#14522)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 14:32:27 +05:00
dependabot[bot] aa4a6f89ba chore: bump github.com/hashicorp/hcl/v2 from 2.21.0 to 2.22.0 (#14524)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 08:58:58 +00:00
dependabot[bot] 903993a14a chore: bump github.com/open-policy-agent/opa from 0.67.0 to 0.68.0 (#14528)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 08:43:51 +00:00
dependabot[bot] 478121df77 chore: bump github.com/prometheus/common from 0.55.0 to 0.57.0 (#14527)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 08:30:11 +00:00
dependabot[bot] 2368f48c1c chore: bump google.golang.org/grpc from 1.65.0 to 1.66.0 (#14525)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 08:17:50 +00:00
dependabot[bot] 4c8a560e19 chore: bump github.com/go-chi/httprate from 0.12.0 to 0.14.1 (#14503)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 13:03:36 +05:00
Spike Curtis 4eac2acede fix: stop reporting future licenses as errors (#14492) 2024-09-03 09:22:46 +04:00
Spike Curtis 5bd5801286 fix: allow posting licenses that will be valid in future (#14491) 2024-09-03 09:09:38 +04:00
Stephen Kirby 0785b77d0b Minor fixups, added troubleshooting (#14519) (#14530)
(cherry picked from commit 66c8060605)

Co-authored-by: Danny Kopping <danny@coder.com>
2024-09-02 14:47:38 -05:00
Danny Kopping 66c8060605 Minor fixups, added troubleshooting (#14519) 2024-09-02 16:10:54 +02:00
dependabot[bot] 741d60a25e chore: bump google.golang.org/api from 0.192.0 to 0.195.0 (#14504)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 16:16:43 +05:00
dependabot[bot] 3a8424ea23 chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.66.0 to 1.67.0 (#14429)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 15:35:55 +05:00
dependabot[bot] 92253d0f52 chore: bump the emotion group across 1 directory with 2 updates (#14508)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 15:35:33 +05:00
dependabot[bot] 7d15aad11a chore: bump eslint-config-next from 14.2.6 to 14.2.7 in /offlinedocs (#14510)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 15:35:18 +05:00
Ethan e5d4f3557b chore: only show license expiry warning for deployment admins (#14488) 2024-09-02 17:54:39 +10:00
dependabot[bot] faf245234f ci: bump crate-ci/typos from 1.23.6 to 1.24.1 in the github-actions group (#14431)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-01 05:22:39 +00:00
dependabot[bot] c9fcab3717 chore: bump github.com/fergusstrange/embedded-postgres from 1.28.0 to 1.29.0 (#14430)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-01 10:15:52 +05:00
dependabot[bot] ead8fae63d chore: bump framer-motion from 10.17.6 to 10.18.0 in /offlinedocs (#14290)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-01 10:02:00 +05:00
Steven Masley 0ef85147cd chore: match templates search error with workspace search error (#14479)
* chore: make templates search error the same as workspaces
2024-08-30 15:14:59 -05:00
Cian Johnston 0f8251be41 feat(coderd/database/dbpurge): retain most recent agent build logs (#14460)
Updates the `DeleteOldWorkspaceAgentLogs` to:
- Retain logs for the most recent build regardless of age,
- Delete logs for agents that never connected and were created before
   the cutoff for deleting logs while still retaining the logs most recent build.
2024-08-30 17:39:09 +01:00
Steven Masley 10c958bba1 chore: implement organization sync and create idpsync package (#14432)
* chore: implement filters for the organizations query
* chore: implement organization sync and create idpsync package

Organization sync can now be configured to assign users to an org based on oidc claims.
2024-08-30 11:19:36 -05:00
Danny Kopping 043f4f5327 docs: add documentation for notifications feature (#14478) 2024-08-30 17:30:06 +02:00
Mathias Fredriksson 13e5c51c30 chore(dogfood): optimize dockerfile for envbuilder cache probing (#14497) 2024-08-30 17:54:19 +03:00
Danny Kopping 9596f236c1 fix: use negative deadline to ensure timeout in TestWebhook/timeout (#14498) 2024-08-30 16:46:13 +02:00
Danny Kopping 0f414a00d3 fix: restore closing SMTP message on method exit (#14496) 2024-08-30 13:03:25 +02:00
Cian Johnston a74273f1fd chore(coderd/database/dbpurge): replace usage of time.* with quartz (#14480)
Related to #10576

This PR introduces quartz to coderd/database/dbpurge and updates the following unit tests to make use of Quartz's functionality:

- TestPurge
- TestDeleteOldWorkspaceAgentLogs

Additionally, updates DeleteOldWorkspaceAgentLogs to replace the hard-coded interval with a parameter passed into the query. This aids in testing and brings us a step towards allowing operators to configure the cutoff interval for workspace agent logs.
2024-08-30 11:55:47 +01:00
Danny Kopping c90be9b0c1 fix: correctly close SMTP message and await response (#14495) 2024-08-30 11:37:50 +02:00
Ethan 851df91991 fix: serve test derp map locally (#14490) 2024-08-30 18:43:51 +10:00
Ethan 628750232f fix: delete workspace agent stats after 180 days (#14489)
Fixes #13430.

The test for purging old workspace agent stats from the DB was consistently failing when ran with Postgres towards the end of the month, but not with the in-memory DB. 

This was because month intervals are calculated differently for `time.Time` and the `interval` type in Postgres:

```
ethan=# SELECT
    '2024-08-30'::DATE AS original_date,
    ('2024-08-30'::DATE - INTERVAL '6 months') AS sub_date;
 original_date |      sub_date
---------------+---------------------
 2024-08-30    | 2024-02-29 00:00:00
(1 row)
```

Using `func (t Time) AddDate(years int, months int, days int) Time`, where `months` is `-6`:
```
Original: 2024-08-30 00:00:00 +0000 UTC
6 Months Earlier: 2024-03-01 00:00:00 +0000 UTC
```

Since 6 months was chosen arbitrarily, we should be able to change it to 180 days, to remove any ambiguity between the in-memory DB, and the Postgres DB. The alternative solution would involve implementing Postgres' month interval algorithm in Go.

The UI only shows stats as old as 168 days (24 weeks), so a frontend change isn't required for the extra days of stats we lose in some cases.
2024-08-30 18:30:04 +10:00
Kayla Washburn-Love 4672849d05 chore: clean up usage of Object.keys (#14484) 2024-08-29 17:21:29 -06:00
Kayla Washburn-Love d2a22c538b chore: add more stories and use new groups query for user settings page (#14481) 2024-08-29 17:00:12 -06:00
Kayla Washburn-Love 6bc93520c4 fix: fix light mode styles for organization delete button (#14485) 2024-08-29 16:10:31 -06:00
Asher cd38e297b6 fix: make non-existent asset paths return a 404 (#14472)
Before, if a file was not found we would serve the app.

This would cause either the login page or the workspace
page to load (and consequently error because `assets` is
likely not a valid user).
2024-08-29 13:52:08 -08:00
Asher ef7fcf3930 fix: include dormant users in template acl query (#14461)
The issue is that if you add a user and then immediately go to give them
permissions, you can add them but they will not show up in the UI.  They
also do not show up in the audit log entry.
2024-08-29 13:48:28 -08:00
Kayla Washburn-Love 49afab12d5 feat: show organization name for groups on user profile (#14448) 2024-08-29 10:55:00 -06:00
Ethan 4b5c45d6df feat(cli): add aws check to ping p2p diagnostics (#14450) 2024-08-29 21:41:12 +10:00
Ethan e65eb0321c fix: support additional http headers on agent (#14464) 2024-08-29 14:15:15 +10:00
Steven Masley 6dbfe6f7ae chore: remove duplicates using the symmetric difference function (#14469)
The `SymmetricDifferenceFunc` used to include duplicates, which was incorrect.
2024-08-28 21:06:27 -05:00
Jaayden Halko 15d74a11a0 feat: improve custom roles create/edit page (#14456)
* fix: improve show/hide checkbox text

* feat: add parent checkbox for grouped resource permissions

* fix: align action list item to a grid

* chore: add additional tests

* fix: format
2024-08-28 18:13:33 -04:00
dependabot[bot] f3ea740b27 chore: bump next from 14.2.4 to 14.2.7 in /offlinedocs (#14473)
Bumps [next](https://github.com/vercel/next.js) from 14.2.4 to 14.2.7.
- [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/v14.2.4...v14.2.7)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-28 14:20:04 -06:00
Steven Masley b96ac677f1 chore: add organization search query to workspaces (#14474)
* chore: add organization search query to workspaces
2024-08-28 15:18:45 -05:00
Steven Masley 54fe082551 chore: implement filters for the organizations query (#14468)
Required for organization sync. Allows fetching a filtered set of orgs.
2024-08-28 13:24:28 -05:00
dependabot[bot] 7667d64686 chore: bump the mui group across 1 directory with 6 updates (#14400)
* chore: bump the mui group across 1 directory with 6 updates

Bumps the mui group with 6 updates in the /site directory:

| Package | From | To |
| --- | --- | --- |
| [@mui/icons-material](https://github.com/mui/material-ui/tree/HEAD/packages/mui-icons-material) | `5.16.0` | `5.16.7` |
| [@mui/lab](https://github.com/mui/material-ui/tree/HEAD/packages/mui-lab) | `5.0.0-alpha.129` | `5.0.0-alpha.173` |
| [@mui/material](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material) | `5.16.0` | `5.16.7` |
| [@mui/system](https://github.com/mui/material-ui/tree/HEAD/packages/mui-system) | `5.16.0` | `5.16.7` |
| [@mui/utils](https://github.com/mui/material-ui/tree/HEAD/packages/mui-utils) | `5.16.0` | `5.16.6` |
| [@mui/x-tree-view](https://github.com/mui/mui-x/tree/HEAD/packages/x-tree-view) | `7.9.0` | `7.13.0` |



Updates `@mui/icons-material` from 5.16.0 to 5.16.7
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/v5.16.7/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.16.7/packages/mui-icons-material)

Updates `@mui/lab` from 5.0.0-alpha.129 to 5.0.0-alpha.173
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/next/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/HEAD/packages/mui-lab)

Updates `@mui/material` from 5.16.0 to 5.16.7
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/v5.16.7/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.16.7/packages/mui-material)

Updates `@mui/system` from 5.16.0 to 5.16.7
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/v5.16.7/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.16.7/packages/mui-system)

Updates `@mui/utils` from 5.16.0 to 5.16.6
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/v5.16.6/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.16.6/packages/mui-utils)

Updates `@mui/x-tree-view` from 7.9.0 to 7.13.0
- [Release notes](https://github.com/mui/mui-x/releases)
- [Changelog](https://github.com/mui/mui-x/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mui/mui-x/commits/v7.13.0/packages/x-tree-view)

---
updated-dependencies:
- dependency-name: "@mui/icons-material"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: mui
- dependency-name: "@mui/lab"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: mui
- dependency-name: "@mui/material"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: mui
- dependency-name: "@mui/system"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: mui
- dependency-name: "@mui/utils"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: mui
- dependency-name: "@mui/x-tree-view"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: mui
...

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

* Fix breaking changes

* Fix fmt

---------

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>
2024-08-28 15:19:05 -03:00
Danny Kopping f24cb5cc96 fix: prevent test flakiness (#14467)
Signed-off-by: Danny Kopping <danny@coder.com>
2024-08-28 16:33:27 +02:00
Ethan c597c9260d fix: wait for provisioner daemon jobs to finish after sigterm (#14466) 2024-08-28 20:16:15 +10:00
Danielle Maywood 839918c5e7 chore(docs): document agent api debug endpoints (#14454)
* chore(docs): add agent api debug docs

* chore(docs): add sections to agent api readme

* chore(docs): link debug manifest to agentsdk.Manifest schema

* chore(docs): add high level overview of agent api debug docs

* chore(docs): link to agent api docs from reference

* chore(docs): fix invalid paths

* chore(docs): use env variable for coder agent debug address
2024-08-28 09:47:14 +01:00
Ethan 8c15192433 feat(cli): add p2p diagnostics to ping (#14426)
First PR to address #14244.

Adds common potential reasons as to why a direct connection to the workspace agent couldn't be established to `coder ping`:
- If the Coder deployment administrator has blocked direction connections (`CODER_BLOCK_DIRECT`).
- If the client has no STUN servers within it's DERP map.
- If the client or agent appears to be behind a hard NAT, as per Tailscale `netInfo.MappingVariesByDestIP`

Also adds a warning if the client or agent has a network interface below the 'safe' MTU for tailnet. This warning is always displayed at the end of a `coder ping`.
2024-08-28 15:39:01 +10:00
Kayla Washburn-Love b36d979a60 chore: add provisioner api version to /buildinfo (#14446) 2024-08-27 13:40:51 -06:00
dependabot[bot] f3c76ce244 chore: bump eslint-config-next from 14.0.1 to 14.2.6 in /offlinedocs (#14402)
Bumps [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next) from 14.0.1 to 14.2.6.
- [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/v14.2.6/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>
2024-08-27 13:39:25 -06:00
Ethan 63fe2305f8 fix: detect nested dotfiles scripts (#14455) 2024-08-28 02:14:23 +10:00
Marcin Tojek 47f2c7d683 feat: notify about manual failed builds (#14419) 2024-08-27 14:35:28 +00:00
Ethan 0afff43f9d chore: remove dogfood import block (#14449) 2024-08-27 06:28:25 +00:00
Asher 499769187b fix: increase group name limit to 36 from 32 (#14443) 2024-08-26 11:38:31 -08:00
Asher 88d7181a47 fix: filter "add group member" by organization (#14404)
This is accomplished by using the members endpoint instead of the users
endpoint, and to that end the UserAutocomplete component has been
reworked to support either endpoint as separate components with a shared
base.

* Add Storybook for groups page

This ensures it is using the right endpoint for the add member dropdown.

* Add ability to mock react-query errors
2024-08-26 11:13:34 -08:00
Asher 83f9ea17b4 chore: update organizations doc link (#14361) 2024-08-26 10:40:18 -08:00
Steven Masley 93eef7b542 chore: keep entitlements in the options only, simplify fields (#14434)
* chore: refactor entitlements to keep it in just the options

Duplicating the reference did not feel valuable, just confusing
2024-08-26 13:05:03 -05:00
Jaayden Halko fb6b954222 chore: update secondary and disabled text colors (#14355) 2024-08-26 12:22:32 -04:00
Garrett Delfosse ded612d3ec fix: use authenticated urls for pubsub (#14261) 2024-08-26 15:04:04 +00:00
Cian Johnston 6914862903 fix(cli): add check for DisableOwnerWorkspaceExec in scaletest (#14417)
- Adds `--use-host-login` to `coder exp scaletest workspace-traffic`
- Modifies getScaletestWorkspaces to conditionally filter workspaces if `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` is set
- Adds a warning if `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` is set and scaletest workspaces are filtered out due to ownership mismatch.
- Modifies `coderdtest.New` to detect cross-test bleed of `CODER_DISABLE_OWNER_WORKSPACE_ACCESS` and fast-fail.
2024-08-26 12:02:54 +01:00
Steven Masley c8eacc6df7 chore!: allow CreateUser to accept multiple organizations (#14383)
* chore: allow CreateUser to accept multiple organizations

In a multi-org deployment, it makes more sense to allow for multiple
org memberships to be assigned at create. The legacy param will still
be honored.

* Handle sdk deprecation better by maintaining cli functions
2024-08-23 21:23:51 +00:00
Steven Masley af125c3795 chore: refactor entitlements to be a safe object to use (#14406)
* chore: refactor entitlements to be passable as an argument

Previously, all usage of entitlements requires mutex usage on the
api struct directly. This prevents passing the entitlements to
a sub package. It also creates the possibility for misuse.
2024-08-23 16:21:58 -05:00
Steven Masley cb6a47227f chore: implement generalized symmetric difference for set comparison (#14407)
* chore: implement generalized symmetric difference for set comparison

Going to be used in Organization Sync + maybe group sync. Felt
better to reuse, rather than copy
2024-08-23 14:52:35 -05:00
Cian Johnston 4bd7fe8506 fix(examples/templates/gcp-devcontainer): fix location of env file (#14422) 2024-08-23 17:46:02 +01:00
Cian Johnston 53e5746636 feat(examples/templates/gcp-devcontainer): add envbuilder provider (#14405)
This PR modifies the gcp-devcontainer example template to include
support for devcontainer caching using the envbuilder provider.

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-08-23 17:36:24 +01:00
Danny Kopping a4d785dec5 chore: use idiomatic test setup in notification tests (#14416) 2024-08-23 16:29:27 +02:00
Cian Johnston d4adfa3902 fix(coderd/database/dbmem): include a technical summary row on over-pagination (#14415) 2024-08-23 13:16:55 +01:00
Cian Johnston 99e103e790 feat(coderd/coderdtest): allow mutating deployment values (#14414) 2024-08-23 12:15:22 +01:00
Ethan 4cc26be5ec fix: set network telemetry client version on server (#14376) 2024-08-23 06:17:28 +00:00
Kayla Washburn-Love 5710a98714 chore: update @types/node and fix vite warning (#14403) 2024-08-22 16:44:14 -06:00
dependabot[bot] b0084e2229 chore: bump github.com/prometheus/client_golang from 1.19.1 to 1.20.1 (#14379)
* chore: bump github.com/prometheus/client_golang from 1.19.1 to 1.20.1

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.19.1 to 1.20.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.20.1/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.19.1...v1.20.1)

---
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>

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-23 01:40:07 +03:00
Spike Curtis d52bc91e48 chore: add dbauthz to unhanger tests (#14394) 2024-08-22 22:23:52 +04:00
dependabot[bot] 337ee3544b chore: bump eslint from 8.56.0 to 8.57.0 in /offlinedocs (#14294)
Bumps [eslint](https://github.com/eslint/eslint) from 8.56.0 to 8.57.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.56.0...v8.57.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>
2024-08-22 19:59:12 +03:00
dependabot[bot] aeb4040958 chore: bump the emotion group across 1 directory with 3 updates (#14396)
* chore: bump the emotion group across 1 directory with 3 updates

Bumps the emotion group with 3 updates in the /site directory: [@emotion/css](https://github.com/emotion-js/emotion), [@emotion/react](https://github.com/emotion-js/emotion) and [@emotion/styled](https://github.com/emotion-js/emotion).


Updates `@emotion/css` from 11.11.2 to 11.13.0
- [Release notes](https://github.com/emotion-js/emotion/releases)
- [Changelog](https://github.com/emotion-js/emotion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/emotion-js/emotion/compare/@emotion/css@11.11.2...@emotion/css@11.13.0)

Updates `@emotion/react` from 11.11.4 to 11.13.3
- [Release notes](https://github.com/emotion-js/emotion/releases)
- [Changelog](https://github.com/emotion-js/emotion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/emotion-js/emotion/compare/@emotion/react@11.11.4...@emotion/react@11.13.3)

Updates `@emotion/styled` from 11.11.5 to 11.13.0
- [Release notes](https://github.com/emotion-js/emotion/releases)
- [Changelog](https://github.com/emotion-js/emotion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/emotion-js/emotion/compare/@emotion/styled@11.11.5...@emotion/styled@11.13.0)

---
updated-dependencies:
- dependency-name: "@emotion/css"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: emotion
- dependency-name: "@emotion/react"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: emotion
- dependency-name: "@emotion/styled"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: emotion
...

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

* Fix lint

* Fix type

* Fix fmt

---------

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>
2024-08-22 13:46:59 -03:00
Marcin Tojek c818b4ddd4 feat: add notification for suspended/activated account (#14367)
* migrations

* notify

* fix

* TestNotifyUserSuspended

* TestNotifyUserReactivate

* post merge

* fix escape

* TestNotificationTemplatesCanRender

* links and events

* notifyEnq

* findUserAdmins

* notifyUserStatusChanged

* go build

* your and admin

* tests

* refactor

* 247

* Danny's review
2024-08-22 13:52:25 +02:00
dependabot[bot] 046c1c4228 chore: bump the vite group across 1 directory with 3 updates (#14281)
Bumps the vite group with 3 updates in the /site directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite), [vite-plugin-checker](https://github.com/fi3ework/vite-plugin-checker) and [vite-plugin-turbosnap](https://github.com/IanVS/vite-plugin-turbosnap).


Updates `vite` from 5.3.3 to 5.4.1
- [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/v5.4.1/packages/vite)

Updates `vite-plugin-checker` from 0.7.1 to 0.7.2
- [Release notes](https://github.com/fi3ework/vite-plugin-checker/releases)
- [Changelog](https://github.com/fi3ework/vite-plugin-checker/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fi3ework/vite-plugin-checker/compare/vite-plugin-checker@0.7.1...vite-plugin-checker@0.7.2)

Updates `vite-plugin-turbosnap` from 1.0.2 to 1.0.3
- [Release notes](https://github.com/IanVS/vite-plugin-turbosnap/releases)
- [Commits](https://github.com/IanVS/vite-plugin-turbosnap/compare/v1.0.2...v1.0.3)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: vite
- dependency-name: vite-plugin-checker
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: vite
- dependency-name: vite-plugin-turbosnap
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: vite
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-22 14:18:35 +03:00
dependabot[bot] 3e5cfa9e45 chore: bump msw from 2.2.3 to 2.3.5 in /site (#14138)
Bumps [msw](https://github.com/mswjs/msw) from 2.2.3 to 2.3.5.
- [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/v2.2.3...v2.3.5)

---
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>
2024-08-22 14:17:49 +03:00
dependabot[bot] fbec45b807 chore: bump pretty-bytes from 6.1.0 to 6.1.1 in /site (#14301)
Bumps [pretty-bytes](https://github.com/sindresorhus/pretty-bytes) from 6.1.0 to 6.1.1.
- [Release notes](https://github.com/sindresorhus/pretty-bytes/releases)
- [Commits](https://github.com/sindresorhus/pretty-bytes/compare/v6.1.0...v6.1.1)

---
updated-dependencies:
- dependency-name: pretty-bytes
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-22 14:17:13 +03:00
Danny Kopping cc944209ae fix: include provisioner timing action in hash func (#14388) 2024-08-22 12:31:50 +02:00
Cian Johnston 82e6070c7a fix(cli): ensure that the support bundle command does not panic on zero values (#14392)
We try to write a cute little summary at the end of the bundle, but that could panic if some of the fields of the bundle were nil. Adds a test that essentially ensures nil values in a bundle, and ensures that it can be handled without losing our towels.

Co-authored-by: Danny Kopping <danny@coder.com>
2024-08-22 11:15:02 +01:00
Ethan 3514ca3476 chore: skip completion install prompts in non-interactive shells (#14391) 2024-08-22 15:40:53 +10:00
Dean Sheather e8c59a1d9d chore: avoid flake in resume token test (#14378) 2024-08-22 13:27:43 +10:00
Ethan d7800a43e9 docs: add coderd terraform provider (#14374) 2024-08-22 13:03:33 +10:00
Stephen Kirby 9f4f88f38c version-flags (#14386) 2024-08-21 13:24:35 -05:00
Steven Masley a359879af5 chore: scope workspace quotas to organizations (#14352)
* chore: scope workspace quotas to organizations

Quotas are now a function of (user_id, organization_id). They are
still sourced from groups. Deprecate the old api endpoint.
2024-08-21 09:25:20 -05:00
Danny Kopping fa733318e0 Add missing content (#14380) 2024-08-21 12:46:11 +00:00
Danny Kopping 6960d194ae feat: add provisioning timings to understand slow build times (#14274) 2024-08-21 14:18:58 +02:00
Danny Kopping 9c8c6a952d feat: add notification deduplication trigger (#14172) 2024-08-21 11:18:03 +02:00
Ethan d9f419308a chore(dogfood): use remote tf state (#14363) 2024-08-21 12:46:28 +10:00
Jon Ayers b6d35edebd chore: remove meticulous from CI (#14369) 2024-08-20 14:13:13 -04:00
Kayla Washburn-Love 03f05e25f6 chore(site): make info gray (#14356) 2024-08-20 11:59:23 -06:00
Ethan cca4519420 feat: enable setting max port share level during template creation (#14366) 2024-08-20 22:48:39 +10:00
Cian Johnston 2bef1752f1 chore(envbuilder-dogfood): update envbuilder-dogfood template to use provider (#14324)
Updates the envbuilder-dogfood template to use the envbuilder provider.
Relates to coder/team-coconut#38

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-08-20 11:50:39 +01:00
Cian Johnston 40baa5bc72 chore(examples): update devcontainer-{docker,kubernetes} to use computed env (#14328)
Updates devcontainer-docker and devcontainer-kubernetes example templates to use computed env from provider, if applicable.
2024-08-20 10:47:02 +01:00
Dean Sheather cf8be4eac5 feat: add resume support to coordinator connections (#14234) 2024-08-20 17:16:49 +10:00
Ethan 0b2ba96065 feat(cli): add shell completions (#14341) 2024-08-20 14:47:46 +10:00
Kyle Carberry 6f9b3c1592 chore: sign the windows installer (#14353) 2024-08-19 20:33:37 -04:00
Asher f8f3d8967e fix: label premium features in middleware error (#14360)
Previously, all features were called enterprise in the license check middleware.
2024-08-19 15:58:41 -08:00
Asher 4446d61fcd fix: show org summary page if not entitled (#14336)
You cannot edit the settings without being entitled, so show the summary
page instead.
2024-08-19 15:57:02 -08:00
Kayla Washburn-Love 1c3dc8392e chore: remove dangling eslint-ignore comments (#14334) 2024-08-19 16:08:53 -06:00
Asher fa59b30cfb chore: update editorconfig with new tabs default (#14335) 2024-08-19 11:40:58 -08:00
dependabot[bot] f007c90a30 ci: bump contributor-assistant/github-action (#14345)
Bumps the github-actions group with 1 update in the / directory: [contributor-assistant/github-action](https://github.com/contributor-assistant/github-action).


Updates `contributor-assistant/github-action` from 2.4.0 to 2.5.1
- [Release notes](https://github.com/contributor-assistant/github-action/releases)
- [Commits](https://github.com/contributor-assistant/github-action/compare/v2.4.0...v2.5.1)

---
updated-dependencies:
- dependency-name: contributor-assistant/github-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>
2024-08-19 21:53:20 +03:00
Bruno Quaresma 10327fb3a9 fix(coderd): humanize duration on notifications (#14333) 2024-08-19 15:49:47 -03:00
Steven Masley 755afa31cf chore: ui error handling should be specific to general (#14346)
* chore: ui error handling should be specific to general

Specific errors should be checked before defaulting to a general
error handling
2024-08-19 13:28:43 -05:00
Steven Masley 422e044859 chore: forbidden error on create workspace without permissions (#14347)
Multi-org enables the possibility of a user having template permissions,
but not workspace create permissions. The unauthorized error should be
returned instead of a 404. This does not leak any information the user
cannot already obtain.
2024-08-19 13:28:27 -05:00
Ben Potter c3ef7dc33b docs: add organizations guide (#14012)
* wip

* add workspace & members screenshot

* add audit logs

* org id and provisioner key

* Update docs/guides/using-organizations.md

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>

* edits to docs

* fixup

* fmt

* changes based on kirby feedback

* fix link

* fix manifest

* fmt

---------

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
2024-08-19 15:11:36 +00:00
Ethan d0f36dc6ba ci: add networking release validation (#14273) 2024-08-19 16:31:49 +10:00
Muhammad Atif Ali cba6e93176 chore: update docs links (#14221) 2024-08-17 11:51:13 +00:00
Jaayden Halko bec6a26d0e fix: re-add original create template context menu (#14326) 2024-08-16 17:16:13 -04:00
dependabot[bot] 8c4d726cf6 chore: bump the x group with 6 updates (#14235)
* chore: bump the x group with 6 updates

Bumps the x group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [golang.org/x/crypto](https://github.com/golang/crypto) | `0.25.0` | `0.26.0` |
| [golang.org/x/net](https://github.com/golang/net) | `0.27.0` | `0.28.0` |
| [golang.org/x/sys](https://github.com/golang/sys) | `0.23.0` | `0.24.0` |
| [golang.org/x/term](https://github.com/golang/term) | `0.22.0` | `0.23.0` |
| [golang.org/x/text](https://github.com/golang/text) | `0.16.0` | `0.17.0` |
| [golang.org/x/tools](https://github.com/golang/tools) | `0.23.0` | `0.24.0` |


Updates `golang.org/x/crypto` from 0.25.0 to 0.26.0
- [Commits](https://github.com/golang/crypto/compare/v0.25.0...v0.26.0)

Updates `golang.org/x/net` from 0.27.0 to 0.28.0
- [Commits](https://github.com/golang/net/compare/v0.27.0...v0.28.0)

Updates `golang.org/x/sys` from 0.23.0 to 0.24.0
- [Commits](https://github.com/golang/sys/compare/v0.23.0...v0.24.0)

Updates `golang.org/x/term` from 0.22.0 to 0.23.0
- [Commits](https://github.com/golang/term/compare/v0.22.0...v0.23.0)

Updates `golang.org/x/text` from 0.16.0 to 0.17.0
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.16.0...v0.17.0)

Updates `golang.org/x/tools` from 0.23.0 to 0.24.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.23.0...v0.24.0)

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

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

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 20:37:37 +00:00
dependabot[bot] fc3b2ff06c chore: bump google.golang.org/api from 0.190.0 to 0.192.0 (#14291)
* chore: bump google.golang.org/api from 0.190.0 to 0.192.0

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.190.0 to 0.192.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.190.0...v0.192.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>

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 23:22:39 +03:00
Ethan 0613797934 fix: use dogfood contents as template dir (#14332) 2024-08-17 02:52:26 +10:00
Ethan 363a016281 fix: move to dogfood before terraform applying 2024-08-17 02:43:16 +10:00
Ethan 979430d635 chore: manage dogfood template using coderd provider (#14321) 2024-08-17 02:33:32 +10:00
Kayla Washburn-Love 7142cbb9e6 chore: enable noConsoleLog lint (#14329) 2024-08-16 10:12:06 -06:00
dependabot[bot] 2c150d03f6 chore: bump tzdata from 1.0.30 to 1.0.40 in /site (#14303)
Bumps [tzdata](https://github.com/rogierschouten/tzdata-generate) from 1.0.30 to 1.0.40.
- [Release notes](https://github.com/rogierschouten/tzdata-generate/releases)
- [Commits](https://github.com/rogierschouten/tzdata-generate/compare/v1.0.30...v1.0.40)

---
updated-dependencies:
- dependency-name: tzdata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 17:38:05 +03:00
dependabot[bot] 9b9496cf4d chore: bump typescript from 5.3.2 to 5.5.4 in /offlinedocs (#14163)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.3.2 to 5.5.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.3.2...v5.5.4)

---
updated-dependencies:
- dependency-name: typescript
  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>
2024-08-16 17:36:54 +03:00
dependabot[bot] a62e69d34a chore: bump undici from 6.19.2 to 6.19.7 in /site (#14300)
Bumps [undici](https://github.com/nodejs/undici) from 6.19.2 to 6.19.7.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.19.2...v6.19.7)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 10:59:40 -03:00
Cian Johnston 91a74f0ead chore(examples): update kubernetes devcontainer template with envbuilder provider (#14267)
* chore(examples): update kubernetes devcontainer template with envbuilder provider

* make insecure a template variable

* Update examples/templates/devcontainer-kubernetes/README.md

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

---------

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-08-15 22:08:24 +01:00
Kayla Washburn-Love 4db8fa661e chore: ignore tabs change when using git blame (#14297) 2024-08-15 15:02:24 -06:00
Kayla Washburn-Love 95a7c0c4f0 chore: use tabs for prettier and biome (#14283) 2024-08-15 14:53:53 -06:00
dependabot[bot] db2d0596d4 chore: bump axios from 1.7.2 to 1.7.4 in /site (#14265)
Bumps [axios](https://github.com/axios/axios) from 1.7.2 to 1.7.4.
- [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.7.2...v1.7.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-15 16:02:54 -04:00
dependabot[bot] f2a96ac984 chore: bump the jest group across 1 directory with 2 updates (#14157)
Bumps the jest group with 2 updates in the /site directory: [jest](https://github.com/jestjs/jest/tree/HEAD/packages/jest) and [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest).


Updates `jest` from 29.6.2 to 29.7.0
- [Release notes](https://github.com/jestjs/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jestjs/jest/commits/v29.7.0/packages/jest)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-15 19:41:25 +00:00
dependabot[bot] 82cb6ef7ec chore: bump typescript from 5.2.2 to 5.5.4 in /site (#14164)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.2.2 to 5.5.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.2.2...v5.5.4)

---
updated-dependencies:
- dependency-name: typescript
  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>
2024-08-15 19:34:02 +00:00
Kayla Washburn-Love d15f16fa2e chore: replace eslint with biome (#14263) 2024-08-15 13:26:29 -06:00
Steven Masley 7b09d98238 chore: add /groups endpoint to filter by organization and/or member (#14260)
* chore: merge get groups sql queries into 1

* Add endpoint for fetching groups with filters
* remove 2 ways to customizing a fake authorizer
2024-08-15 13:40:15 -05:00
Steven Masley 83ccdaa755 chore: fixup quotas to only include groups you are a member of (#14271)
* chore: fixup quotas to only include groups you are a member of

Before all everyone groups were included in the allowance.

* chore: add unit test to execercise the bug
* add unit test to add rows into the everyone group
2024-08-15 13:27:50 -05:00
Bruno Quaresma f619500833 chore(site): reduce flakiness on terminal stories (#14269) 2024-08-15 11:30:17 -03:00
Kayla Washburn-Love 8563b372e8 feat: filter templates by organization (#14254) 2024-08-14 15:01:45 -06:00
Jon Ayers 4fc047954e fix: avoid deleting peers on graceful close (#14165)
* fix: avoid deleting peers on graceful close

- Fixes an issue where a coordinator deletes all
  its peers on shutdown. This can cause disconnects
  whenever a coderd is redeployed.
2024-08-14 15:16:08 -04:00
Bruno Quaresma 6f1951e1c8 feat: add template delete notification (#14250) 2024-08-14 14:22:43 -03:00
Chris LaRose 86b9c97e8e chore: update envbox template image (#14256) 2024-08-14 23:39:43 +10:00
Cian Johnston e978d4d9ac chore(examples): update devcontainer-docker template with envbuilder provider (#14199)
Updates the devcontainer-docker template with optional caching via the envbuilder provider
2024-08-14 10:32:53 +01:00
Danny Kopping c90e6d7b47 chore: fix up migration number fixer (#14266) 2024-08-14 11:05:03 +02:00
Steven Masley 84fdfd2a18 chore: remove UpsertCustomRole in favor of Insert + Update (#14217)
* chore: remove UpsertCustomRole in favor of Insert + Update

---------

Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
2024-08-13 12:53:47 -05:00
Bruno Quaresma 712a1b50d8 fix(site): correct user agent data on audit row (#14243) 2024-08-13 14:02:16 -03:00
Steven Masley ccc664de37 chore: rename 'Deployment' button to 'Administration' (#14240)
* chore: rename 'Deployment' button to 'Administration' 

Reword "Auditing" to a noun like the rest of the dropdowns
2024-08-13 11:21:02 -05:00
Bruno Quaresma f1feb40e17 docs: clone git repositories (#14090) 2024-08-13 12:55:40 -03:00
Muhammad Atif Ali 48f29a1995 docs: move api and cli docs routes to reference/ (#14241) 2024-08-13 18:39:46 +03:00
Hugo Dutka 6f9b1a39f4 fix: allow group members to read group information (#14200)
* - allow group members to read basic Group info
- allow group members to see they are part of the group, but not see that information about other members
- add a GetGroupMembersCountByGroupID SQL query, which allows group members to see members count without revealing other information about the members
- add the group_members_expanded db view
- rewrite group member queries to use the group_members_expanded view
- add the RBAC ResourceGroupMember and add it to relevant roles
- rewrite GetGroupMembersByGroupID permission checks
- make the GroupMember type contain all user fields
- fix type issues coming from replacing User with GroupMember in group member queries
- add the MemberTotalCount field to codersdk.Group
- display `group.total_member_count` instead of `group.members.length` on the account page
2024-08-13 09:20:24 -05:00
Steven Masley 60218c4c78 chore: fix dead link to privledged docker containers in docs (#14259) 2024-08-13 09:01:20 -05:00
Benjamin Peinhardt 76722a7db5 fix: make default support links respect --docs-url (#14176)
make default support links respect --docs-url
2024-08-12 17:01:22 -04:00
Kayla Washburn-Love 4c7132f08b chore: redirect to the correct template page routes (#14230) 2024-08-12 13:12:28 -06:00
Kayla Washburn-Love 59a80d70dc feat: show organization information on templates page (#14224) 2024-08-12 09:15:13 -06:00
dependabot[bot] 9715ae5932 chore: bump github.com/ory/dockertest/v3 from 3.10.0 to 3.11.0 (#14237)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 17:04:35 +03:00
Steven Masley 8af8c77e2a test: add unit test to verify group permission behavior (#14223)
* test: add unit test to verify group permission behavior
* Update coderd/database/dbauthz/groupsauth_test.go

---------

Co-authored-by: Cian Johnston <cian@coder.com>
2024-08-12 08:34:00 -05:00
dependabot[bot] 0338250d86 chore: bump github.com/charmbracelet/glamour from 0.7.0 to 0.8.0 (#14238)
* chore: bump github.com/charmbracelet/glamour from 0.7.0 to 0.8.0

Bumps [github.com/charmbracelet/glamour](https://github.com/charmbracelet/glamour) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/charmbracelet/glamour/releases)
- [Commits](https://github.com/charmbracelet/glamour/compare/v0.7.0...v0.8.0)

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

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

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 08:46:09 -04:00
Ethan 73402fc2f7 fix: fix flaking Test_sshConfigExecEscape (#14233)
Fixes #13962.
2024-08-12 18:56:34 +10:00
Asher ba4186dacc feat: show summary if unable to edit org (#14214)
This can happen if you can edit the members, for example, but not the
organization settings.  In this case you will see a new summary page
instead of the edit form.
2024-08-09 13:31:03 -08:00
Jaayden Halko 0b9ed57c10 feat: add delete custom role context menu button and modal (#14228)
* feat: delete custom role

* fix: add doc comment
2024-08-09 16:59:44 -04:00
Bruno Quaresma c648c548d8 refactor(site): make switches smaller (#14226) 2024-08-09 19:19:04 +00:00
Bruno Quaresma 21942afef3 feat(site): implement notification ui (#14175) 2024-08-09 13:43:09 -03:00
Steven Masley aaa5174bef chore: move custom-roles feature to permium license (#14201)
Currently an unsafe experiment, so it can be moved safely
2024-08-09 10:21:39 -05:00
Steven Masley 591385f2ca chore: implement fuzzy name matching for templates (#14211)
* chore: add fuzzy name search for templates
* chore: implement fuzzy name matching for templates

Templates search query defaults to a fuzzy name match
2024-08-09 10:21:26 -05:00
Bruno Quaresma 27b8f201a4 refactor: refactor notification email template (#14208) 2024-08-09 11:25:19 -03:00
Asher abbcffe181 fix: use multi-org settings layout even if not licensed (#14215)
* fix: only check flag for organization settings

I added checks against the license but actually what we want is for
these views to become the default even when not licensed (once the
experimental flag is removed).

* Move deployment settings header to components

This will let us use it in the org settings pages, for a consistent
look.

* Add premium badge

* Use settings header on org pages

* Add license badges to create org page

I am not sure if there is maybe a better place for this, but maybe this
is good enough.

* Change create org form description text

It says "change", but there is nothing to change yet since this is a new
organization.

* Consistently capitalize org menu items and headings

Also, remove the "organizations" prefix since it seems redundant.
2024-08-08 23:29:37 -08:00
Asher 9a47ea1279 chore: move back to single audit log page (#14212)
* chore: remove per-org audit links

For now at least, we will have the one audit page at /audit which lets
you filter by organization.

This also removes the need to do per-org audit permission checks.

* Filter audit org dropdown by auditable orgs

Previously all orgs you can list would appear, but you might not be
able to audit all of them.
2024-08-08 22:41:37 -08:00
Asher 6019d0ba96 fix: only show editable orgs on deployment page (#14193)
Also make sure the redirect from /organizations goes to an org that the
user can edit, rather than always the default org.
2024-08-08 22:18:20 -08:00
Benjamin Peinhardt d6c4d47229 fix: add version information to default docs links (#14205)
add version information to default docs links

---------

Co-authored-by: Kayla Washburn-Love <mckayla@hey.com>
2024-08-08 20:20:31 -05:00
Jaayden Halko 2e05329111 feat: add custom roles (#14069)
* feat: initial commit custom roles

* feat: add page to create and edit custom roles

* feat: add assign org role permission

* feat: wip

* feat: cleanup

* fix: role name is disabled when editing the role

* fix: assign role context menu falls back to name when no display_name

* feat: add helper text to let users know that role name is immutable

* fix: format

* feat: - hide custom roles tab if experiment is not enabled

* fix: use custom TableLoader

* fix: fix custom roles text

* fix: use PatchRoleRequest

* fix: use addIcon to create roles

* feat: add cancel and save buttons to top of page

* fix: use nameValidator for name

* chore: cleanup

* feat: add show all permissions checkbox

* fix: update sidebar for roles

* fix: fix format

* fix: custom roles is not needed outside orgs

* fix: fix sidebar stories

* feat: add custom roles page stories

* fix: use organization permissions

* feat: add stories for CreateEditRolePageView

* fix: design improvements for the create edit role form

* feat: add show all resources checkbox to bottom of table

* feat: improve spacing
2024-08-08 21:05:20 -04:00
Eric Paulsen 238e9956f4 docs: add vs code extensions documentation (#14119)
* docs: add vs code extensions documentation

* clarify msft marketplace connection

* `make fmt`

* fix links

* rm image

---------

Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-08-08 10:52:46 -04:00
Danny Kopping d79a7adf99 docs: advise against shared CODER_CACHE_DIRECTORY dir usage in note (#14216) 2024-08-08 12:42:47 +00:00
Ari Croock f50e1d5a9a fix(examples): use more precise example kubernetes template labels (#14028)
* fix: apply more specific selector labels to k8s example deployment template

* fix: use immutable ids instead of names for persistent resources in k8s example template as per docs
2024-08-08 11:17:18 +01:00
Steven Masley 2c13797350 chore: implement deleting custom roles (#14101)
* chore: implement deleting custom roles

* add trigger to delete role from organization members on delete
* chore: add comments to explain populated field
2024-08-07 12:37:55 -05:00
Kayla Washburn-Love d0feb70811 fix: add template editor to /templates/:templateName route group (#14206) 2024-08-07 10:31:36 -06:00
Steven Masley b55a7a8b78 chore: delete user codersdk to support status code regression (#14173)
* chore: delete user codersdk to support status code regression
* Update codersdk/users.go

Co-authored-by: Kayla Washburn-Love <mckayla@hey.com>

---------

Co-authored-by: Kayla Washburn-Love <mckayla@hey.com>
2024-08-07 11:19:31 -05:00
Mathias Fredriksson 8c0565177e chore(agent): remove err=<nil> log for batch update metadata complete (#14179)
Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
2024-08-07 11:31:47 +00:00
Danny Kopping c6076d2d0d chore: improve notification template tests' resilience (#14196) 2024-08-07 11:33:26 +02:00
Ethan e09ad1ddc1 fix: lock adding to tailnet waitgroup to avoid race (and fix flake) (#14195) 2024-08-07 15:52:42 +10:00
Stephen Kirby 46becc7201 updated version flags, release calendar (#14191) 2024-08-06 16:21:37 -05:00
Steven Masley 373b36c3c9 chore: update links to sharkymark's v2 templates (#14192)
* chore: update links to sharkymark's v2 templates

Links were broken with a refactor in the source repo.
2024-08-06 14:40:50 -05:00
Kayla Washburn-Love 3b53f5ab47 fix: only show valid organizations in CreateTemplateForm (#14174) 2024-08-06 12:10:44 -06:00
Kayla Washburn-Love ff785588fe chore: don't require an organization to read starter templates (#14190) 2024-08-06 11:26:26 -06:00
Garrett Delfosse fab196043e fix: allow tag removal in provisioner upsert (#14187) 2024-08-06 11:38:55 -04:00
Mathias Fredriksson 49feb12a7f chore(scripts): remove branch checks from release script (#14184)
The initial assumption that branch manipulations should be done by this
script and not pushed to remote manually has proven to get in the way of
the regular release flow.

These are just safety-checks to prevent user error, safe to remove.

Fixes #13648
2024-08-06 14:54:26 +00:00
Colin Adler 89e6afbc5e chore: update github.com/docker/docker (#14183)
This resolves a critical CVE that Coder is not affected by.
2024-08-06 10:50:09 -04:00
Danny Kopping 58428aafce fix: allow all users to read system notification templates (#14181) 2024-08-06 15:37:49 +02:00
Spike Curtis 70a694ed4c fix: document files API needs ustar format (#14152)
Signed-off-by: Spike Curtis <spike@coder.com>
2024-08-06 11:00:49 +04:00
Asher 097f739492 feat: add organization-scoped permission checks to deployment settings (#14063)
* s/readAllUsers/viewAllUsers

Other frontend variables use the `view` syntax.  Arguably we should 
use `read` to match the backend, but `view` does seem more UI-like.

* Check license for organizations

All the checks now require both the experiment and license.

I also renamed the variable canViewOrganizations everywhere for
consistency.

* Allow any auditor to view the audit log

* Use fine-grained permissions on settings page

Since in addition to deployment settings this page now also includes
users, audit logs, groups, and orgs.

Since you might not be able to fetch deployment values, move all the
loaders to the individual pages instead of in the wrapping layout.

* Add stories for organization members page

Needed to break it out into a separate view to do this.

* Add stories for multi-org sidebar

* Remove multi-org check from management settings layout

We only use this layout when multi-org is enabled, so no need to run the
check a second time.

* Add more stories for deployment dropdown
2024-08-05 17:55:35 -08:00
Steven Masley 0ad5f6067d chore: prevent removing members from the default organization (#14094)
* chore: prevent removing members from the default organization

Until multi-organizations is released outside an experiment, the
experiment should be backwards compatible.
2024-08-05 13:48:10 -05:00
Steven Masley 173dc0e35f chore: refactor patch custom organization route to live in enterprise (#14099)
* chore: refactor patch custom organization route to live in enterprise
2024-08-05 13:42:11 -05:00
Steven Masley a77a9ab0a6 chore: skip audit log filter for owner/admin users (#14132)
* chore: audit log filter to be skipped if user is owner/admin

Optimize for speed in the case the user can read all audit_logs

* fixup! chore: audit log filter to be skipped if user is owner/admin
2024-08-05 13:42:01 -05:00
Jon Ayers 203f48af56 fix: extend locking in wsproxy to avoid race (and fix flake) (#14167) 2024-08-05 14:30:44 -04:00
Steven Masley b80d99550a chore: revert status code change for delete users endpoint (#14168)
Revert from https://github.com/coder/coder/pull/13870
2024-08-05 13:10:56 -05:00
Jon Ayers 4e0cb60eeb fix: ignore errors on provided logger (#14169) 2024-08-05 17:22:34 +00:00
Kayla Washburn-Love dfeafa8f5a feat: show a warning when an organization has no provisioners (#14136) 2024-08-05 10:44:39 -06:00
Kayla Washburn-Love efbd6257e4 chore: remove global organization id state (#14135) 2024-08-05 10:33:58 -06:00
Jon Ayers f9b660e573 fix: ignore coderd log errors (#14166)
- This is the source of a lot of our flakes recently.
2024-08-05 12:07:06 -04:00
dependabot[bot] fce14fb9ad chore: bump github.com/hashicorp/hc-install from 0.7.0 to 0.8.0 (#14145)
* chore: bump github.com/hashicorp/hc-install from 0.7.0 to 0.8.0

Bumps [github.com/hashicorp/hc-install](https://github.com/hashicorp/hc-install) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/hashicorp/hc-install/releases)
- [Commits](https://github.com/hashicorp/hc-install/compare/v0.7.0...v0.8.0)

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

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

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 15:39:25 +00:00
dependabot[bot] 33beb9bd70 chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.64.0 to 1.66.0 (#14041)
* chore: bump gopkg.in/DataDog/dd-trace-go.v1 from 1.64.0 to 1.66.0

Bumps gopkg.in/DataDog/dd-trace-go.v1 from 1.64.0 to 1.66.0.

---
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>

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 15:26:55 +00:00
dependabot[bot] 96642382b3 chore: bump github.com/chromedp/chromedp from 0.9.2 to 0.10.0 (#14146)
* chore: bump github.com/chromedp/chromedp from 0.9.2 to 0.10.0

Bumps [github.com/chromedp/chromedp](https://github.com/chromedp/chromedp) from 0.9.2 to 0.10.0.
- [Release notes](https://github.com/chromedp/chromedp/releases)
- [Commits](https://github.com/chromedp/chromedp/compare/v0.9.2...v0.10.0)

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

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

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 18:14:49 +03:00
dependabot[bot] 25c83cf0b1 chore: bump archiver from 6.0.0 to 6.0.2 in /offlinedocs (#14162)
Bumps [archiver](https://github.com/archiverjs/node-archiver) from 6.0.0 to 6.0.2.
- [Release notes](https://github.com/archiverjs/node-archiver/releases)
- [Changelog](https://github.com/archiverjs/node-archiver/blob/master/CHANGELOG.md)
- [Commits](https://github.com/archiverjs/node-archiver/compare/6.0.0...6.0.2)

---
updated-dependencies:
- dependency-name: archiver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 18:13:03 +03:00
Bruno Quaresma e398309a8f chore: allow minor and patch updates for npm deps (#14155) 2024-08-05 11:52:39 -03:00
Danny Kopping e164b1e71c feat: add notification preferences database & audit support (#14100) 2024-08-05 16:18:45 +02:00
Cian Johnston 49a2880abc fix(testutil): ensure GetRandomName never returns strings greater tha… (#14153) 2024-08-05 15:03:07 +01:00
dependabot[bot] 8acc7f2070 ci: bump crate-ci/typos in the github-actions group (#14149)
Bumps the github-actions group with 1 update: [crate-ci/typos](https://github.com/crate-ci/typos).


Updates `crate-ci/typos` from 1.23.5 to 1.23.6
- [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.23.5...v1.23.6)

---
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>
2024-08-05 15:27:55 +03:00
dependabot[bot] 42336eef4a chore: bump github.com/gohugoio/hugo from 0.129.0 to 0.131.0 (#14147)
* chore: bump github.com/gohugoio/hugo from 0.129.0 to 0.131.0

Bumps [github.com/gohugoio/hugo](https://github.com/gohugoio/hugo) from 0.129.0 to 0.131.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.129.0...v0.131.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>

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 14:57:30 +03:00
Spike Curtis dda9c56098 fix: fix TestTailnet/Connect to wait for listener before dialing (#14148) 2024-08-05 15:45:46 +04:00
dependabot[bot] e0351124b2 chore: bump the x group with 4 updates (#14144)
* chore: bump the x group with 4 updates

Bumps the x group with 4 updates: [golang.org/x/mod](https://github.com/golang/mod), [golang.org/x/oauth2](https://github.com/golang/oauth2), [golang.org/x/sync](https://github.com/golang/sync) and [golang.org/x/sys](https://github.com/golang/sys).


Updates `golang.org/x/mod` from 0.19.0 to 0.20.0
- [Commits](https://github.com/golang/mod/compare/v0.19.0...v0.20.0)

Updates `golang.org/x/oauth2` from 0.21.0 to 0.22.0
- [Commits](https://github.com/golang/oauth2/compare/v0.21.0...v0.22.0)

Updates `golang.org/x/sync` from 0.7.0 to 0.8.0
- [Commits](https://github.com/golang/sync/compare/v0.7.0...v0.8.0)

Updates `golang.org/x/sys` from 0.22.0 to 0.23.0
- [Commits](https://github.com/golang/sys/compare/v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: x
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: x
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: x
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: x
...

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

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 14:26:08 +03:00
Bruno Quaresma ae40f8a82e chore(site): fix storybook font issue (#14137) 2024-08-02 20:08:32 -03:00
Bruno Quaresma a3c45861bf chore: upgrade nodejs tooling (#14134) 2024-08-02 19:56:12 -03:00
Bruno Quaresma 500a789e05 chore(site): remove proxy menu warnings about using fragment as child (#14121) 2024-08-02 18:52:47 -03:00
Jon Ayers f3ff172979 chore: remove dependency license review (#14131)
- It's bafflingly buggy and is a source of annoyance for virtually the
  whole team.
- Will revisit if we don't have alternatives to catching invalid licenses.
2024-08-02 14:14:14 -04:00
Stephen Kirby 98202b309e version bumps (#14128) 2024-08-02 12:34:50 -05:00
Kayla Washburn-Love 166467caf0 fix: don't require organization_id in body when updating a custom role (#14102) 2024-08-02 11:25:00 -06:00
Kyle Carberry e2cec454bc fix: check for io.EOF error in derpmap to resolve flake (#14125)
See: https://github.com/coder/coder/actions/runs/10218717887/job/28275465405?pr=14045
2024-08-02 17:08:47 +00:00
Kyle Carberry 6e36082b0f chore: add github.com user id association (#14045)
* chore: add github.com user id association

This will eventually be used to show an indicator in the UI
to star the repository if you've been using Coder for a while
and have not starred the repo.

If you have, we'll never show a thing!

* gen

* Fix model query

* Fix linting

* Ignore auditing github.com user id

* Add test

* Fix gh url var name

* Update migration

* Update coderd/database/dbauthz/dbauthz.go

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>

* Fix updating to when the token changes

* Fix migration

---------

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
2024-08-02 12:49:36 -04:00
Bruno Quaresma 4d4d27c509 chore(site): allow pnpm packages license (#14122) 2024-08-02 13:02:22 -03:00
Marcin Tojek 6428a766a9 feat: notify when a user account is deleted (#14113) 2024-08-02 14:56:54 +02:00
Marcin Tojek 4242fd9c1b fix: wrong notification group (#14112) 2024-08-02 10:00:27 +00:00
Muhammad Atif Ali 7619d1c49a chore: skip dogfood workflow for dependabot PRs (#14111) 2024-08-02 09:32:35 +00:00
Marcin Tojek 76ce460cc4 fix: typo in notification template (#14108) 2024-08-02 11:03:11 +02:00
dependabot[bot] 83963b9e61 chore: bump github.com/moby/moby from 26.1.0+incompatible to 27.1.1+incompatible (#14042)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-02 10:24:45 +03:00
dependabot[bot] 1d9162dc2f chore: bump google.golang.org/api from 0.188.0 to 0.190.0 (#14107)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-02 09:53:57 +03:00
Muhammad Atif Ali 894020db6a chore: skip dogfood workflow for dependabot PRs (#14106) 2024-08-02 09:39:57 +03:00
dependabot[bot] 78f1cdaebe chore: bump github.com/fergusstrange/embedded-postgres from 1.27.0 to 1.28.0 (#14043)
* chore: bump github.com/fergusstrange/embedded-postgres

Bumps [github.com/fergusstrange/embedded-postgres](https://github.com/fergusstrange/embedded-postgres) from 1.27.0 to 1.28.0.
- [Release notes](https://github.com/fergusstrange/embedded-postgres/releases)
- [Commits](https://github.com/fergusstrange/embedded-postgres/compare/v1.27.0...v1.28.0)

---
updated-dependencies:
- dependency-name: github.com/fergusstrange/embedded-postgres
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-02 09:28:34 +03:00
Kayla Washburn-Love 7125b37545 feat(site): allow selecting an organization when creating a template (#14061) 2024-08-01 18:04:21 -06:00
Steven Masley a27ac30e11 chore: add sql filter to fetching audit logs (#14070)
* chore: add sql filter to fetching audit logs
* use sqlc.embed for audit logs
* fix sql query matcher
2024-08-01 12:07:19 -05:00
dependabot[bot] d23670ad53 chore: bump github.com/open-policy-agent/opa from 0.58.0 to 0.67.0 (#14040)
* chore: bump github.com/open-policy-agent/opa from 0.58.0 to 0.67.0

Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 0.58.0 to 0.67.0.
- [Release notes](https://github.com/open-policy-agent/opa/releases)
- [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-policy-agent/opa/compare/v0.58.0...v0.67.0)

---
updated-dependencies:
- dependency-name: github.com/open-policy-agent/opa
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
2024-08-01 19:41:44 +03:00
Alex Ivanov 6d3f7fb2a2 chore: update meticulous CI job (#14073) 2024-08-01 12:26:44 -04:00
Muhammad Atif Ali b0eaf4ca94 chore: commit update-flake as @dependabot (#14091)
Thıs is needed to bypass the dependency check job for dependabot PRs.

https://github.com/coder/coder/blob/1289937eaeac63f27f2856a4374a0fedc5cc0e58/.github/workflows/ci.yaml#L973

The username and email are fetched from a previous  dependabot commit. 
https://github.com/coder/coder/commit/1289937eaeac63f27f2856a4374a0fedc5cc0e58.patch
2024-08-01 19:24:51 +03:00
dependabot[bot] a88e1cc5f8 chore: bump github.com/go-chi/httprate from 0.9.0 to 0.12.0 (#14039)
* chore: bump github.com/go-chi/httprate from 0.9.0 to 0.12.0

Bumps [github.com/go-chi/httprate](https://github.com/go-chi/httprate) from 0.9.0 to 0.12.0.
- [Release notes](https://github.com/go-chi/httprate/releases)
- [Commits](https://github.com/go-chi/httprate/compare/v0.9.0...v0.12.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>

* [dependabot skip] Update Nix Flake SRI Hash

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
2024-08-01 19:22:23 +03:00
dependabot[bot] 1289937eae chore: bump alpine from 3.20.1 to 3.20.2 in /scripts (#14037)
Bumps alpine from 3.20.1 to 3.20.2.

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-01 18:57:37 +03:00
Ethan 956d0cb042 fix: block creating oidc users when oidc has not been configured (#14064) 2024-08-01 13:30:10 +10:00
Muhammad Atif Ali 7a4737cf76 ci: handle retriggering ci and human authors in update-flake (#14052)
Co-authored-by: Dean Sheather <dean@deansheather.com>
2024-07-31 16:12:40 +00:00
Kyle Carberry 5d42f4aa7b fix: run update-flake with PAT to allow workflow runs (#14067)
See the comment in the code.
2024-07-31 11:43:43 -04:00
Danny Kopping c3390993dd chore: update generated files after pnpm upgrade (#14036) 2024-07-31 17:23:55 +02:00
Kayla Washburn-Love bf4b7abf14 chore(coderd): allow creating workspaces without specifying an organization (#14048) 2024-07-30 10:44:02 -06:00
Kayla Washburn-Love 56dfc64bb0 fix: don't highlight inactive org in management settings sidebar (#14059) 2024-07-30 09:33:22 -06:00
Marcin Tojek cf1fcab514 feat: notify about created user account (#14010) 2024-07-30 15:37:45 +02:00
Cian Johnston c6fb779c50 chore(scaletest): update dashboard (#14054) 2024-07-30 10:47:13 +01:00
dependabot[bot] c88ea26d7c ci: bump crate-ci/typos from 1.23.2 to 1.23.5 in the github-actions group (#14038)
Bumps the github-actions group with 1 update: [crate-ci/typos](https://github.com/crate-ci/typos).


Updates `crate-ci/typos` from 1.23.2 to 1.23.5
- [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.23.2...v1.23.5)

---
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>
2024-07-30 11:07:30 +03:00
Kyle Carberry 893169c83b fix: duplicate tags map in mutation to resolve race (#14047)
* fix: duplicate tags map in mutation to resolve race

See: https://github.com/coder/coder/actions/runs/10149619748/job/28064952716?pr=14046

* Fix deployment values race
2024-07-30 07:37:13 +00:00
Steven Masley 3209c863b8 chore: authz 'any_org' to return if at least 1 org has perms (#14009)
* chore: authz 'any_org' to return if at least 1 org has perms

Allows checking if a user can do an action in any organization,
rather than a specific one. Allows asking general questions on the
UI to determine which elements to show.

* more strict, add comments to policy
* add unit tests and extend to /authcheck api
* make field optional
2024-07-29 19:58:48 -05:00
Kyle Carberry b7102b39af chore: add script to update flake automatically (#14046) 2024-07-29 14:29:22 -04:00
Bruno Quaresma 58b810fb0a fix: fix dormancy notifications (#14029) 2024-07-29 11:20:04 -03:00
dependabot[bot] 22143d3e80 chore: bump github.com/gohugoio/hugo from 0.128.2 to 0.129.0 (#13966)
Bumps [github.com/gohugoio/hugo](https://github.com/gohugoio/hugo) from 0.128.2 to 0.129.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.128.2...v0.129.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>
2024-07-27 13:49:05 +00:00
dependabot[bot] f88a48df26 chore: bump github.com/zclconf/go-cty from 1.14.4 to 1.15.0 (#13967)
Bumps [github.com/zclconf/go-cty](https://github.com/zclconf/go-cty) from 1.14.4 to 1.15.0.
- [Release notes](https://github.com/zclconf/go-cty/releases)
- [Changelog](https://github.com/zclconf/go-cty/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zclconf/go-cty/compare/v1.14.4...v1.15.0)

---
updated-dependencies:
- dependency-name: github.com/zclconf/go-cty
  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-07-27 16:43:54 +03:00
Asher 712662d014 chore: embed audit log in deployment settings page (#14023)
* Move audit page to /deployment/audit

The existing link remains but will redirect to the new URL.
If multi-org is not enabled, nothing changes.

* Redirect organization audit page to site-wide audit page

* Always wrap audit log filters when in deployment settings

Otherwise the input is teeny tiny and barely fits a few characters.
Normally we only wrap when the screen shrinks.  Again, no change
if multi-org is not enabled.

This also makes the filter menus take up available space when
wrapping (*does* apply to non-multi-org setups as well).

* Show audit log details in a tooltip

If multi-org is not enabled, details continue to be shown inline.
2024-07-26 14:12:24 -08:00
Charlie Voiselle eacdfb9f9c fix: change time format string from 15:40 to 15:04 (#14033)
* Change string format to constant value
2024-07-26 17:57:47 -04:00
Asher d8ddce8628 chore: use latest code-server in examples (#14030)
Instead, leave a comment describing how to pin the version.  This negates
the need to continually update the version in the examples.
2024-07-26 21:53:17 +00:00
Kayla Washburn-Love d68340b125 feat: manage groups from deployment settings for single-org deployments (#14016) 2024-07-26 13:10:13 -06:00
Cian Johnston 68fa34feae ci: remove ci make concurrency to fix docker image race (#14027)
This PR removes the `-j` argument to `make` when building and pushing Docker images on merge to main.
Seen here: https://github.com/coder/coder/actions/runs/10108431095/job/27954323032#step:9:119
We ran into this previously in #13769 for the release workflow, but neglected to apply the same change to the CI workflow.
2024-07-26 10:53:18 +01:00
Cian Johnston 37a859f071 chore(testutil): add testutil.GetRandomName that does not return duplicates (#14020)
Fixes #13910

Adds testutil.GetRandomName that replaces namesgenerator.GetRandomName but instead appends a monotonically increasing integer instead of a number between 1 and 10.
2024-07-26 09:44:34 +01:00
Steven Masley 96011e1b29 fix: handle legacy licenses missing feature_set field (#14025)
* fix: legacy licenses missing feature_set field
2024-07-25 22:43:08 -05:00
Raul Salamanca 5b35f65305 docs: add proxmox coder template in list of community templates (#14022) 2024-07-26 06:05:49 +03:00
Michael Brewer ce6ee9c6c6 feat(site): add jetbrains fleet icon (#14021) 2024-07-26 06:05:08 +03:00
Garrett Delfosse 6c2336b8e9 chore: shorten provisioner key (#14017) 2024-07-25 16:08:12 -05:00
Steven Masley 7ea1a4c686 chore: protect organization endpoints with license (#14001)
* chore: move multi-org endpoints into enterprise directory

All multi-organization features are gated behind "premium" licenses. Enterprise licenses can no longer
access organization CRUD.
2024-07-25 16:07:53 -05:00
Steven Masley 915f69080a chore: fix csrf error message on empty session header (#14018)
* chore: fix csrf error message on empty session header

A more detailed error message was added to catch mismatched
session tokens. This error was mistakenly applying to all CSRF
failures.
2024-07-25 15:58:23 -05:00
Garrett Delfosse 2279441517 feat: add --key flag to provisionerd start (#14002) 2024-07-25 15:26:26 -04:00
Steven Masley c082868f55 chore: indicate premium vs enterprise on license page (#14008)
* chore: indicate premium vs enterprise on license page

Premium licenses should say "premium" instead of "enterprise"
2024-07-25 14:04:32 -05:00
Michael Smith 9f3c1c7367 fix: resolve text overflow issues for workspace empty state (#14015) 2024-07-25 18:19:57 +00:00
Kira Pilot 4eb67ad98a Revert "feat: implement multi-org template gallery (#13784)" (#14013)
This reverts commit 554c4ab1eb.
2024-07-25 13:09:04 -04:00
Kayla Washburn-Love 615bb94ec4 feat(site): embed users page in management settings (#14006) 2024-07-25 10:50:07 -06:00
Garrett Delfosse 6161d173d3 feat: add tags to provisioner keys api (#13989) 2024-07-25 15:20:45 +00:00
Garrett Delfosse ca83017dc1 feat: accept provisioner keys for provisioner auth (#13972) 2024-07-25 10:22:55 -04:00
Marcin Tojek d488853393 fix: notifications: use username in workspace URLs (#14011) 2024-07-25 12:02:24 +02:00
Muhammad Atif Ali 88bc491778 chore: add stable version info to repository-dispatch event (#13997)
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-07-25 11:03:01 +03:00
Asher e8b3db8c7a feat: add organizations filter to audit table (#13978)
* Ignore organization ID in member and role audit logs

Since the organization will never change in any resources, 
and the org is already on the top-level of the response. 

* Add organization details and filter to audit table

These only display if the multi-org experiment is enabled.

This also includes a modification to customize the width 
of the filters since with four things get a bit squishy.

* Add more audit mocks

To test different org names and no org.
2024-07-24 14:28:23 -08:00
Steven Masley 4f01372179 feat: implement disabling oidc issuer checks (#13991)
* use DANGEROUS prefix and drop a warning log
2024-07-24 16:45:47 -05:00
Muhammad Atif Ali 652827f0e8 docs: add preview image to release schedule (#13948) 2024-07-24 23:20:52 +03:00
Kayla Washburn-Love 38b573857b feat(site): edit organization member roles (#13977) 2024-07-24 11:36:45 -06:00
Steven Masley 15fda232b7 feat: implement premium vs enterprise licenses (#13907)
* feat: implement premium vs enterprise licenses

Implement different sets of licensed features.
2024-07-24 12:07:59 -05:00
Bruno Quaresma 0d9615b4fd feat(coderd): notify when workspace is marked as dormant (#13868) 2024-07-24 13:38:21 -03:00
Garrett Delfosse ccb5b4df80 chore: move provisioner keys commands into slim build (#13993) 2024-07-24 11:30:50 -04:00
Marcin Tojek b3a3671c6a fix: use static port number for prometheus test (#14000) 2024-07-24 12:54:36 +00:00
Marcin Tojek dac14fe581 test: skip TestProvisionerDaemon_PrometheusEnabled (#13996) 2024-07-24 09:28:53 +02:00
Ethan 7028ff79c3 feat(codersdk): export template variable parser (#13984) 2024-07-24 14:11:29 +10:00
Stephen Kirby 177c7d3c68 updated version for patches 2.12.5 and 2.13.2 (#13995) 2024-07-23 15:36:14 -05:00
Kayla Washburn-Love 0d453437de fix(site): select default organization on /organizations page (#13992) 2024-07-23 12:35:38 -06:00
Steven Masley a61c09e4dc fix: use correct group url in multi-org experiment (#13986)
* fix: use correct group url in multi-org experiment

When not using the experiment, default to the "default" org.
Assuming groups are all in the primary org

---------

Co-authored-by: McKayla Washburn <mckayla@hey.com>
2024-07-23 13:17:21 -05:00
Jon Ayers 3a614f1602 fix: random typos in offline docs documentation (#13979) 2024-07-23 11:48:58 -05:00
Steven Masley ecc356f5a9 chore: generate rbac resource types to typescript (#13975)
* chore: generate rbac resource types to typescript

The existing typesGenerated.ts cannot support this as the generator
only inspects the types, not the values. So traversing the value AST
would have to be added. The rbac gen is already used for the sdk,
this extends it to the typescript
2024-07-23 10:07:52 -05:00
Danny Kopping b817c863ef fix: webhook endpoint YAML attribute (#13983)
Signed-off-by: Danny Kopping <danny@coder.com>
2024-07-23 14:59:27 +00:00
Garrett Delfosse 0a07c7e554 feat: get org scoped provisioners (#13953) 2024-07-23 14:56:46 +00:00
Danny Kopping 695afb80e6 fix: address TestPendingUpdatesMetric flake 2024-07-23 14:39:57 +00:00
Marcin Tojek 966c888e9d fix: test: no parallel when starting Prometheus endpoint (#13981)
* fix: test: no parallel when starting Prometheus endpoint

* fix
2024-07-23 11:31:27 +01:00
Mathias Fredriksson 5a4dbcfc02 chore(scripts): fix cherry-pick check in check_commit_metadata.sh (#13980) 2024-07-23 06:49:29 +00:00
Asher a8e6e89f65 feat: add organization details to audit log response (#13961)
* Allow creating test audits with nil org

Not all audit entries have organization IDs, so this will allow us to
test those cases.

* Add organization details to audit log queries

* Add organization to audit log response

This replaces the old ID.  This is a breaking change but organizations
were not being used before.
2024-07-22 13:28:44 -08:00
Dean Sheather 38c7dcda94 fix: avoid vscodessh exit when server restarts (#13970)
Mitigates an issue where vscodessh would restart when the control plane
restarts, causing the entire SSH session to be reestablished.
2024-07-22 17:19:44 +00:00
Dean Sheather d2b035312e chore: fix parse typo for network telemetry (#13971) 2024-07-22 17:14:37 +00:00
Kayla Washburn-Love 0a71c34d46 feat: create and modify organization groups (#13887) 2024-07-22 09:47:14 -06:00
Steven Masley dd99457a04 chore: although unfortunate, it is possible for a user to be in no orgs (#13956) 2024-07-22 10:39:50 -05:00
Cian Johnston 005254d64a chore(examples): update sample devcontainer templates (#13796)
Updates docker and kubernetes devcontainer templates

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2024-07-22 14:10:02 +01:00
Stephen Kirby 3c2c5ab7fc chore(docs): add missing author to support bundle guide (#13918)
* fixed missing author

* make fmt

Signed-off-by: Cian Johnston <cian@coder.com>

---------

Signed-off-by: Cian Johnston <cian@coder.com>
Co-authored-by: Cian Johnston <cian@coder.com>
2024-07-22 09:09:31 +01:00
Nano 40b70dbdb0 docs: update caddy config example & guide (#13964) 2024-07-22 10:47:41 +03:00
Muhammad Atif Ali 88d2dbd994 docs: replace coder_git_auth with coder_external_auth (#13936) 2024-07-20 07:43:09 +03:00
Steven Masley 03c5d42233 chore: keep active users active in scim (#13955)
* chore: scim should keep active users active
* chore: add a unit test to excercise dormancy bug
* audit log should not be dropped when there is no change
* add ability to cancel audit log
2024-07-19 16:30:02 -05:00
Steven Masley 49d6d0f41b chore: add built in organization roles to match site (#13938)
* chore: add built in organization roles to match site

Added org user admin, org template admin, and org auditor
2024-07-19 15:44:18 -05:00
Muhammad Atif Ali 8beb0b131f chore: update flake.nix to handle aarch64 linux (#13930) 2024-07-19 22:15:50 +03:00
Stephen Kirby bac9b38e05 autoversion 2.12.4 and 2.13.1 (#13951) 2024-07-19 13:26:13 -05:00
Alex Ivanov dba23872eb chore: only add Meticulous recorder when running in dev mode (#13950) 2024-07-19 12:47:38 -05:00
Jaayden Halko 554c4ab1eb feat: implement multi-org template gallery (#13784)
* feat: initial changes for multi-org templates page

* feat: add TemplateCard component

* feat: add component stories

* chore: update template query naming

* fix: fix formatting

* feat: template card interaction and navigation

* fix: copy updates

* chore: update TemplateFilter type to include FilterQuery

* chore: update typesGenerated.ts

* feat: update template filter api logic

* fix: fix format

* fix: get activeOrg

* fix: add format annotation

* chore: use organization display name

* feat: client side org filtering

* fix: use org display name

* fix: add ExactName

* feat: show orgs filter only if more than 1 org

* chore: updates for PR review

* fix: fix format

* chore: add story for multi org

* fix: aggregate templates by organization id

* fix: fix format

* fix: check org count

* fix: update ExactName type
2024-07-19 10:33:08 -04:00
Marcin Tojek 40609c26e9 fix: test: do not block Prometheus port (#13945) 2024-07-19 16:29:10 +02:00
Danny Kopping c88e4162d8 fix: TestPendingUpdatesMetric flake (#13944)
Signed-off-by: Danny Kopping <danny@coder.com>
2024-07-19 12:54:15 +02:00
Danny Kopping 492ab1cc7e chore: add webhook tests for notification subsystem (#13942) 2024-07-19 12:03:29 +02:00
Danny Kopping 943ea7c52a feat: add SMTP auth & TLS support (#13902) 2024-07-19 09:22:15 +02:00
Jon Ayers 8d4bccc612 feat: add meticulous recorder (#13886) 2024-07-18 20:15:07 -05:00
Kayla Washburn-Love 4dcbd7179f fix: hardcode default organization id in DashboardProvider (#13940) 2024-07-18 16:55:38 -06:00
Steven Masley aa6e6e3d58 chore: implement fetch all organizations endpoint (#13941)
* chore: implement fetch all organizations endpoint
* update ui to use list all orgs
2024-07-18 17:28:36 -05:00
Garrett Delfosse 6f20a64f9d chore: add multi-org flag to develop.sh (#13923) 2024-07-18 14:43:07 -05:00
Garrett Delfosse f975701b34 feat: add provisioner key cli commands (#13875) 2024-07-18 14:44:20 -04:00
Marcin Tojek 91cbe679c0 chore: move notiffake to testutil (#13933) 2024-07-18 13:36:02 +00:00
Marcin Tojek fbd1d7f9a7 feat: notify on successful autoupdate (#13903) 2024-07-18 15:19:12 +02:00
Steven Masley 44924cd8d8 chore: add updated_at to codersdk users (#13928)
* chore: add updated_at to codersdk users
2024-07-17 17:59:42 -05:00
Kyle Carberry 3e1fae7d3d chore: add Star the Repo to support links (#13924) 2024-07-17 15:39:03 -04:00
Kayla Washburn-Love 80cbffe843 chore: remove organizationIds from AuthProvider (#13917) 2024-07-17 09:53:40 -06:00
Spike Curtis f21f2dce57 fix: fix heartbeat select to prevent leak (#13909)
fixes #13816
2024-07-16 23:38:07 +04:00
Spike Curtis 70c5c47efd fix: stop blocking fake Agent API channel writes after context expires (#13908) 2024-07-16 23:22:13 +04:00
Spike Curtis 1f24aceea2 fix: change audit descriptions to indicate unsuccessful attempts (#13897) 2024-07-16 22:47:32 +04:00
Kayla Washburn-Love a3f40d5ef8 feat: add members settings page for organizations (#13817) 2024-07-16 12:25:36 -06:00
Garrett Delfosse b697c6939a chore: add provisioner key crud apis (#13857) 2024-07-16 13:27:12 -04:00
Marcin Tojek a5e4bf38fe feat: notify owner about failed autobuild (#13891) 2024-07-16 10:48:17 +02:00
Cian Johnston 36454aa81b fix(dogfood/Dockerfile): create /etc/suoders.d/nopasswd instead of COPY (#13900) 2024-07-15 23:19:23 +01:00
Muhammad Atif Ali ab59460e2c chore: bump terraform to v1.9.2 (#13899) 2024-07-15 21:25:42 +00:00
Cian Johnston 17626b8dd1 Revert "fix(dogfood/Dockerfile): change ownership of /etc/sudoers.d to root (#13793)" (#13898)
This reverts commit da8911426b.
2024-07-15 21:08:48 +00:00
Colin Adler 7a34a70cb8 chore: upgrade terraform to 1.9.2 (#13895) 2024-07-15 13:27:08 -05:00
dependabot[bot] d6e2801478 chore: bump github.com/adrg/xdg from 0.4.0 to 0.5.0 (#13892)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-15 19:26:25 +03:00
dependabot[bot] 0a73ae1036 chore: bump google.golang.org/api from 0.187.0 to 0.188.0 (#13894)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-15 19:25:57 +03:00
dependabot[bot] 6058bcdad8 chore: bump cloud.google.com/go/compute/metadata from 0.4.0 to 0.5.0 (#13893)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-15 18:51:55 +03:00
dependabot[bot] bece042fa8 chore: bump @testing-library/jest-dom from 6.1.2 to 6.4.6 in /site (#13732)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.1.2 to 6.4.6.
- [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/v6.1.2...v6.4.6)

---
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>
2024-07-15 09:41:57 -06:00
dependabot[bot] aaf295badf ci: bump the github-actions group with 2 updates (#13890)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-15 15:56:12 +03:00
dependabot[bot] b00f746cac chore: bump monaco-editor from 0.44.0 to 0.50.0 in /site (#13835)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-07-14 15:48:29 +03:00
Steven Masley 9cbe2b27e7 chore: create workspaces and templates for multiple orgs (#13866)
* chore: creating workspaces and templates to work with orgs
* handle wrong org selected
* create org member in coderdtest helper
2024-07-12 15:47:28 -05:00
Steven Masley e4aef272fa chore: add example prompt command for multiple prompt bug (#13885)
Prompt message is not erased after the prompt ends
2024-07-12 11:59:13 -05:00
Steven Masley c6b7588933 chore: add organization id to provisioner sdk type (#13883)
* chore: add organization id to provisioner sdk type
2024-07-12 10:56:34 -05:00
Danny Kopping 1691768fb9 chore: use store enqueuer with external provisioners (#13881) 2024-07-12 13:51:13 +02:00
Kayla Washburn-Love de2585b0b6 chore: use rw.WriteHeader to write responses without bodies (#13870) 2024-07-11 13:38:33 -06:00
Mathias Fredriksson fd10ea1dcc chore(scripts): add script to update list of experiments after release (#13872)
Fixes #13119
2024-07-11 21:45:50 +03:00
Steven Masley 687d9538de chore: provisioner acquirer to respect organization ID of jobs (#13874)
* test: add unit test to verify creation of templates in multiple orgs
* chore: provisioner acquirer to respect organization ID of jobs

Prior to this the wrong provisioner was awakened on any new job
posting.

* add comment and stricter check
2024-07-11 11:26:47 -05:00
Marcin Tojek bee913ac45 feat(cli): pause notifications (#13873) 2024-07-11 15:22:20 +02:00
Ethan f36b816391 chore: add coder version to network telemetry events (#13871) 2024-07-11 20:46:37 +10:00
Danny Kopping b2dab3308d feat: implement observability of notifications subsystem (#13799) 2024-07-11 10:57:49 +02:00
Colin Adler a6d66cc7ec chore: ensure correct version of golangci-lint is run in ci (#13869) 2024-07-10 14:50:38 -05:00
Eric Paulsen 90a6025e18 fix-sa-docs (#13724) 2024-07-10 18:40:45 +00:00
Muhammad Atif Ali 0787de88a9 chore: update documentation links to the new format (#13797) 2024-07-10 21:31:37 +03:00
Eric Paulsen 2a297b073a docs: fix vs code web module reference (#13785) 2024-07-10 21:29:40 +03:00
Colin Adler 2238593f57 chore: update pnpm to v9 (#13843)
* chore: update pnpm to v9

* pin golangci-lint and shfmt
2024-07-10 13:13:19 -05:00
Steven Masley a588ec5b21 chore: assign user to multiple orgs in coderdtest user create (#13867)
* chore: coderdtest assign user to multiple orgs on create
2024-07-10 12:38:48 -05:00
Steven Masley 7bb3e0db4a chore: return organization's display name and icon in templates (#13858)
* chore: templates return organization display name and icon
* templates api response includes organization display name and icon
2024-07-10 10:06:49 -05:00
Marcin Tojek bf392ffea4 feat: add killswitch for notifications (#13794) 2024-07-10 16:15:06 +02:00
Danny Kopping 542fff7df0 chore: improve notifications tests (#13863) 2024-07-10 15:25:23 +02:00
Mathias Fredriksson c8484b4fc8 fix(cli): follow logs only when agent is starting (#13864) 2024-07-10 15:39:43 +03:00
Marcin Tojek 70046ea08d fix: missing nolint comment (#13862) 2024-07-10 09:55:30 +00:00
Ethan e8db21c89e chore: add additional network telemetry stats & events (#13800) 2024-07-10 14:14:35 +10:00
dependabot[bot] 38035da846 chore: bump github.com/google/nftables (#13859) 2024-07-09 19:02:16 -04:00
Jon Ayers 464e7979c4 docs: remove mention of built-in remote desktop on the roadmap (#13459) 2024-07-09 16:29:44 -05:00
dependabot[bot] e00a80e029 chore: bump github.com/gofrs/flock from 0.8.1 to 0.12.0 (#13782)
Bumps [github.com/gofrs/flock](https://github.com/gofrs/flock) from 0.8.1 to 0.12.0.
- [Release notes](https://github.com/gofrs/flock/releases)
- [Commits](https://github.com/gofrs/flock/compare/v0.8.1...v0.12.0)

---
updated-dependencies:
- dependency-name: github.com/gofrs/flock
  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-07-09 21:16:05 +00:00
dependabot[bot] d4f0a22ac6 chore: bump axios from 1.6.0 to 1.7.2 in /site (#13697)
Bumps [axios](https://github.com/axios/axios) from 1.6.0 to 1.7.2.
- [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.6.0...v1.7.2)

---
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>
2024-07-09 21:14:16 +00:00
dependabot[bot] f6cd002542 chore: bump yup from 1.3.2 to 1.4.0 in /site (#13715)
Bumps [yup](https://github.com/jquense/yup) from 1.3.2 to 1.4.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/v1.3.2...v1.4.0)

---
updated-dependencies:
- dependency-name: yup
  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-07-09 21:12:56 +00:00
dependabot[bot] d209c5ff99 chore: bump github.com/bramvdbogaerde/go-scp from 1.4.0 to 1.5.0 (#13806)
Bumps [github.com/bramvdbogaerde/go-scp](https://github.com/bramvdbogaerde/go-scp) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/bramvdbogaerde/go-scp/releases)
- [Commits](https://github.com/bramvdbogaerde/go-scp/compare/v1.4.0...v1.5.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-07-09 21:10:55 +00:00
dependabot[bot] 7574a2d3ab chore: bump github.com/gohugoio/hugo from 0.126.1 to 0.128.2 (#13811)
Bumps [github.com/gohugoio/hugo](https://github.com/gohugoio/hugo) from 0.126.1 to 0.128.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.126.1...v0.128.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>
2024-07-09 16:04:51 -05:00
dependabot[bot] de1da93d04 chore: bump github.com/bgentry/speakeasy (#13729)
Bumps [github.com/bgentry/speakeasy](https://github.com/bgentry/speakeasy) from 0.1.1-0.20220910012023-760eaf8b6816 to 0.2.0.
- [Release notes](https://github.com/bgentry/speakeasy/releases)
- [Commits](https://github.com/bgentry/speakeasy/commits/v0.2.0)

---
updated-dependencies:
- dependency-name: github.com/bgentry/speakeasy
  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-07-09 16:59:06 -04:00
dependabot[bot] 03a8cc7d4e chore: bump cloud.google.com/go/compute/metadata from 0.3.0 to 0.4.0 (#13808)
Bumps [cloud.google.com/go/compute/metadata](https://github.com/googleapis/google-cloud-go) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/compute/metadata
  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-07-09 14:35:30 -05:00
Colin Adler d50ffa78f6 fix: exit reset password request before passwords are compared (#13856) 2024-07-09 14:28:39 -05:00
dependabot[bot] 3894ae17a7 chore: bump the mui group across 1 directory with 5 updates (#13829)
Bumps the mui group with 5 updates in the /site directory:

| Package | From | To |
| --- | --- | --- |
| [@mui/icons-material](https://github.com/mui/material-ui/tree/HEAD/packages/mui-icons-material) | `5.15.20` | `5.16.0` |
| [@mui/material](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material) | `5.15.21` | `5.16.0` |
| [@mui/system](https://github.com/mui/material-ui/tree/HEAD/packages/mui-system) | `5.15.20` | `5.16.0` |
| [@mui/utils](https://github.com/mui/material-ui/tree/HEAD/packages/mui-utils) | `5.15.20` | `5.16.0` |
| [@mui/x-tree-view](https://github.com/mui/mui-x/tree/HEAD/packages/x-tree-view) | `7.8.0` | `7.9.0` |



Updates `@mui/icons-material` from 5.15.20 to 5.16.0
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/v5.16.0/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.16.0/packages/mui-icons-material)

Updates `@mui/material` from 5.15.21 to 5.16.0
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/v5.16.0/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.16.0/packages/mui-material)

Updates `@mui/system` from 5.15.20 to 5.16.0
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/v5.16.0/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.16.0/packages/mui-system)

Updates `@mui/utils` from 5.15.20 to 5.16.0
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/v5.16.0/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.16.0/packages/mui-utils)

Updates `@mui/x-tree-view` from 7.8.0 to 7.9.0
- [Release notes](https://github.com/mui/mui-x/releases)
- [Changelog](https://github.com/mui/mui-x/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mui/mui-x/commits/v7.9.0/packages/x-tree-view)

---
updated-dependencies:
- dependency-name: "@mui/icons-material"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: mui
- dependency-name: "@mui/material"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: mui
- dependency-name: "@mui/system"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: mui
- dependency-name: "@mui/utils"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: mui
- dependency-name: "@mui/x-tree-view"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: mui
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-09 11:12:42 -08:00
Mathias Fredriksson 35a808f089 fix(coderd/agentapi): set ReadyAt for start timeout (#13846) 2024-07-09 18:55:16 +00:00
Jyotirmoy Bandyopadhayaya b07e3069dd feat: added whomai cmd to coder cli (#13814)
* feat: added whomai cmd to coder cli
* refactor: update Coder CLI's whoami command to use client URL instead of deployment config
* feat(cli): add unit tests for the whoami command
* chore(docs): add coder command to fetch authenticated user info
* chore(doc): update help desc
2024-07-09 13:23:11 -05:00
Bruno Quaresma 01b30eaa32 fix(site): enable dormant workspace to be deleted (#13850) 2024-07-09 14:55:46 -03:00
Colin Adler af001773db fix!: remove TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA cipher by default (#13837)
This cipher is included by default in Go as a fallback, but is marked as
an insecure cipher. This removes the 3des cipher by default.

Before:
```
$ nmap --script ssl-enum-ciphers -p 443 xxxxxxx
Starting Nmap 7.94 ( https://nmap.org ) at 2024-07-08 14:16 CDT
Nmap scan report for xxxxx (xxx.xxx.xxx.xxx)
Host is up (0.038s latency).
rDNS record for xxx.xxx.xxx.xxx: xxx.xxx.xxx.xxx.bc.googleusercontent.com

PORT    STATE SERVICE
443/tcp open  https
| ssl-enum-ciphers:
|   TLSv1.2:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA (secp256r1) - C
|     compressors:
|       NULL
|     cipher preference: server
|     warnings:
|       64-bit block cipher 3DES vulnerable to SWEET32 attack
|   TLSv1.3:
|     ciphers:
|       TLS_AKE_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A
|       TLS_AKE_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A
|       TLS_AKE_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A
|     cipher preference: server
|_  least strength: C
```

After:
```
$ nmap --script ssl-enum-ciphers -p 443 xxxxxxx
Starting Nmap 7.94 ( https://nmap.org ) at 2024-07-08 15:04 CDT
Nmap scan report for xxxxx (xxx.xxx.xxx.xxx)
Host is up (0.039s latency).
rDNS record for xxx.xxx.xxx.xxx: xxx.xxx.xxx.xxx.bc.googleusercontent.com

PORT    STATE SERVICE
443/tcp open  https
| ssl-enum-ciphers:
|   TLSv1.2:
|     ciphers:
|       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (secp256r1) - A
|       TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (secp256r1) - A
|     compressors:
|       NULL
|     cipher preference: client
|   TLSv1.3:
|     ciphers:
|       TLS_AKE_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A
|       TLS_AKE_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A
|       TLS_AKE_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A
|     cipher preference: server
|_  least strength: A
```

* fixup! fix!(cli): remove `TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA` cipher by default

* fixup! fix!(cli): remove `TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA` cipher by default
2024-07-09 17:18:27 +00:00
Bruno Quaresma 879c61ce23 feat(site): display tooltip in bars for app usage chart (#13854) 2024-07-09 14:02:45 -03:00
Bruno Quaresma 6bf7e5af91 feat(site): support match option for auto create workspace flow (#13836) 2024-07-09 16:14:08 +00:00
Steven Masley 8c33b028d2 chore: include all templates in cli template list (#13841)
* chore: cli template list includes all templates

Shows all accessible templates from all organizations
2024-07-09 11:04:16 -05:00
Steven Masley f9272046d5 chore: remove references to restarting/stopping in update workspace language (#13852)
* chore: remove references to restarting/stopping in update workspace language
* reword updating workspaces to remove the word "restart"
* fix batch wording
2024-07-09 11:02:13 -05:00
Eric Paulsen 266913a357 fix: remove templates plan docs (#13824)
* fix: remove templates plan docs

* make gen

* make update-golden-files
2024-07-09 14:27:34 +00:00
Muhammad Atif Ali c62512a8bb chore: use base64 encoded kubeconfig for pr deployments (#13851) 2024-07-09 14:24:43 +00:00
Muhammad Atif Ali a123badccc chore: use base64 encoded kubeconfig for pr deployments (#13849) 2024-07-09 13:44:59 +00:00
Marcin Tojek 54898033b1 fix: dbpurge: disable parallel tests (#13848) 2024-07-09 15:10:57 +02:00
dependabot[bot] c1440ac4f0 chore: bump github.com/coreos/go-oidc/v3 from 3.10.0 to 3.11.0 (#13827)
Bumps [github.com/coreos/go-oidc/v3](https://github.com/coreos/go-oidc) from 3.10.0 to 3.11.0.
- [Release notes](https://github.com/coreos/go-oidc/releases)
- [Commits](https://github.com/coreos/go-oidc/compare/v3.10.0...v3.11.0)

---
updated-dependencies:
- dependency-name: github.com/coreos/go-oidc/v3
  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-07-09 13:09:04 +00:00
dependabot[bot] 65e1d0af4b ci: bump crate-ci/typos from 1.22.9 to 1.23.1 in the github-actions group (#13803)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2024-07-09 15:45:09 +03:00
Mathias Fredriksson ac6db5edf9 feat(cli): show information about --wait=no for ssh (#13847)
Fixes #11923
2024-07-09 14:32:52 +03:00
Mathias Fredriksson 54055dc4cc fix(cli): prevent asynchronous print of version mismatch in config-ssh (#13845) 2024-07-09 14:32:08 +03:00
dependabot[bot] 407d263cd2 chore: bump google.golang.org/api from 0.182.0 to 0.187.0 (#13828)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-09 07:59:58 +00:00
dependabot[bot] 0c423f07a7 chore: bump semver and @types/semver in /site (#13834)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-09 10:49:43 +03:00
Mathias Fredriksson 978364bd3e fix(cli): do not overwrite repeated SSH options in config-ssh (#13819)
Fixes #11593
2024-07-09 09:44:56 +03:00
dependabot[bot] 5cdfc08422 chore: bump google.golang.org/grpc from 1.64.0 to 1.65.0 (#13826)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.64.0 to 1.65.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.64.0...v1.65.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>
2024-07-09 06:25:53 +00:00
dependabot[bot] 1f05a4a05e chore: bump github.com/go-chi/chi/v5 from 5.0.10 to 5.1.0 (#13730)
Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.10 to 5.1.0.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v5.0.10...v5.1.0)

---
updated-dependencies:
- dependency-name: github.com/go-chi/chi/v5
  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-07-09 01:19:18 -05:00
dependabot[bot] 996863936a chore: bump the x group with 7 updates (#13825)
Bumps the x group with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [golang.org/x/crypto](https://github.com/golang/crypto) | `0.24.0` | `0.25.0` |
| [golang.org/x/mod](https://github.com/golang/mod) | `0.18.0` | `0.19.0` |
| [golang.org/x/net](https://github.com/golang/net) | `0.26.0` | `0.27.0` |
| [golang.org/x/oauth2](https://github.com/golang/oauth2) | `0.20.0` | `0.21.0` |
| [golang.org/x/sys](https://github.com/golang/sys) | `0.21.0` | `0.22.0` |
| [golang.org/x/term](https://github.com/golang/term) | `0.21.0` | `0.22.0` |
| [golang.org/x/tools](https://github.com/golang/tools) | `0.22.0` | `0.23.0` |


Updates `golang.org/x/crypto` from 0.24.0 to 0.25.0
- [Commits](https://github.com/golang/crypto/compare/v0.24.0...v0.25.0)

Updates `golang.org/x/mod` from 0.18.0 to 0.19.0
- [Commits](https://github.com/golang/mod/compare/v0.18.0...v0.19.0)

Updates `golang.org/x/net` from 0.26.0 to 0.27.0
- [Commits](https://github.com/golang/net/compare/v0.26.0...v0.27.0)

Updates `golang.org/x/oauth2` from 0.20.0 to 0.21.0
- [Commits](https://github.com/golang/oauth2/compare/v0.20.0...v0.21.0)

Updates `golang.org/x/sys` from 0.21.0 to 0.22.0
- [Commits](https://github.com/golang/sys/compare/v0.21.0...v0.22.0)

Updates `golang.org/x/term` from 0.21.0 to 0.22.0
- [Commits](https://github.com/golang/term/compare/v0.21.0...v0.22.0)

Updates `golang.org/x/tools` from 0.22.0 to 0.23.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.22.0...v0.23.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-09 01:13:37 -05:00
dependabot[bot] 3085c4cf5b chore: bump @types/lodash from 4.14.196 to 4.17.6 in /site (#13704)
Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.196 to 4.17.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

---
updated-dependencies:
- dependency-name: "@types/lodash"
  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>
2024-07-09 09:11:00 +03:00
dependabot[bot] 83a177e0c7 chore: bump ssh2 and @types/ssh2 in /site (#13710)
Bumps [ssh2](https://github.com/mscdex/ssh2) and [@types/ssh2](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ssh2). These dependencies needed to be updated together.

Updates `ssh2` from 1.14.0 to 1.15.0
- [Commits](https://github.com/mscdex/ssh2/compare/v1.14.0...v1.15.0)

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

---
updated-dependencies:
- dependency-name: ssh2
  dependency-type: direct:development
  update-type: version-update:semver-minor
- dependency-name: "@types/ssh2"
  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>
2024-07-09 09:10:28 +03:00
Colin Adler b40d543cb5 chore(offlinedocs): update braces to v3.0.3 (#13842) 2024-07-09 01:01:49 -05:00
dependabot[bot] eafa8f5cb2 chore: bump the vite group across 1 directory with 3 updates (#13833)
Bumps the vite group with 3 updates in the /site directory: [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react), [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) and [vite-plugin-checker](https://github.com/fi3ework/vite-plugin-checker).


Updates `@vitejs/plugin-react` from 4.1.0 to 4.3.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/v4.3.1/packages/plugin-react)

Updates `vite` from 4.5.3 to 5.3.3
- [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/v5.3.3/packages/vite)

Updates `vite-plugin-checker` from 0.6.0 to 0.7.1
- [Release notes](https://github.com/fi3ework/vite-plugin-checker/releases)
- [Changelog](https://github.com/fi3ework/vite-plugin-checker/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fi3ework/vite-plugin-checker/compare/vite-plugin-checker@0.6.0...vite-plugin-checker@0.7.1)

---
updated-dependencies:
- dependency-name: "@vitejs/plugin-react"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: vite
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: vite
- dependency-name: vite-plugin-checker
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: vite
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-08 18:25:19 -04:00
Muhammad Atif Ali 05fdb9c1f7 chore: group dependencies (#13798) 2024-07-08 23:11:44 +03:00
Stephen Kirby 79b5d20cd2 typo (#13823) 2024-07-08 15:08:56 -05:00
Colin Adler f9ca9c7a22 chore: upgrade Go to 1.22.5 (#13820)
* chore: upgrade Go to 1.22.5

* fixup! chore: upgrade Go to 1.22.5
2024-07-08 19:42:55 +00:00
Steven Masley 44cb400c8e chore: include host and port in oidc test logs (#13818)
* chore: include host and port in oidc test logs

Log fake IDP's log for debugging port conflicts between tests
2024-07-08 10:24:41 -05:00
Steven Masley d9bdef915d chore: fix typo in oidctest package (#13815) 2024-07-08 14:35:06 +00:00
Danny Kopping bdd2caf95d feat: implement thin vertical slice of system-generated notifications (#13537) 2024-07-08 15:38:50 +02:00
Marcin Tojek 10aa32ca08 chore: refactor AgentHasNotConnectedSinceWeek_LogsExpired (#13802) 2024-07-08 13:52:56 +02:00
Muhammad Atif Ali fecc5b3027 docs: update release schedule (#13795) 2024-07-06 12:17:11 +03:00
Cian Johnston da8911426b fix(dogfood/Dockerfile): change ownership of /etc/sudoers.d to root (#13793) 2024-07-05 12:42:14 +01:00
Marcin Tojek 7c41f957de feat: autostop workspaces owned by suspended users (#13790) 2024-07-04 13:35:41 +00:00
Cian Johnston c2d44d16a3 feat(codersdk/agentsdk): export LogDest interface (#13792)
Signed-off-by: Cian Johnston <cian@coder.com>
2024-07-04 14:04:43 +01:00
Ferran Basora dd80958efb chore: update troubleshooting documentation about dir setting (#13681) 2024-07-03 22:24:49 +03:00
Steven Masley ccf34901bc chore: add templates search query to a filter (#13772)
* chore: add templates search query to a filter
2024-07-03 13:42:23 -05:00
Cian Johnston 8778aa0f71 chore(deps): update go-playground/validator and remove replace directive (#13779)
We had a replace directive in place due to a PR we were waiting to have
merged in go-playground/validator. This was since merged in v10.22.0.

Signed-off-by: Cian Johnston <cian@coder.com>
2024-07-03 18:14:27 +01:00
Cian Johnston ea675897fd fix(dogfood/Dockerfile): revert add explicit --chown to COPY directive (#13569) (#13781)
* Revert "fix(dogfood/Dockerfile): add explicit --chown to COPY directive (#13569)"

This reverts commit c587af7c0e.

* add a bogus comment to ensure hashes change
2024-07-03 17:42:18 +01:00
Michael Smith 940afa1ab1 fix: let workspace pages download partial logs for unhealthy workspaces (#13761)
* fix: get basic fix in for  preventing download logs from blowing up UI

* fix: make sure blob units can't go out of bounds

* fix: make sure timeout is cleared on component unmount

* fix: reduce risk of shared cache state breaking useAgentLogs

* fix: allow partial downloading of logs

* fix: make sure useMemo cache is used properly

* wip: commit current progress on updated logs functionality

* docs: rewrite comment for clarity

* refactor: clean up current code

* fix: update styles for unavailable logs

* fix: resolve linter violations

* fix: update type signature of getErrorDetail

* fix: revert log/enabled logic for useAgentLogs

* fix: remove memoization from DownloadLogsDialog

* fix: update name of timeout state

* refactor: make log web sockets logic more clear

* docs: reword comment for clarity

* fix: commit current style update progress

* fix: finish style updates
2024-07-03 10:17:54 -04:00
Marcin Tojek 07d41716ad fix(provisioner): handle multiple agents, apps, scripts and envs (#13741) 2024-07-03 14:55:28 +02:00
Spike Curtis f6639b788f feat: add ConnectRPC variants for older Agent API versions (#13778) 2024-07-03 16:11:05 +04:00
Spike Curtis e5268e4551 chore: spin clock library out to coder/quartz repo (#13777)
Code that was in `/clock` has been moved to github.com/coder/quartz.  This PR refactors our use of the clock library to point to the external Quartz repo.
2024-07-03 15:02:54 +04:00
Ethan a110d18275 chore: add DRPC tailnet & cli network telemetry (#13687) 2024-07-03 15:23:46 +10:00
Kayla Washburn-Love bfbf634bec chore: update mui (#13747) 2024-07-02 15:19:01 -06:00
Eric Paulsen 80a2a5d6a8 docs: clarify envbox version pinning (#13773) 2024-07-02 20:36:08 +00:00
Stephen Kirby e40cc9314c docs: bump mainline version to v2.13.0 (#13766) 2024-07-02 15:24:26 -05:00
Mathias Fredriksson a114288ef2 ci: remove release make concurrency to fix docker image race (#13769) 2024-07-02 17:49:18 +00:00
Cian Johnston 5ea5db29e9 ci: use postgres version 13 to test migrations (#13767) 2024-07-02 17:03:21 +00:00
Bruno Quaresma 9ee53e5b4e chore(site): refactor filter component to be more extendable (#13688) 2024-07-02 13:15:13 -03:00
Michael Smith 21a923a7a0 chore: add SVG desktop icon (#13765)
* chore: add SVG desktop icon

* fix: add desktop icon to to icons.json
2024-07-02 16:00:16 +00:00
Kayla Washburn-Love b1e7498e77 chore: update xterm (#13752) 2024-07-02 09:29:34 -06:00
Danny Kopping 98c09bf5d2 fix: add policy.go as dependency of Makefile rbac target (#13757) 2024-07-02 14:29:00 +00:00
Steven Masley bde9fd58ea chore: add organization name to workspaces (#13755)
* chore: add organization name to workspaces
2024-07-02 09:25:05 -05:00
Steven Masley 128674918b chore: include organization name when fetching templates (#13751)
* chore: include organization name when fetching templates
* chore: rename template_with_user to template_with_names
2024-07-02 09:08:30 -05:00
Muhammad Atif Ali b87c12ba92 chore(dogfood): fix duplicate security repository entry (#13758) 2024-07-02 14:09:45 +03:00
Steven Masley abc0ff9689 chore: remove database import from cli (#13756)
Cli was using a utility function from a database package.
2024-07-01 21:58:23 +00:00
Kayla Washburn-Love b1ec4630f2 chore: update react dependencies (#13749) 2024-07-01 15:55:27 -06:00
Steven Masley 5bf46f360a chore: remove org context switcher in the cli (#13674)
* chore: remove org context switcher in the cli
2024-07-01 16:04:45 -05:00
Kayla Washburn-Love 4a0fd7466c chore: update emoji-mart data (#13746) 2024-07-01 14:40:15 -06:00
Jaayden Halko f26f123391 feat: route groups by name instead of id (#13692)
* feat: route groups by name instead of id

* fix: update group navigation when name changes

* fix: update isLoading and error checking

* fix: fix format

* fix: update isLoading and error

* fix: cleanup
2024-07-01 15:48:14 -04:00
Kayla Washburn-Love 41e1383640 chore: update caniuse (#13745) 2024-07-01 13:11:04 -06:00
Steven Masley 10c2817f4d chore: swagger docs omit brower based credentials, rely on swagger auth (#13742)
* chore: swagger docs omit brower based credentials, rely on swagger auth

Swagger has an "Authorize" button which should be the only
authentication being used in the api requests
2024-07-01 13:44:35 -05:00
Kayla Washburn-Love cd069faf01 chore: update storybook (#13744) 2024-07-01 12:12:41 -06:00
Kayla Washburn-Love d977654f05 feat: unify organization and deployment management settings (#13602) 2024-07-01 11:15:00 -06:00
Jaayden Halko 9b1d8f79ae docs: update workspace filters docs (#13725) 2024-07-01 12:44:32 -04:00
Eric Paulsen d8d86b16dc docs: move architecture to top level (#13722) 2024-07-01 11:58:56 -04:00
Dean Sheather 6c94dd4f23 chore: add DRPC server implementation for network telemetry (#13675) 2024-07-02 01:50:52 +10:00
dependabot[bot] 2fde054e10 chore: bump rollup-plugin-visualizer from 5.9.0 to 5.12.0 in /site (#13706)
Bumps [rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer) from 5.9.0 to 5.12.0.
- [Changelog](https://github.com/btd/rollup-plugin-visualizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/btd/rollup-plugin-visualizer/compare/v5.9.0...v5.12.0)

---
updated-dependencies:
- dependency-name: rollup-plugin-visualizer
  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-06-28 13:45:42 -08:00
dependabot[bot] 8735e234b4 chore: bump storybook/test from 8.0.5 to 8.1.11 in /site (#13716)
* chore: bump @storybook/test from 8.0.5 to 8.1.11 in /site

Bumps [@storybook/test](https://github.com/storybookjs/storybook/tree/HEAD/code/lib/test) from 8.0.5 to 8.1.11.
- [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/v8.1.11/code/lib/test)

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

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

* Update remaining storybook dependencies

Not sure if you need to update all of them, but without this you get "no
matchinge export" from at least one of these.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Asher <ash@coder.com>
2024-06-28 20:45:25 +00:00
dependabot[bot] 472ea7ebbf chore: bump @storybook/addon-essentials from 8.0.5 to 8.1.11 in /site (#13712)
Bumps [@storybook/addon-essentials](https://github.com/storybookjs/storybook/tree/HEAD/code/addons/essentials) from 8.0.5 to 8.1.11.
- [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/v8.1.11/code/addons/essentials)

---
updated-dependencies:
- dependency-name: "@storybook/addon-essentials"
  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>
2024-06-28 12:15:16 -08:00
Steven Masley 6daf330d3a chore: allow organization name or uuid for audit log searching (#13721)
* chore: allow organization name or uuid for audit log searching
2024-06-28 10:01:23 -05:00
Steven Masley 3cc86cf62d chore: implement sane default pagination limit for audit logs (#13676)
* chore: implement sane default pagination limit for audit logs
2024-06-28 07:38:04 -05:00
Cian Johnston 1a877716ca chore: add envbuilder-dogfood template (#13720)
Adds a template that can be used to dogfood on envbuilder!
2024-06-28 12:56:22 +01:00
Danny Kopping 0a221e8d5b feat: create database tables and queries for notifications (#13536) 2024-06-28 09:21:25 +00:00
dependabot[bot] 4213560b7a chore: bump @mui/icons-material from 5.14.0 to 5.15.20 in /site (#13703)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 03:49:56 +03:00
dependabot[bot] 2a21b0d144 ci: bump toshimaru/auto-author-assign in the github-actions group (#13696)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-28 03:48:01 +03:00
dependabot[bot] 86ee75b672 chore: bump undici from 6.11.1 to 6.19.2 in /site (#13699)
Bumps [undici](https://github.com/nodejs/undici) from 6.11.1 to 6.19.2.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.11.1...v6.19.2)

---
updated-dependencies:
- dependency-name: undici
  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-06-27 12:43:24 -06:00
dependabot[bot] 0b8b227dcf chore: bump emoji-mart from 5.4.0 to 5.6.0 in /site (#13709)
Bumps [emoji-mart](https://github.com/missive/emoji-mart/tree/HEAD/packages/emoji-mart) from 5.4.0 to 5.6.0.
- [Release notes](https://github.com/missive/emoji-mart/releases)
- [Commits](https://github.com/missive/emoji-mart/commits/v5.6.0/packages/emoji-mart)

---
updated-dependencies:
- dependency-name: emoji-mart
  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-06-27 12:41:09 -06:00
Muhammad Atif Ali bda94bfc77 chore: optimize dependabot configuration (#13670) 2024-06-27 21:14:17 +03:00
Kayla Washburn-Love 8b615f4522 fix: disable agent app buttons while a blocking startup script is running (#13667) 2024-06-27 11:25:03 -06:00
Jaayden Halko 093ec3d05b fix: improve checkbox text in template schedule settings dialog (#13669)
* fix: improve checkbox text in template schedule settings dialog

* fix: format

* fix: remove (s) plural language

* fix: fix format
2024-06-27 13:14:06 -04:00
Steven Masley 5a0afd8b7e chore: revert to default survey templates (#13690)
Revert to the default template provided by the package. Includes all fields like the "Message" field. Our template omits headers and keybind helpers.
2024-06-27 05:32:12 -10:00
Steven Masley 22f2c6da4f chore: add command to render all existing cli prompts (#13689)
Adds a command to render all the existing cli prompts we use. This is to validate a change to how our cli ui prompts look.
2024-06-27 05:20:15 -10:00
Spike Curtis ce7f13c6c3 fix: fix TestPGCoordinatorSingle_MissedHeartbeats flake (#13686) 2024-06-27 19:17:24 +04:00
Muhammad Atif Ali 089f06886b chore: add .pnpm-store to .gitignore (#13685) 2024-06-27 15:07:04 +03:00
Spike Curtis c94b5188bd fix: modify workspacesdk to ask for tailnet API 2.0 (#13684)
#13617 bumped the Agent/Tailnet API minor version because it adds telemetry features.  However, we don't actually use the protocol features yet, so it's a bit obnoxious for our CLI client to ask for the newest API version.

This is particularly true of the CLI client, since that's distributed separately, so if an end user installs the latest CLI client and their organization hasn't fully upgraded, then it will fail to connect.

Since we have a release coming up and the telemetry stuff won't make it, I think we should roll back to version 2.0 until we actually implement the telemetry stuff. That way the newest release (2.13) will work with Coder servers all the way back to 2.9.
2024-06-27 15:38:21 +04:00
Spike Curtis 5b59f2880f fix: fix workspacesdk to return error on API mismatch (#13683) 2024-06-27 15:02:43 +04:00
Marcin Tojek c4f1676055 feat: expose workspace build ID to terraform-plugin-coder (#13680) 2024-06-27 10:07:30 +02:00
Steven Masley 30c4b4db5c chore: implement fetch all authorized templates api (#13678) 2024-06-26 11:50:32 -06:00
Steven Masley 08e728bcb2 chore: implement organization scoped audit log requests (#13663)
* chore: add organization_id filter to audit logs
* chore: implement organization scoped audit log requests
2024-06-26 12:38:46 -05:00
Cian Johnston 20e59e0797 ci: test with multiple postgres versions (#13665)
- Tests now run on postgres 16 by default when run locally (can be specified with POSTGRES_VERSION)
- Adds test-go-pg-16 to test against postgres version 16
- Updates Dogfood dockerfile / nix flake to postgres version 16
- Updates docker-compose.yaml postgres tag to 16
2024-06-26 16:22:24 +01:00
Danny Kopping d5d8b918d7 feat: lint github actions workflows (#13552) 2024-06-26 10:28:16 +02:00
Cian Johnston 8a3592582b feat: add "Full Name" field to user creation (#13659)
Adds the ability to specify "Full Name" (a.k.a. Name) when
creating users either via CLI or UI.
2024-06-26 09:00:42 +01:00
austinrhode 87ad560aff feat: add groups and group members to telemetry snapshot (#13655)
* feat: Added in groups and groups members to telemetry snapshot
* feat: adding in test to dbauthz for getting group members and groups
2024-06-25 11:01:40 -07:00
Muhammad Atif Ali 58325dfd14 chore: minor improvements and link updates in README.md (#13656)
* chore: minor improvements and link updates in README.md

* fixup!
2024-06-25 13:29:08 -04:00
Garrett Delfosse fed668b432 chore: switch ssh session stats based on experiment (#13637) 2024-06-25 10:58:45 -04:00
Steven Masley d7eadee4d7 chore: insert audit log entries for organization CRUD (#13660)
* chore: insert audit log entries for organization CRUD
2024-06-25 09:03:15 -05:00
Spike Curtis 9c1a6a29f2 feat: add docstrings to mock timer and ticker methods and structs (#13658) 2024-06-25 16:59:35 +04:00
Spike Curtis 46e1c36c42 feat: add Next() method to mock Clock (#13657) 2024-06-25 16:48:26 +04:00
Spike Curtis 0d2f14606b chore: add usage information to clock library README (#13594)
Adds a Usage section to the README of the clock testing library.
2024-06-25 16:38:32 +04:00
Muhammad Atif Ali 136900268e ci: migrate to depot.dev runners (#13467) 2024-06-25 09:36:33 +03:00
Cian Johnston 313d4e02d2 chore(scaletest/dashboard): stub out initChromeDPCtx in unit tests (#13650) 2024-06-24 21:33:24 +01:00
Steven Masley 65b9f9bfd6 chore: audit organization member add/delete/edit (#13620)
* chore: audit organization member add/removals
2024-06-24 14:19:32 -05:00
Stephen Kirby 94639730f8 docs: bump mainline version to v2.12.3 (#13652)
* docs: bump mainline version to v2.12.3

* updated stable version
2024-06-24 14:07:42 -05:00
Steven Masley 34c67e8428 test: add unit test helper to create templates in second organizations (#13628)
* chore: add coderdtest helpers
2024-06-24 12:55:57 -05:00
Steven Masley e4333c0433 chore: 'coder login' reset cli organization context (#13646)
Cli organization context is reset on `coder login` if the organization
selected is an invalid organization.
2024-06-24 12:55:39 -05:00
dependabot[bot] 8ccdf05bbc chore: bump github.com/aws/aws-sdk-go-v2 from 1.27.0 to 1.30.0 (#13643)
Bumps [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) from 1.27.0 to 1.30.0.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.27.0...v1.30.0)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2
  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-06-24 12:22:17 -05:00
dependabot[bot] 218f429336 chore: bump github.com/hashicorp/hcl/v2 from 2.20.0 to 2.21.0 (#13642)
Bumps [github.com/hashicorp/hcl/v2](https://github.com/hashicorp/hcl) from 2.20.0 to 2.21.0.
- [Release notes](https://github.com/hashicorp/hcl/releases)
- [Changelog](https://github.com/hashicorp/hcl/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/hcl/compare/v2.20.0...v2.21.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/hcl/v2
  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-06-24 12:21:45 -05:00
dependabot[bot] 6f4a9b6b51 chore: bump github.com/valyala/fasthttp from 1.54.0 to 1.55.0 (#13640)
Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.54.0 to 1.55.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/1.54.0...v1.55.0)

---
updated-dependencies:
- dependency-name: github.com/valyala/fasthttp
  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-06-24 12:21:18 -05:00
Colin Adler 3dec6ff32f chore: add protobuf types for tailnet telemetry (#13617) 2024-06-24 12:13:03 -05:00
Stephen Kirby b9d83c75de fixed changelog script release channel flag (#13649) 2024-06-24 11:50:24 -05:00
dependabot[bot] 7e20b56352 chore: bump alpine from 3.20.0 to 3.20.1 in /scripts (#13644)
Bumps alpine from 3.20.0 to 3.20.1.

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 11:48:07 -05:00
Stephen Kirby 3d6c9799e3 fixed script ref (#13647) 2024-06-24 11:27:13 -05:00
Cian Johnston b4a5c7ffa9 chore: upgrade Go version to 1.22.4 (#13623)
Updates Go version to 1.22.4

Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
2024-06-24 15:50:52 +01:00
dependabot[bot] 7cb8bfb133 ci: bump the github-actions group with 2 updates (#13645)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 15:52:05 +03:00
Stephen Kirby 2cfadad023 manually updated autoversion (#13633) 2024-06-22 12:16:07 -05:00
Stephen Kirby 9abaa94599 docs: bump mainline version to v2.12.2 (#13632) 2024-06-21 15:11:58 -05:00
Kyle Carberry 54e8f30002 chore: remove failing_sections from healthcheck (#13426)
Closes #10854.
2024-06-21 14:49:02 -04:00
Steven Masley 5177f366f5 fix: organization 404 write 1 http status (#13629) 2024-06-21 13:01:46 -05:00
Steven Masley 0e933f0537 chore: refactor user -> rbac.subject into a function (#13624)
* chore: refactor user subject logic to be in 1 place
* test: implement test to assert deleted custom roles are omitted
* add unit test for deleted role
2024-06-21 11:30:02 -05:00
Kyle Carberry 3ef12ac284 fix: remove connected button (#13625)
It didn't make a lot of sense in current form. It will when we improve autostop.
2024-06-21 11:41:59 -04:00
Steven Masley 75e7213ac2 feat: add cli command to remove organization member (#13619) 2024-06-21 10:35:59 -05:00
Bruno Quaresma cbdaa63b68 chore(site): refactor popover to make it easier to extend (#13611) 2024-06-21 11:15:37 -03:00
Ethan 714f2ef83c fix: fix shallow clones not retrieving a valid semver (#13609) 2024-06-22 00:02:12 +10:00
Bruno Quaresma 73a25c3bc5 chore(site): add InputGroup component (#13597) 2024-06-21 10:54:55 -03:00
Steven Masley 819bfd3170 fix: remove assigning org-member role, this is implied from membership (#13578) 2024-06-21 08:01:39 -05:00
dependabot[bot] 66a604d779 chore: bump golang.org/x/tools from 0.21.0 to 0.22.0 (#13513)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-21 08:54:06 +03:00
Steven Masley 2ef2f97388 chore: improve error message on adding existing org_member (#13621) 2024-06-20 18:05:11 -05:00
Colin Adler 889daf200e feat(enterprise): add auditing to SCIM (#13614) 2024-06-20 17:22:27 -05:00
Steven Masley c4656d77cc chore: add help to error to reset organization context (#13616) 2024-06-20 16:44:47 -05:00
Kyle Carberry 495eea452f fix: track login page correctly (#13618) 2024-06-20 21:33:47 +00:00
Asher 43e45f4ab7 fix: fill out zero-value user properties in /audit (#13604) 2024-06-20 12:40:08 -08:00
Kyle Carberry 57b38e5bb8 fix: allow coder.com in CSP if telemetry is enabled (#13615)
* fix: allow coder.com in CSP if telemetry is enabled

* Fix control couple lint
2024-06-20 16:05:22 -04:00
Kyle Carberry 0793a4b35b feat: add cross-origin reporting for telemetry in the dashboard (#13612)
* feat: add cross-origin reporting for telemetry in the dashboard

* Respect the telemetry flag

* Fix embedded metadata

* Fix compilation error

* Fix linting
2024-06-20 15:19:45 -04:00
Steven Masley a1db6d809e chore: implement delete organization member (#13589)
Side effects of removing an organization member will orphan their
user resources. These side effects are not addressed here
2024-06-20 10:06:37 -05:00
Kelly Peilin Chan a1ec8ad6e9 Update docker-in-workspaces.md (#13606) 2024-06-20 11:05:21 -04:00
Steven Masley 8e06ad46d0 chore: add organization member api + cli (#13577) 2024-06-20 09:19:24 -05:00
Dean Sheather 4699adee5e chore: update dogfood sydney server (#13610) 2024-06-20 14:12:25 +00:00
Spike Curtis 8923ce5216 fix: fix flake in TestAppHealth_Healthy (#13607) 2024-06-20 12:02:31 +04:00
Spike Curtis 02ffff11dd feat: add NewTicker to clock testing library (#13593) 2024-06-20 10:16:04 +04:00
Kyle Carberry 7049d7a881 fix: display trial errors in the dashboard (#13601)
* fix: display trial errors in the dashboard

The error was essentially being ignored before!

* Remove day mention in product of trial

* fmt
2024-06-19 12:02:51 -04:00
dependabot[bot] 84cdcac8ad chore: bump ws from 8.14.2 to 8.17.1 in /site (#13595)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-19 10:51:25 +03:00
Kayla Washburn-Love e987ad1d89 fix: don't allow "new" or "create" as url-friendly names (#13596) 2024-06-18 15:36:13 -06:00
Kyle Carberry 3a1fa04590 fix: write server config to telemetry (#13590)
* fix: add external auth configs to telemetry

* Refactor telemetry to send the entire config

* gen

* Fix linting
2024-06-18 16:20:21 -04:00
Spike Curtis d0b2f6196c fix: allow mock clock Timers to accept negative duration (#13592)
The standard library `NewTimer`, `AfterFunc` and `Reset` allow negative durations, so our mock clock library should as well.
2024-06-18 15:40:56 +04:00
Spike Curtis 1de023a121 chore: add README to clock testing (#13583)
Adds README with some draft content explaining why the library exists.  Will be most relevant when we spin out into a standalone library.
2024-06-18 10:16:49 +04:00
Steven Masley 1d3642d0be chore: fix link in v2.0.0 changelog to scale tests (#13591) 2024-06-17 14:24:07 -05:00
Kayla Washburn-Love 8c1bd32c33 feat(site): add basic organization management ui (#13288) 2024-06-17 11:02:39 -06:00
Kayla Washburn-Love 07cd9acb2c fix: fix workspace actions options (#13572) 2024-06-17 10:24:30 -06:00
dependabot[bot] eed9794516 ci: bump crate-ci/typos in the github-actions group (#13584)
Bumps the github-actions group with 1 update: [crate-ci/typos](https://github.com/crate-ci/typos).


Updates `crate-ci/typos` from 1.22.3 to 1.22.7
- [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.22.3...v1.22.7)

---
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>
2024-06-17 09:03:26 -04:00
Ben Potter 808e1c0d89 docs: add screenshots page (#13582)
* docs: add screenshots page

* fmt
2024-06-15 15:34:18 -05:00
Garrett Delfosse 44d69139d5 chore: accept payload on workspace usage route (#13544) 2024-06-14 10:08:45 -04:00
Eric Paulsen 87820a29d7 docs: reorganize scaling docs (#13574)
* refactor scaling docs

* manifest

* make fmt

* fix 404s

* fix 404s pt 2

* fix manifest
2024-06-14 09:30:04 -04:00
Spike Curtis c01d6fdf46 chore: refactor apphealth and tests to use clock testing library (#13576)
Refactors the apphealth subsystem and unit tests to use `clock.Clock`.

Also slightly simplifies the implementation, which wrapped a function that never returned an error in a `retry.Retry`.  The retry is entirely superfluous in that case, so removed.

UTs used to take a few seconds to run, and now run in milliseconds or better.  No sleeps, `Eventually`, or polling.

Dropped the "no spamming" test since we can directly assert the number of handler calls on the mainline test case.
2024-06-14 15:06:33 +04:00
Cian Johnston fe240add86 fix(coderd): userOIDC: ignore leading @ of EmailDomain (#13568) 2024-06-14 09:29:07 +01:00
Steven Masley d04959cea8 chore: implement custom role assignment for organization admins (#13570)
* chore: static role assignment mapping

Until a dynamic approach is created in the database, only org-admins
can assign custom organization roles.
2024-06-13 15:59:06 -05:00
Steven Masley 3d30c8dc68 chore: protect reserved builtin rolenames (#13571)
Conflicting built-in and database role names makes it hard to
disambiguate
2024-06-13 15:12:37 -05:00
Steven Masley 7d51515f9d chore: implement assign organization roles from the cli (#13558)
Basic functionality to assign roles to an organization member via cli.
2024-06-13 14:49:32 -05:00
Eric Paulsen 87a172fb14 docs: add validated architecture (#13561)
* docs: add validated architecture

* make: fmt

* formatting

* fix 404s

* fix 404s pt 2

* fix 404s pt 3
2024-06-13 13:00:26 -04:00
Cian Johnston c587af7c0e fix(dogfood/Dockerfile): add explicit --chown to COPY directive (#13569) 2024-06-13 15:16:34 +01:00
Cian Johnston 5d3f3c08cd chore(dogfood): add devcontainer for use with envbuilder (#13567) 2024-06-13 14:31:49 +01:00
Spike Curtis 0268c7a659 chore: refactor autobuild/notify to use clock test (#13566)
Refactor autobuild/notify and tests to use the clock testing library.

I also rewrote some of the comments because I didn't understand them when I was looking at the package.
2024-06-13 16:01:17 +04:00
Spike Curtis 4b0b9b08d5 feat: add interfaces report to support bundle (#13563) 2024-06-13 13:09:54 +04:00
Spike Curtis 88eb6ce378 fix: fix flake in TestDERPEndToEnd (#13564) 2024-06-13 11:38:51 +04:00
Spike Curtis fc09077b7b feat!: add interface report to coder netcheck (#13562)
re: #13327

Adds local interfaces to `coder netcheck` and checks their MTUs for potential problems.

This is mostly relevant for end-user systems where VPNs are common.  We _could_ also add it to coderd healthcheck, but until I see coderd connecting to workspaces over a VPN in the wild, I don't think its worth the UX effort.

Netcheck results get the following:

```
  "interfaces": {
    "error": null,
    "severity": "ok",
    "warnings": null,
    "dismissed": false,
    "interfaces": [
      {
        "name": "lo0",
        "mtu": 16384,
        "addresses": [
          "127.0.0.1/8",
          "::1/128",
          "fe80::1/64"
        ]
      },
      {
        "name": "en8",
        "mtu": 1500,
        "addresses": [
          "192.168.50.217/24",
          "fe80::c13:1a92:3fa5:dd7e/64"
        ]
      }
    ]
  }
```

_Technically_ not back compatible if anyone is parsing `coder netcheck` output as JSON, since the original output is now under `"derp"` in the output.
2024-06-13 10:19:36 +04:00
Steven Masley d0fc81a51c chore: implement cli list organization members (#13555)
example cli command: 
`coder organization members`
2024-06-12 10:07:12 -10:00
Steven Masley bbe23edc7d chore: implement api layer for listing organization members (#13546) 2024-06-12 09:52:18 -10:00
Steven Masley de9e6889bb chore: merge organization member db queries (#13542)
Merge members queries into 1 that also joins in the user table for username.
Required to list organization members on UI/cli
2024-06-12 09:23:48 -10:00
Kyle Carberry 1ca5dc0328 chore: always use the latest released version tag when building (#13556)
* chore: always use the latest released version tag when building

* Update version.sh

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

---------

Co-authored-by: Dean Sheather <dean@deansheather.com>
2024-06-12 14:52:35 -04:00
Kayla Washburn-Love 28228f1bcb feat: allow editing org icon (#13547) 2024-06-12 12:28:13 -06:00
Ethan 58bf0ec1c6 chore: add additional tailnet topology integration tests (#13549) 2024-06-12 16:02:34 +00:00
Spike Curtis ba7d1835e5 fix: fix flake in TestWorkspaceAgent_Metadata_CatchMemoryLeak (#13553)
Fixes flake seen here: https://github.com/coder/coder/actions/runs/9461246505/job/26061605278

#13486 subtly changes the test so that `post` uses the new v2 Agent API, and when canceling context, there is a race condition where the yamux session underpinning the API can get torn down before the RPC processes the canceled context, yielding a different error response than the test was previously expecting.

I've refactored the test to just stop posting when the test finishes, rather than depend on a context cancel to end the posting goroutine.
2024-06-12 18:33:22 +04:00
Bruno Quaresma 0c627a4cb9 refactor(site): refactor filter search field (#13545) 2024-06-12 10:22:20 -03:00
Ethan a11f8b003b chore: write speedtest connection updates to stderr (#13550) 2024-06-12 07:10:28 +00:00
Kira Pilot dd99897bb2 chore: updating Ashby link to be position agnostic (#13543) 2024-06-11 12:59:33 -04:00
Steven Masley 5ccf5084e8 chore: create type for unique role names (#13506)
* chore: create type for unique role names

Using `string` was confusing when something should be combined with
org context, and when not to. Naming this new name, "RoleIdentifier"
2024-06-11 08:55:28 -05:00
Kyle Carberry c9cca9d56e fix: transform underscores to hyphens for github login (#13384)
Fixes #13339.
2024-06-11 13:34:05 +00:00
Marcin Tojek 7958c52918 docs: faq: restrict file transfers from workspaces (#13534) 2024-06-11 09:29:29 +00:00
Spike Curtis 1f9bdc36bf fix: ignore yamux.ErrSessionShutdown on TestTailnetAPIConnector_Disconnects (#13532) 2024-06-11 11:16:49 +04:00
Ethan dd243686e4 chore!: remove deprecated agent v1 routes (#13486) 2024-06-11 12:22:59 +10:00
dependabot[bot] e7bea17e70 chore: bump braces from 3.0.2 to 3.0.3 in /site (#13526)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-11 03:54:42 +03:00
dependabot[bot] 363dbad3a3 ci: bump the github-actions group with 2 updates (#13521)
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.21.0 to 1.22.3
- [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.21.0...v1.22.3)

Updates `aquasecurity/trivy-action` from 0.21.0 to 0.22.0
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](https://github.com/aquasecurity/trivy-action/compare/fd25fed6972e341ff0007ddb61f77e88103953c2...595be6a0f6560a0a8fc419ddf630567fc623531d)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-minor
  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>
2024-06-11 01:06:40 +03:00
Garrett Delfosse 5b9a65e5c1 chore: move Batcher and Tracker to workspacestats (#13418) 2024-06-10 15:35:23 -04:00
Colin Adler c7e7312cb0 fix(site): don't show start button while starting (#13495) 2024-06-10 13:28:21 -05:00
Marcin Tojek e96652ebbc feat: block file transfers for security (#13501) 2024-06-10 12:12:23 +00:00
Spike Curtis 8326a3a675 chore: change mock clock to allow Advance() within timer/tick functions (#13500) 2024-06-10 15:27:24 +04:00
Kyle Carberry 7c081dcd6f fix: replace invalid utf-8 sequences in agent logs (#13436)
* fix: replace invalid utf-8 sequences in agent logs

Fixes #13433.

* fix: replace invalid UTF-8 with , add regression

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
Co-authored-by: Spike Curtis <spike@coder.com>
2024-06-10 15:27:11 +04:00
Steven Masley 0d65143301 chore: implement audit log for custom role edits (#13494)
* chore: implement audit log for custom role edits
2024-06-07 14:11:57 -05:00
Bruno Quaresma 056a697eff feat(site): add download logs option (#13466) 2024-06-07 10:03:05 -03:00
Cian Johnston 48ecee1025 chore(cli): address cli netcheck test flake (#13492)
* netcheck: removes check for healthy node report in test
* coderd/healthcheck/derphealth: do not override parent context deadline
2024-06-07 10:01:54 +01:00
Steven Masley 7c3b8b6224 chore: duplicate migration file fix, 000216 (#13498) 2024-06-06 16:13:00 -05:00
Steven Masley e2b330fcba chore: change sql parameter for custom roles to be a (name,org_id) tuple (#13480)
* chore: sql parameter to custom roles to be a (name,org) tuple

CustomRole lookup takes (name,org_id) tuples as the search criteria.
2024-06-06 15:36:37 -05:00
Bruno Quaresma 1adc19b41f fix(site): allow user to update their name (#13493) 2024-06-06 15:32:51 -03:00
Bruno Quaresma 4dfa901990 refactor(site): hide select helper when only one proxy exists (#13496) 2024-06-06 15:17:43 -03:00
Bruno Quaresma a8a81a61cd fix(site): fix tooltip in start button group (#13497) 2024-06-06 14:51:52 -03:00
Kayla Washburn-Love 44a70a5bc2 feat: edit org display names and descriptions (#13474) 2024-06-06 10:59:59 -06:00
Cian Johnston 1131772e79 feat(coderd): set full name from IDP name claim (#13468)
* Updates OIDC and GitHub OAuth login to fetch set name from relevant claim fields
* Adds CODER_OIDC_NAME_FIELD as configurable source of user name claim
* Adds httpapi function to normalize a username such that it will pass validation
* Adds firstName / lastName fields to dev OIDC setup
2024-06-06 13:37:08 +01:00
Colin Adler e743588843 docs: bump k8s install version (#13487) 2024-06-06 03:31:32 +00:00
Colin Adler 37676c46d5 chore(scripts): remove remaining gh_auth calls from release scripts (#13485) 2024-06-05 22:24:26 -05:00
Jon Ayers 7995d7c3d6 fix: only render tooltip when require_active_version enabled (#13484) 2024-06-06 02:52:49 +00:00
Colin Adler f1b42a15fa fix(site): show workspace start button when require active version is enabled (#13482) 2024-06-05 16:50:52 -05:00
Steven Masley 8f62311f00 chore: remove organization_id suffix from org_member roles in database (#13473)
Organization member's table is already scoped to an organization.
Rolename should avoid having the org_id appended.

Wipes all existing organization role assignments, which should not be used anyway.
2024-06-05 11:25:02 -05:00
Spike Curtis fade8ba759 fix: fix MeasureLatencyRecvTimeout to accept send=0 (#13477)
Fixes the flake seen here: https://github.com/coder/coder/runs/25832852690

Linux is not a real time operating system, and so there is no guarantee that subsequent `time.Now()` `time.Since()` calls will return a non-zero time.  This assert is mainly there to ensure we don't return `-1`.
2024-06-05 18:27:56 +04:00
Spike Curtis 775fc3f5e9 chore: add Now, Since, AfterFunc to clock; use clock for configmaps test (#13476)
* chore: add Now, Since, AfterFunc to clock; use clock for configmaps test

* chore: update flake.nix vendor hash

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

---------

Signed-off-by: Spike Curtis <spike@coder.com>
2024-06-05 16:00:02 +04:00
Spike Curtis ffcfbb6c55 chore: add example test case for clock package (#13465) 2024-06-05 15:49:31 +04:00
Spike Curtis 9c3fd5dd26 chore: add explicit Wait() to clock.Advance() (#13464) 2024-06-05 15:37:16 +04:00
Spike Curtis 42324b386a chore: add clock pkg for testing time (#13461)
Adds a package for testing time/timer/ticker functions.  Implementation is limited to `NewTimer` and `NewContextTicker`, but will eventually be expanded to all `time` functions from the standard library as well as `context.WithTimeout()`, `context.WithDeadline()`.

Replaces `benbjohnson/clock` for the pubsub watchdog, as a proof of concept.

Eventually, as we expand functionality, we will replace most time-related functions with this library for testing.
2024-06-05 13:55:45 +04:00
Ethan a4bba520a2 feat(cli): add json output to coder speedtest (#13475) 2024-06-05 08:31:44 +00:00
Mathias Fredriksson 9a757f8e74 chore(scripts): fix release promote stable to set latest tag (#13471) 2024-06-04 23:01:26 +00:00
dependabot[bot] 83ac386533 chore: bump ejs from 3.1.9 to 3.1.10 in /site (#13447)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-04 23:52:59 +03:00
Kayla Washburn-Love 0ea89a3d41 chore: add cleanup callbacks to some useEffect calls (#13444) 2024-06-04 12:18:03 -06:00
Stephen Kirby 213848e2e3 chore(docs): rename banners and show usage of multiple (#13435)
* renamed banners in docs

* fmt

* Update appearance.md

Co-authored-by: Kayla Washburn-Love <mckayla@hey.com>

* fmt

---------

Co-authored-by: Kayla Washburn-Love <mckayla@hey.com>
Co-authored-by: Ben <me@bpmct.net>
2024-06-04 17:49:13 +00:00
Ben Potter 8435b70bea chore: update docs for v2.12 mainline and v2.11 stable (#13469)
* chore: update docs for v2.12 mainline and v2.11 stable

* remove broken link
2024-06-04 12:22:13 -05:00
Mathias Fredriksson 3b7f9534fb chore(scripts): fix dry run for autoversion in release.sh (#13470) 2024-06-04 20:10:15 +03:00
Steven Masley e3206612e1 chore: implement typed database for custom permissions (breaks existing custom roles) (#13457)
* chore: typed database custom permissions
* add migration to fix any custom roles out there
2024-06-04 09:27:44 -05:00
Cian Johnston 168d2d6ba0 chore(coderd): add update user profile test for members (#13463) 2024-06-04 14:17:17 +01:00
Marcin Tojek cd32c42699 fix(cli): inherit provisioner tags from last template version (#13462) 2024-06-04 11:59:54 +00:00
Muhammad Atif Ali e527bc6242 chore(dogfood): replace deprecated coder_workspace.owner_oidc_access_token and add order to agent metadata (#13456) 2024-06-04 09:21:01 +01:00
Mathias Fredriksson a51076a4cd chore(scripts): fix unbound variable in tag_version.sh (#13428) 2024-06-03 21:29:24 +00:00
Kayla Washburn-Love 78b8264a90 feat(site): add deployment menu to navbar (#13401) 2024-06-03 15:05:49 -06:00
Muhammad Atif Ali c7233eccec chore(dogfood): bump module versions (#13455) 2024-06-04 00:03:34 +03:00
Colin Adler 40390ecc30 chore: fix TestServer/Prometheus/DBMetricsDisabled test flake (#13453)
See: https://github.com/coder/coder/actions/runs/9352137263/job/25739550487#step:5:368
2024-06-03 15:38:59 -05:00
Kayla Washburn-Love 2806752c7d chore: add light mode snapshot to chromatic for WorkspaceBuildPageView (#13449) 2024-06-03 13:50:59 -06:00
Colin Adler e4ac691468 chore: fix (*coderdtest.WorkspaceAgentWaiter).Wait() flake (#13451) 2024-06-03 14:46:56 -05:00
Colin Adler 43ef00401c chore: linting fixes (#13450) 2024-06-03 14:33:37 -05:00
Steven Masley 27f26910b6 chore: external auth validate response "Forbidden" should return invalid, not an error (#13446)
* chore: add unit test to delete workspace from suspended user
* chore: account for forbidden as well as unauthorized response codes
2024-06-03 13:16:51 -05:00
dependabot[bot] 0b019cad77 chore: bump google.golang.org/api from 0.181.0 to 0.182.0 (#13439)
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.181.0 to 0.182.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.181.0...v0.182.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>
2024-06-03 12:30:12 -05:00
Colin Adler 9d00a26a90 fix: add missing route for codersdk.PostLogSource (#13421) 2024-06-03 12:29:50 -05:00
dependabot[bot] 8cdd468107 chore: bump github.com/coder/terraform-provider-coder from 0.22.0 to 0.23.0 (#13440)
Bumps [github.com/coder/terraform-provider-coder](https://github.com/coder/terraform-provider-coder) from 0.22.0 to 0.23.0.
- [Release notes](https://github.com/coder/terraform-provider-coder/releases)
- [Changelog](https://github.com/coder/terraform-provider-coder/blob/main/.goreleaser.yml)
- [Commits](https://github.com/coder/terraform-provider-coder/compare/v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: github.com/coder/terraform-provider-coder
  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-06-03 12:29:29 -05:00
Kayla Washburn-Love cb94dfb1f6 fix: fix build error background color (#13445) 2024-06-03 11:18:44 -06:00
Kayla Washburn-Love 79fd736387 chore(site): enable React's StrictMode (#13399) 2024-06-03 10:03:46 -06:00
Steven Masley 973cc2b875 chore: add edit organization role to cli (#13365)
Editing custom org roles from hidden org cli command.
2024-06-03 09:34:10 -05:00
Steven Masley 24ba81930b chore: return failed refresh errors on external auth as string (was boolean) (#13402)
* chore: return failed refresh errors on external auth

Failed refreshes should return errors. These errors are captured
as validate errors.
2024-06-03 09:33:49 -05:00
Marcin Tojek bf98b0dfe4 fix: correct swagger description for Insights API (#13442) 2024-06-03 15:48:31 +02:00
Colin Adler b723da9e91 chore: upgrade terraform to v1.8.5 (#13429) 2024-06-02 13:10:28 -04:00
2862 changed files with 271021 additions and 154107 deletions
+10 -10
View File
@@ -1,13 +1,13 @@
{
"name": "Development environments on your infrastructure",
"image": "codercom/oss-dogfood:latest",
"name": "Development environments on your infrastructure",
"image": "codercom/oss-dogfood:latest",
"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"]
"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"]
}
+1 -1
View File
@@ -7,7 +7,7 @@ trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
[*.{md,json,yaml,yml,tf,tfvars,nix}]
[*.{yaml,yml,tf,tfvars,nix}]
indent_style = space
indent_size = 2
+2
View File
@@ -3,3 +3,5 @@
# chore: format code with semicolons when using prettier (#9555)
988c9af0153561397686c119da9d1336d2433fdd
# chore: use tabs for prettier and biome (#14283)
95a7c0c4f087744a22c2e88dd3c5d30024d5fb02
+2 -2
View File
@@ -1,7 +1,7 @@
# Generated files
coderd/apidoc/docs.go linguist-generated=true
docs/api/*.md linguist-generated=true
docs/cli/*.md linguist-generated=true
docs/reference/api/*.md linguist-generated=true
docs/reference/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
+22
View File
@@ -0,0 +1,22 @@
dirs:
- docs
excludedDirs:
# Downstream bug in linkspector means large markdown files fail to parse
# but these are autogenerated and shouldn't need checking
- docs/reference
# Older changelogs may contain broken links
- docs/changelogs
ignorePatterns:
- pattern: "localhost"
- pattern: "example.com"
- pattern: "mailto:"
- pattern: "127.0.0.1"
- pattern: "0.0.0.0"
- pattern: "JFROG_URL"
- pattern: "coder.company.org"
# These real sites were blocking the linkspector action / GitHub runner IPs(?)
- pattern: "i.imgur.com"
- pattern: "code.visualstudio.com"
- pattern: "www.emacswiki.org"
aliveStatusCodes:
- 200
+2 -2
View File
@@ -4,12 +4,12 @@ description: |
inputs:
version:
description: "The Go version to use."
default: "1.22.3"
default: "1.22.8"
runs:
using: "composite"
steps:
- name: Setup Go
uses: buildjet/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ inputs.version }}
+5 -5
View File
@@ -11,16 +11,16 @@ runs:
using: "composite"
steps:
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- name: Setup Node
uses: buildjet/setup-node@v4.0.1
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: 18.19.0
node-version: 20.16.0
# See https://github.com/actions/setup-node#caching-global-packages-data
cache: "pnpm"
cache-dependency-path: ${{ inputs.directory }}/pnpm-lock.yaml
- name: Install root node_modules
shell: bash
run: ./scripts/pnpm_install.sh
+1 -1
View File
@@ -5,6 +5,6 @@ runs:
using: "composite"
steps:
- name: Setup sqlc
uses: sqlc-dev/setup-sqlc@v4
uses: sqlc-dev/setup-sqlc@c0209b9199cd1cce6a14fc27cabcec491b651761 # v4.0.0
with:
sqlc-version: "1.25.0"
+2 -2
View File
@@ -5,7 +5,7 @@ runs:
using: "composite"
steps:
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: 1.8.4
terraform_version: 1.9.8
terraform_wrapper: false
+2 -1
View File
@@ -1,5 +1,6 @@
name: Upload tests to datadog
if: always()
description: |
Uploads the test results to datadog.
inputs:
api-key:
description: "Datadog API key"
+44 -38
View File
@@ -39,6 +39,10 @@ updates:
prefix: "chore"
labels: []
open-pull-requests-limit: 15
groups:
x:
patterns:
- "golang.org/x/*"
ignore:
# Ignore patch updates for all dependencies
- dependency-name: "*"
@@ -47,7 +51,13 @@ updates:
# Update our Dockerfile.
- package-ecosystem: "docker"
directory: "/scripts/"
directories:
- "/dogfood/contents"
- "/scripts"
- "/examples/templates/docker/build"
- "/examples/parameters/build"
- "/scaletest/templates/scaletest-runner"
- "/scripts/ironbank"
schedule:
interval: "weekly"
time: "06:00"
@@ -61,7 +71,12 @@ updates:
- dependency-name: "terraform"
- package-ecosystem: "npm"
directory: "/site/"
directories:
- "/site"
- "/offlinedocs"
- "/scripts"
- "/scripts/apidocgen"
schedule:
interval: "monthly"
time: "06:00"
@@ -71,44 +86,35 @@ updates:
commit-message:
prefix: "chore"
labels: []
groups:
xterm:
patterns:
- "@xterm*"
mui:
patterns:
- "@mui*"
react:
patterns:
- "react"
- "react-dom"
- "@types/react"
- "@types/react-dom"
emotion:
patterns:
- "@emotion*"
exclude-patterns:
- "jest-runner-eslint"
jest:
patterns:
- "jest"
- "@types/jest"
vite:
patterns:
- "vite*"
- "@vitejs/plugin-react"
ignore:
# Ignore patch updates for all dependencies
# Ignore major version updates to avoid breaking changes
- 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
open-pull-requests-limit: 15
groups:
site:
patterns:
- "*"
- 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:
- "*"
+345 -141
View File
@@ -9,16 +9,7 @@ on:
workflow_dispatch:
permissions:
actions: none
checks: none
contents: read
deployments: none
issues: none
packages: write
pull-requests: none
repository-projects: none
security-events: none
statuses: none
# Cancel in-progress runs for pull requests when developers push
# additional changes
@@ -42,13 +33,18 @@ jobs:
offlinedocs: ${{ steps.filter.outputs.offlinedocs }}
tailnet-integration: ${{ steps.filter.outputs.tailnet-integration }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
# For pull requests it's not necessary to checkout the code
- name: check changed files
uses: dorny/paths-filter@v3
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
@@ -84,7 +80,8 @@ jobs:
- "cmd/**"
- "coderd/**"
- "enterprise/**"
- "examples/*"
- "examples/**"
- "helm/**"
- "provisioner/**"
- "provisionerd/**"
- "provisionersdk/**"
@@ -117,32 +114,53 @@ jobs:
run: |
echo "${{ toJSON(steps.filter )}}"
update-flake:
needs: changes
if: needs.changes.outputs.gomod == 'true'
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# Disabled due to instability. See: https://github.com/coder/coder/issues/14553
# Re-enable once the flake hash calculation is stable.
# update-flake:
# needs: changes
# if: needs.changes.outputs.gomod == 'true'
# runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
# steps:
# - name: Checkout
# uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
# with:
# fetch-depth: 1
# # See: https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#commits-made-by-this-action-do-not-trigger-new-workflow-runs
# token: ${{ secrets.CDRCI_GITHUB_TOKEN }}
- name: Setup Go
uses: ./.github/actions/setup-go
# - name: Setup Go
# uses: ./.github/actions/setup-go
- name: Update Nix Flake SRI Hash
run: ./scripts/update-flake.sh
# - name: Update Nix Flake SRI Hash
# run: ./scripts/update-flake.sh
- name: Ensure No Changes
run: git diff --exit-code
# # auto update flake for dependabot
# - uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1
# if: github.actor == 'dependabot[bot]'
# with:
# # Allows dependabot to still rebase!
# commit_message: "[dependabot skip] Update Nix Flake SRI Hash"
# commit_user_name: "dependabot[bot]"
# commit_user_email: "49699333+dependabot[bot]@users.noreply.github.com>"
# commit_author: "dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>"
# # require everyone else to update it themselves
# - name: Ensure No Changes
# if: github.actor != 'dependabot[bot]'
# run: git diff --exit-code
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' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
@@ -154,13 +172,13 @@ jobs:
- name: Get golangci-lint cache dir
run: |
linter_ver=$(egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/Dockerfile | cut -d '=' -f 2)
linter_ver=$(egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/contents/Dockerfile | cut -d '=' -f 2)
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$linter_ver
dir=$(golangci-lint cache status | awk '/Dir/ { print $2 }')
echo "LINT_CACHE_DIR=$dir" >> $GITHUB_ENV
- name: golangci-lint cache
uses: buildjet/cache@v4
uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
with:
path: |
${{ env.LINT_CACHE_DIR }}
@@ -170,7 +188,7 @@ jobs:
# Check for any typos
- name: Check for typos
uses: crate-ci/typos@v1.21.0
uses: crate-ci/typos@b74202f74b4346efdbce7801d187ec57b266bac8 # v1.27.3
with:
config: .github/workflows/typos.toml
@@ -183,7 +201,7 @@ jobs:
# Needed for helm chart linting
- name: Install helm
uses: azure/setup-helm@v4
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: v3.9.2
@@ -191,14 +209,30 @@ jobs:
run: |
make --output-sync=line -j lint
- name: Check workflow files
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.4
./actionlint -color -shellcheck= -ignore "set-output"
shell: bash
- name: Check for unstaged files
run: |
rm -f ./actionlint ./typos
./scripts/check_unstaged.sh
shell: bash
gen:
timeout-minutes: 8
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
needs: changes
if: needs.changes.outputs.docs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
if: always()
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
@@ -243,23 +277,25 @@ jobs:
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' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
timeout-minutes: 7
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
- name: Setup Node
uses: ./.github/actions/setup-node
# Use default Go version
- name: Setup Go
uses: buildjet/setup-go@v5
with:
# This doesn't need caching. It's super fast anyways!
cache: false
go-version: 1.21.9
uses: ./.github/actions/setup-go
- name: Install shfmt
run: go install mvdan.cc/sh/v3/cmd/shfmt@v3.7.0
@@ -273,7 +309,7 @@ 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-xlarge' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-16-cores' || matrix.os }}
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || 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
@@ -285,8 +321,13 @@ jobs:
- macos-latest
- windows-2022
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
@@ -329,7 +370,7 @@ jobs:
api-key: ${{ secrets.DATADOG_API_KEY }}
test-go-pg:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
needs:
- changes
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
@@ -339,8 +380,13 @@ jobs:
# even if some of the preceding steps are slow.
timeout-minutes: 25
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
@@ -351,8 +397,55 @@ jobs:
uses: ./.github/actions/setup-tf
- name: Test with PostgreSQL Database
env:
POSTGRES_VERSION: "13"
TS_DEBUG_DISCO: "true"
run: |
make test-postgres
- 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 }}
# NOTE: this could instead be defined as a matrix strategy, but we want to
# only block merging if tests on postgres 13 fail. Using a matrix strategy
# here makes the check in the above `required` job rather complicated.
test-go-pg-16:
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
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
# goroutines. Setting this to the timeout +5m should work quite well
# even if some of the preceding steps are slow.
timeout-minutes: 25
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Setup Terraform
uses: ./.github/actions/setup-tf
- name: Test with PostgreSQL Database
env:
POSTGRES_VERSION: "16"
TS_DEBUG_DISCO: "true"
run: |
export TS_DEBUG_DISCO=true
make test-postgres
- name: Upload test stats to Datadog
@@ -364,13 +457,18 @@ jobs:
api-key: ${{ secrets.DATADOG_API_KEY }}
test-go-race:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
needs: changes
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
timeout-minutes: 25
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
@@ -380,9 +478,13 @@ jobs:
- name: Setup Terraform
uses: ./.github/actions/setup-tf
# We run race tests with reduced parallelism because they use more CPU and we were finding
# instances where tests appear to hang for multiple seconds, resulting in flaky tests when
# short timeouts are used.
# c.f. discussion on https://github.com/coder/coder/pull/15106
- name: Run Tests
run: |
gotestsum --junitfile="gotests.xml" -- -race ./...
gotestsum --junitfile="gotests.xml" -- -race -parallel 4 -p 4 ./...
- name: Upload test stats to Datadog
timeout-minutes: 1
@@ -399,14 +501,19 @@ jobs:
# These tests are skipped in the main go test jobs because they require root
# and mess with networking.
test-go-tailnet-integration:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
needs: changes
# Unnecessary to run on main for now
if: needs.changes.outputs.tailnet-integration == 'true' || needs.changes.outputs.ci == 'true'
timeout-minutes: 20
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
@@ -421,13 +528,18 @@ jobs:
run: make test-tailnet-integration
test-js:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
needs: changes
if: needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
timeout-minutes: 20
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
@@ -438,7 +550,8 @@ jobs:
working-directory: site
test-e2e:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-16vcpu-ubuntu-2204' || 'ubuntu-latest' }}
# test-e2e fails on 2-core 8GB runners, so we use the 4-core 16GB runner
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || '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
@@ -446,14 +559,19 @@ jobs:
fail-fast: false
matrix:
variant:
- enterprise: false
- premium: false
name: test-e2e
- enterprise: true
name: test-e2e-enterprise
- premium: true
name: test-e2e-premium
name: ${{ matrix.variant.name }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
@@ -473,38 +591,35 @@ jobs:
- run: pnpm playwright:install
working-directory: site
# Run tests that don't require an enterprise license without an enterprise license
# Run tests that don't require a premium license without a premium license
- run: pnpm playwright:test --forbid-only --workers 1
if: ${{ !matrix.variant.enterprise }}
if: ${{ !matrix.variant.premium }}
env:
DEBUG: pw:api
working-directory: site
# Run all of the tests with an enterprise license
# Run all of the tests with a premium license
- run: pnpm playwright:test --forbid-only --workers 1
if: ${{ matrix.variant.enterprise }}
if: ${{ matrix.variant.premium }}
env:
DEBUG: pw:api
CODER_E2E_ENTERPRISE_LICENSE: ${{ secrets.CODER_E2E_ENTERPRISE_LICENSE }}
CODER_E2E_REQUIRE_ENTERPRISE_TESTS: "1"
CODER_E2E_LICENSE: ${{ secrets.CODER_E2E_LICENSE }}
CODER_E2E_REQUIRE_PREMIUM_TESTS: "1"
working-directory: site
# Temporarily allow these to fail so that I can gather data about which
# tests are failing.
continue-on-error: true
- 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@v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4.4.1
with:
name: failed-test-videos${{ matrix.variant.enterprise && '-enterprise' || '-agpl' }}
name: failed-test-videos${{ matrix.variant.premium && '-premium' || '' }}
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
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4.4.1
with:
name: debug-pprof-dumps${{ matrix.variant.enterprise && '-enterprise' || '-agpl' }}
name: debug-pprof-dumps${{ matrix.variant.premium && '-premium' || '' }}
path: ./site/test-results/**/debug-pprof-*.txt
retention-days: 7
@@ -514,8 +629,13 @@ jobs:
needs: changes
if: needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
# Required by Chromatic for build-over-build history, otherwise we
# only get 1 commit on shallow checkout.
@@ -529,7 +649,7 @@ jobs:
# 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@v10
uses: chromaui/action@30b6228aa809059d46219e0f556752e8672a7e26 # v11.11.0
env:
NODE_OPTIONS: "--max_old_space_size=4096"
STORYBOOK: true
@@ -560,7 +680,7 @@ 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@v10
uses: chromaui/action@30b6228aa809059d46219e0f556752e8672a7e26 # v11.11.0
env:
NODE_OPTIONS: "--max_old_space_size=4096"
STORYBOOK: true
@@ -582,12 +702,17 @@ jobs:
offlinedocs:
name: offlinedocs
needs: changes
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
if: needs.changes.outputs.offlinedocs == 'true' || needs.changes.outputs.ci == 'true' || needs.changes.outputs.docs == 'true'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
# 0 is required here for version.sh to work.
fetch-depth: 0
@@ -650,11 +775,15 @@ jobs:
- test-e2e
- offlinedocs
- sqlc-vet
- dependency-license-review
# Allow this job to run even if the needed jobs fail, are skipped or
# cancelled.
if: always()
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Ensure required checks
run: |
echo "Checking required checks"
@@ -667,7 +796,6 @@ jobs:
echo "- test-js: ${{ needs.test-js.result }}"
echo "- test-e2e: ${{ needs.test-e2e.result }}"
echo "- offlinedocs: ${{ needs.offlinedocs.result }}"
echo "- dependency-license-review: ${{ needs.dependency-license-review.result }}"
echo
# We allow skipped jobs to pass, but not failed or cancelled jobs.
@@ -678,25 +806,112 @@ jobs:
echo "Required checks have passed"
# Builds the dylibs and upload it as an artifact so it can be embedded in the main build
build-dylib:
needs: changes
# We always build the dylibs on Go changes to verify we're not merging unbuildable code,
# but they need only be signed and uploaded on coder/coder main.
if: needs.changes.outputs.docs-only == 'false' || github.ref == 'refs/heads/main'
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- name: Setup build tools
run: |
brew install bash gnu-getopt make
echo "$(brew --prefix bash)/bin" >> $GITHUB_PATH
echo "$(brew --prefix gnu-getopt)/bin" >> $GITHUB_PATH
echo "$(brew --prefix make)/libexec/gnubin" >> $GITHUB_PATH
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Install rcodesign
if: ${{ github.repository_owner == 'coder' && github.ref == 'refs/heads/main' }}
run: |
set -euo pipefail
wget -O /tmp/rcodesign.tar.gz https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/apple-codesign-0.22.0-macos-universal.tar.gz
sudo tar -xzf /tmp/rcodesign.tar.gz \
-C /usr/local/bin \
--strip-components=1 \
apple-codesign-0.22.0-macos-universal/rcodesign
rm /tmp/rcodesign.tar.gz
- name: Setup Apple Developer certificate and API key
if: ${{ github.repository_owner == 'coder' && github.ref == 'refs/heads/main' }}
run: |
set -euo pipefail
touch /tmp/{apple_cert.p12,apple_cert_password.txt,apple_apikey.p8}
chmod 600 /tmp/{apple_cert.p12,apple_cert_password.txt,apple_apikey.p8}
echo "$AC_CERTIFICATE_P12_BASE64" | base64 -d > /tmp/apple_cert.p12
echo "$AC_CERTIFICATE_PASSWORD" > /tmp/apple_cert_password.txt
echo "$AC_APIKEY_P8_BASE64" | base64 -d > /tmp/apple_apikey.p8
env:
AC_CERTIFICATE_P12_BASE64: ${{ secrets.AC_CERTIFICATE_P12_BASE64 }}
AC_CERTIFICATE_PASSWORD: ${{ secrets.AC_CERTIFICATE_PASSWORD }}
AC_APIKEY_P8_BASE64: ${{ secrets.AC_APIKEY_P8_BASE64 }}
- name: Build dylibs
run: |
set -euxo pipefail
go mod download
make gen/mark-fresh
make build/coder-dylib
env:
CODER_SIGN_DARWIN: ${{ github.ref == 'refs/heads/main' && '1' || '0' }}
AC_CERTIFICATE_FILE: /tmp/apple_cert.p12
AC_CERTIFICATE_PASSWORD_FILE: /tmp/apple_cert_password.txt
- name: Upload build artifacts
if: ${{ github.repository_owner == 'coder' && github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: dylibs
path: |
./build/*.h
./build/*.dylib
retention-days: 7
- name: Delete Apple Developer certificate and API key
if: ${{ github.repository_owner == 'coder' && github.ref == 'refs/heads/main' }}
run: rm -f /tmp/{apple_cert.p12,apple_cert_password.txt,apple_apikey.p8}
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
# to main branch.
needs:
- changes
- build-dylib
if: github.ref == 'refs/heads/main' && 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' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
permissions:
packages: write # Needed to push images to ghcr.io
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
outputs:
IMAGE: ghcr.io/coder/coder-preview:${{ steps.build-docker.outputs.tag }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- name: GHCR Login
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
@@ -714,6 +929,18 @@ jobs:
- name: Install zstd
run: sudo apt-get install -y zstd
- name: Download dylibs
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: dylibs
path: ./build
- name: Insert dylibs
run: |
mv ./build/*amd64.dylib ./site/out/bin/coder-vpn-darwin-amd64.dylib
mv ./build/*arm64.dylib ./site/out/bin/coder-vpn-darwin-arm64.dylib
mv ./build/*arm64.h ./site/out/bin/coder-vpn-darwin-dylib.h
- name: Build
run: |
set -euxo pipefail
@@ -744,13 +971,15 @@ jobs:
echo "tag=$tag" >> $GITHUB_OUTPUT
# build images for each architecture
make -j build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
# note: omitting the -j argument to avoid race conditions when pushing
make 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
# note: omitting the -j argument to avoid race conditions when pushing
make push/build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
# Define specific tags
tags=("$tag" "main" "latest")
@@ -769,7 +998,7 @@ jobs:
- name: Prune old images
if: github.ref == 'refs/heads/main'
uses: vlaurin/action-ghcr-prune@v0.6.0
uses: vlaurin/action-ghcr-prune@0cf7d39f88546edd31965acba78cdcb0be14d641 # v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
organization: coder
@@ -784,7 +1013,7 @@ jobs:
- name: Upload build artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4.4.1
with:
name: coder
path: |
@@ -807,28 +1036,33 @@ jobs:
contents: read
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2.1.7
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
uses: google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a # v2.1.2
- name: Set up Flux CLI
uses: fluxcd/flux2/action@main
uses: fluxcd/flux2/action@5350425cdcd5fa015337e09fa502153c0275bd4b # v2.4.0
with:
# Keep this up to date with the version of flux installed in dogfood cluster
# Keep this and the github action 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"
uses: google-github-actions/get-gke-credentials@206d64b64b0eba0a6e2f25113d044c31776ca8d6 # v2.2.2
with:
cluster_name: dogfood-v2
location: us-central1-a
@@ -864,13 +1098,18 @@ jobs:
needs: build
if: github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- name: Setup flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
uses: superfly/flyctl-actions/setup-flyctl@fc53c09e1bc3be6f54706524e3b82c4f462f77be # v1.5
- name: Deploy workspace proxies
run: |
@@ -890,12 +1129,17 @@ jobs:
# 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' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
needs: changes
if: needs.changes.outputs.db == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
# We need golang to run the migration main.go
@@ -908,43 +1152,3 @@ jobs:
- name: Setup and run sqlc vet
run: |
make sqlc-vet
# dependency-license-review checks that no license-incompatible dependencies have been introduced.
# This action is not intended to do a vulnerability check since that is handled by a separate action.
dependency-license-review:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]'
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: "Dependency Review"
id: review
uses: actions/dependency-review-action@v4.3.2
with:
allow-licenses: Apache-2.0, BSD-2-Clause, BSD-3-Clause, CC0-1.0, ISC, MIT, MIT-0, MPL-2.0
allow-dependencies-licenses: "pkg:golang/github.com/coder/wgtunnel@0.1.13-0.20240522110300-ade90dfb2da0"
license-check: true
vulnerability-check: false
- name: "Report"
# make sure this step runs even if the previous failed
if: always()
shell: bash
env:
VULNERABLE_CHANGES: ${{ steps.review.outputs.invalid-license-changes }}
run: |
fields=( "unlicensed" "unresolved" "forbidden" )
# This is unfortunate that we have to do this but the action does not support failing on
# an unknown license. The unknown dependency could easily have a GPL license which
# would be problematic for us.
# Track https://github.com/actions/dependency-review-action/issues/672 for when
# we can remove this brittle workaround.
for field in "${fields[@]}"; do
# Use jq to check if the array is not empty
if [[ $(echo "$VULNERABLE_CHANGES" | jq ".${field} | length") -ne 0 ]]; then
echo "Invalid or unknown licenses detected, contact @sreya to ensure your added dependency falls under one of our allowed licenses."
echo "$VULNERABLE_CHANGES" | jq
exit 1
fi
done
echo "No incompatible licenses detected"
+24 -4
View File
@@ -13,6 +13,11 @@ on:
- opened
- reopened
- edited
# For jobs that don't run on draft PRs.
- ready_for_review
permissions:
contents: read
# Only run one instance per PR to ensure in-order execution.
concurrency: pr-${{ github.ref }}
@@ -25,16 +30,26 @@ jobs:
permissions:
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: auto-approve dependabot
uses: hmarr/auto-approve-action@v4
uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0
if: github.actor == 'dependabot[bot]'
cla:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- 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.4.0
uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.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
@@ -52,10 +67,15 @@ jobs:
release-labels:
runs-on: ubuntu-latest
# Skip tagging for draft PRs.
if: ${{ github.event_name == 'pull_request_target' && success() && !github.event.pull_request.draft }}
if: ${{ github.event_name == 'pull_request_target' && !github.event.pull_request.draft }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: release-labels
uses: actions/github-script@v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
# This script ensures PR title and labels are in sync:
#
+15 -8
View File
@@ -22,10 +22,6 @@ on:
permissions:
contents: read
# Necessary to push docker images to ghcr.io.
packages: write
# Necessary for depot.dev authentication.
id-token: write
# Avoid running multiple jobs for the same commit.
concurrency:
@@ -33,14 +29,24 @@ concurrency:
jobs:
build:
permissions:
# Necessary for depot.dev authentication.
id-token: write
# Necessary to push docker images to ghcr.io.
packages: write
runs-on: ubuntu-latest
if: github.repository_owner == 'coder'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Docker login
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
@@ -50,16 +56,17 @@ jobs:
run: mkdir base-build-context
- name: Install depot.dev CLI
uses: depot/setup-action@v1
uses: depot/setup-action@b0b1ea4f69e92ebf5dea3f8713a1b0c37b2126a5 # v1.6.0
# This uses OIDC authentication, so no auth variables are required.
- name: Build base Docker image via depot.dev
uses: depot/build-push-action@v1
uses: depot/build-push-action@636daae76684e38c301daa0c5eca1c095b24e780 # v1.14.0
with:
project: wl5hnrrkns
context: base-build-context
file: scripts/Dockerfile.base
platforms: linux/amd64,linux/arm64,linux/arm/v7
provenance: true
pull: true
no-cache: true
push: ${{ github.event_name != 'pull_request' }}
+42 -22
View File
@@ -17,16 +17,26 @@ on:
- "flake.nix"
workflow_dispatch:
permissions:
# Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
id-token: write
jobs:
build_image:
if: github.actor != 'dependabot[bot]' # Skip Dependabot PRs
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
uses: tj-actions/branch-names@6871f53176ad61624f978536bbf089c574dc19a2 # v8.0.1
- name: "Branch name to Docker tag name"
id: docker-tag-name
@@ -37,38 +47,38 @@ jobs:
echo "tag=${tag}" >> $GITHUB_OUTPUT
- name: Set up Depot CLI
uses: depot/setup-action@v1
uses: depot/setup-action@b0b1ea4f69e92ebf5dea3f8713a1b0c37b2126a5 # v1.6.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Login to DockerHub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Non-Nix image
uses: depot/build-push-action@v1
uses: depot/build-push-action@636daae76684e38c301daa0c5eca1c095b24e780 # v1.14.0
with:
project: b4q6ltmpzh
token: ${{ secrets.DEPOT_TOKEN }}
buildx-fallback: true
context: "{{defaultContext}}:dogfood"
context: "{{defaultContext}}:dogfood/contents"
pull: true
save: true
push: ${{ github.ref == 'refs/heads/main' }}
tags: "codercom/oss-dogfood:${{ steps.docker-tag-name.outputs.tag }},codercom/oss-dogfood:latest"
- name: Build and push Nix image
uses: depot/build-push-action@v1
uses: depot/build-push-action@636daae76684e38c301daa0c5eca1c095b24e780 # v1.14.0
with:
project: b4q6ltmpzh
token: ${{ secrets.DEPOT_TOKEN }}
buildx-fallback: true
context: "."
file: "dogfood/Dockerfile.nix"
file: "dogfood/contents/Dockerfile.nix"
pull: true
save: true
push: ${{ github.ref == 'refs/heads/main' }}
@@ -78,17 +88,31 @@ jobs:
needs: build_image
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Setup Terraform
uses: ./.github/actions/setup-tf
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2.1.7
with:
workload_identity_provider: projects/573722524737/locations/global/workloadIdentityPools/github/providers/github
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com
- name: Terraform init and validate
run: |
cd dogfood
terraform init -upgrade
terraform validate
cd contents
terraform init -upgrade
terraform validate
- name: Get short commit SHA
if: github.ref == 'refs/heads/main'
@@ -100,22 +124,18 @@ jobs:
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 --message="$CODER_TEMPLATE_MESSAGE"
cd dogfood
terraform apply -auto-approve
env:
# Consumed by Coder CLI
# Consumed by coderd provider
CODER_URL: https://dev.coder.com
CODER_SESSION_TOKEN: ${{ secrets.CODER_SESSION_TOKEN }}
# Template source & details
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 }}
TF_VAR_CODER_TEMPLATE_NAME: ${{ secrets.CODER_TEMPLATE_NAME }}
TF_VAR_CODER_TEMPLATE_VERSION: ${{ steps.vars.outputs.sha_short }}
TF_VAR_CODER_TEMPLATE_DIR: ./contents
TF_VAR_CODER_TEMPLATE_MESSAGE: ${{ steps.message.outputs.pr_title }}
TF_LOG: info
-26
View File
@@ -1,26 +0,0 @@
{
"ignorePatterns": [
{
"pattern": "://localhost"
},
{
"pattern": "://.*.?example\\.com"
},
{
"pattern": "developer.github.com"
},
{
"pattern": "docs.github.com"
},
{
"pattern": "support.google.com"
},
{
"pattern": "tailscale.com"
},
{
"pattern": "wireguard.com"
}
],
"aliveStatusCodes": [200, 0]
}
+18 -4
View File
@@ -6,18 +6,27 @@ on:
# Every day at midnight
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
go-race:
# While GitHub's toaster runners are likelier to flake, we want consistency
# between this environment and the regular test environment for DataDog
# statistics and to only show real workflow threats.
runs-on: "buildjet-8vcpu-ubuntu-2204"
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
# This runner costs 0.016 USD per minute,
# so 0.016 * 240 = 3.84 USD per run.
timeout-minutes: 240
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Setup Go
uses: ./.github/actions/setup-go
@@ -40,11 +49,16 @@ jobs:
go-timing:
# We run these tests with p=1 so we don't need a lot of compute.
runs-on: "buildjet-2vcpu-ubuntu-2204"
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04' || 'ubuntu-latest' }}
timeout-minutes: 10
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Setup Go
uses: ./.github/actions/setup-go
+6 -1
View File
@@ -13,5 +13,10 @@ jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Assign author
uses: toshimaru/auto-author-assign@v2.1.0
uses: toshimaru/auto-author-assign@16f0022cf3d7970c106d8d1105f75a1165edb516 # v2.1.1
+10 -2
View File
@@ -9,12 +9,20 @@ on:
required: true
permissions:
packages: write
contents: read
jobs:
cleanup:
runs-on: "ubuntu-latest"
permissions:
# Necessary to delete docker images from ghcr.io.
packages: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Get PR number
id: pr_number
run: |
@@ -26,7 +34,7 @@ jobs:
- name: Delete image
continue-on-error: true
uses: bots-house/ghcr-delete-image-action@v1.1.0
uses: bots-house/ghcr-delete-image-action@3827559c68cb4dcdf54d813ea9853be6d468d3a4 # v1.1.0
with:
owner: coder
name: coder-preview
+74 -31
View File
@@ -30,8 +30,6 @@ env:
permissions:
contents: read
packages: write
pull-requests: write # needed for commenting on PRs
jobs:
check_pr:
@@ -39,8 +37,13 @@ jobs:
outputs:
PR_OPEN: ${{ steps.check_pr.outputs.pr_open }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Check if PR is open
id: check_pr
@@ -69,8 +72,13 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
@@ -101,8 +109,8 @@ jobs:
run: |
set -euo pipefail
mkdir -p ~/.kube
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
chmod 644 ~/.kube/config
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG_BASE64 }}" | base64 --decode > ~/.kube/config
chmod 600 ~/.kube/config
export KUBECONFIG=~/.kube/config
- name: Check if the helm deployment already exists
@@ -119,7 +127,7 @@ jobs:
echo "NEW=$NEW" >> $GITHUB_OUTPUT
- name: Check changed files
uses: dorny/paths-filter@v3
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
base: ${{ github.ref }}
@@ -154,16 +162,23 @@ jobs:
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)
# build if the deployment already 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"
permissions:
pull-requests: write # needed for commenting on PRs
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Find Comment
uses: peter-evans/find-comment@v3
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc
with:
issue-number: ${{ needs.get_info.outputs.PR_NUMBER }}
@@ -173,7 +188,7 @@ jobs:
- name: Comment on PR
id: comment_id
uses: peter-evans/create-or-update-comment@v4
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ needs.get_info.outputs.PR_NUMBER }}
@@ -189,8 +204,11 @@ jobs:
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.
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
permissions:
# Necessary to push docker images to ghcr.io.
packages: write
# This concurrency only cancels build jobs if a new build is triggred. It will avoid cancelling the current deployemtn in case of docs changes.
concurrency:
group: build-${{ github.workflow }}-${{ github.ref }}-${{ needs.get_info.outputs.BUILD }}
cancel-in-progress: true
@@ -198,8 +216,13 @@ jobs:
DOCKER_CLI_EXPERIMENTAL: "enabled"
CODER_IMAGE_TAG: ${{ needs.get_info.outputs.CODER_IMAGE_TAG }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
@@ -213,7 +236,7 @@ jobs:
uses: ./.github/actions/setup-sqlc
- name: GHCR Login
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
@@ -242,6 +265,8 @@ jobs:
always() && (needs.build.result == 'success' || needs.build.result == 'skipped') &&
(needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true')
runs-on: "ubuntu-latest"
permissions:
pull-requests: write # needed for commenting on PRs
env:
CODER_IMAGE_TAG: ${{ needs.get_info.outputs.CODER_IMAGE_TAG }}
PR_NUMBER: ${{ needs.get_info.outputs.PR_NUMBER }}
@@ -249,12 +274,17 @@ jobs:
PR_URL: ${{ needs.get_info.outputs.PR_URL }}
PR_HOSTNAME: "pr${{ needs.get_info.outputs.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}"
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Set up kubeconfig
run: |
set -euo pipefail
mkdir -p ~/.kube
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
chmod 644 ~/.kube/config
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG_BASE64 }}" | base64 --decode > ~/.kube/config
chmod 600 ~/.kube/config
export KUBECONFIG=~/.kube/config
- name: Check if image exists
@@ -294,7 +324,7 @@ jobs:
kubectl create namespace "pr${{ env.PR_NUMBER }}"
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Check and Create Certificate
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
@@ -391,14 +421,14 @@ jobs:
"${DEST}" version
mv "${DEST}" /usr/local/bin/coder
- name: Create first user, template and workspace
- name: Create first user
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
id: setup_deployment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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)
@@ -407,20 +437,22 @@ jobs:
echo "password=$password" >> $GITHUB_OUTPUT
coder login \
--first-user-username coder \
--first-user-username pr${{ env.PR_NUMBER }}-admin \
--first-user-email pr${{ env.PR_NUMBER }}@coder.com \
--first-user-password $password \
--first-user-trial \
--first-user-trial=false \
--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 a user for the github.actor
# TODO: update once https://github.com/coder/coder/issues/15466 is resolved
# coder users create \
# --username ${{ github.actor }} \
# --login-type github
# Create workspace
coder create --template="kubernetes" kube --parameter cpu=2 --parameter memory=4 --parameter home_disk_size=2 -y
coder stop kube -y
# promote the user to admin role
# coder org members edit-role ${{ github.actor }} organization-admin
# TODO: update once https://github.com/coder/internal/issues/207 is resolved
- name: Send Slack notification
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
@@ -432,7 +464,7 @@ jobs:
"pr_url": "'"${{ env.PR_URL }}"'",
"pr_title": "'"${{ env.PR_TITLE }}"'",
"pr_access_url": "'"https://${{ env.PR_HOSTNAME }}"'",
"pr_username": "'"test"'",
"pr_username": "'"pr${{ env.PR_NUMBER }}-admin"'",
"pr_email": "'"pr${{ env.PR_NUMBER }}@coder.com"'",
"pr_password": "'"${{ steps.setup_deployment.outputs.password }}"'",
"pr_actor": "'"${{ github.actor }}"'"
@@ -441,7 +473,7 @@ jobs:
echo "Slack notification sent"
- name: Find Comment
uses: peter-evans/find-comment@v3
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc
with:
issue-number: ${{ env.PR_NUMBER }}
@@ -450,7 +482,7 @@ jobs:
direction: last
- name: Comment on PR
uses: peter-evans/create-or-update-comment@v4
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
env:
STATUS: ${{ needs.get_info.outputs.NEW == 'true' && 'Created' || 'Updated' }}
with:
@@ -465,3 +497,14 @@ jobs:
cc: @${{ github.actor }}
reactions: rocket
reactions-edit-mode: replace
- name: Create template and workspace
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'
run: |
set -euo pipefail
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
+28
View File
@@ -0,0 +1,28 @@
name: release-validation
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
network-performance:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Run Schmoder CI
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
with:
workflow: ci.yaml
repo: coder/schmoder
inputs: '{ "num_releases": "3", "commit": "${{ github.sha }}" }'
token: ${{ secrets.CDRCI_SCHMODER_ACTIONS_TOKEN }}
ref: main
+48 -25
View File
@@ -18,12 +18,7 @@ on:
default: false
permissions:
# Required to publish a release
contents: write
# Necessary to push docker images to ghcr.io.
packages: write
# Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
id-token: write
contents: read
concurrency: ${{ github.workflow }}-${{ github.ref }}
@@ -39,15 +34,27 @@ env:
jobs:
release:
name: Build and publish
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
permissions:
# Required to publish a release
contents: write
# Necessary to push docker images to ghcr.io.
packages: write
# Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
id-token: write
env:
# Necessary for Docker manifest
DOCKER_CLI_EXPERIMENTAL: "enabled"
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
@@ -116,7 +123,7 @@ jobs:
cat "$CODER_RELEASE_NOTES_FILE"
- name: Docker Login
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
@@ -130,7 +137,7 @@ jobs:
# Necessary for signing Windows binaries.
- name: Setup Java
uses: actions/setup-java@v4
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
distribution: "zulu"
java-version: "11.0"
@@ -180,19 +187,19 @@ jobs:
- name: Test migrations from current ref to main
run: |
make test-migrations
POSTGRES_VERSION=13 make test-migrations
# Setup GCloud for signing Windows binaries.
- name: Authenticate to Google Cloud
id: gcloud_auth
uses: google-github-actions/auth@v2
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2.1.7
with:
workload_identity_provider: ${{ secrets.GCP_CODE_SIGNING_WORKLOAD_ID_PROVIDER }}
service_account: ${{ secrets.GCP_CODE_SIGNING_SERVICE_ACCOUNT }}
token_format: "access_token"
- name: Setup GCloud SDK
uses: "google-github-actions/setup-gcloud@v2"
uses: google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a # v2.1.2
- name: Build binaries
run: |
@@ -245,17 +252,18 @@ jobs:
- name: Install depot.dev CLI
if: steps.image-base-tag.outputs.tag != ''
uses: depot/setup-action@v1
uses: depot/setup-action@b0b1ea4f69e92ebf5dea3f8713a1b0c37b2126a5 # v1.6.0
# This uses OIDC authentication, so no auth variables are required.
- name: Build base Docker image via depot.dev
if: steps.image-base-tag.outputs.tag != ''
uses: depot/build-push-action@v1
uses: depot/build-push-action@636daae76684e38c301daa0c5eca1c095b24e780 # v1.14.0
with:
project: wl5hnrrkns
context: base-build-context
file: scripts/Dockerfile.base
platforms: linux/amd64,linux/arm64,linux/arm/v7
provenance: true
pull: true
no-cache: true
push: true
@@ -297,7 +305,7 @@ jobs:
# build Docker images for each architecture
version="$(./scripts/version.sh)"
make -j build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
make build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
# we can't build multi-arch if the images aren't pushed, so quit now
# if dry-running
@@ -308,7 +316,7 @@ jobs:
# 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.tag
make push/build/coder_"$version"_linux.tag
# if the current version is equal to the highest (according to semver)
# version in the repo, also create a multi-arch image as ":latest" and
@@ -358,13 +366,13 @@ jobs:
CODER_GPG_RELEASE_KEY_BASE64: ${{ secrets.GPG_RELEASE_KEY_BASE64 }}
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2.1.7
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@v2"
uses: google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a # 2.1.2
- name: Publish Helm Chart
if: ${{ !inputs.dry_run }}
@@ -383,7 +391,7 @@ jobs:
- name: Upload artifacts to actions (if dry-run)
if: ${{ inputs.dry_run }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4.4.1
with:
name: release-artifacts
path: |
@@ -396,14 +404,14 @@ jobs:
./build/*.rpm
retention-days: 7
- name: Start Packer builds
- name: Send repository-dispatch event
if: ${{ !inputs.dry_run }}
uses: peter-evans/repository-dispatch@v3
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
with:
token: ${{ secrets.CDRCI_GITHUB_TOKEN }}
repository: coder/packages
event-type: coder-release
client-payload: '{"coder_version": "${{ steps.version.outputs.version }}"}'
client-payload: '{"coder_version": "${{ steps.version.outputs.version }}", "release_channel": "${{ inputs.release_channel }}"}'
publish-homebrew:
name: Publish to Homebrew tap
@@ -414,6 +422,11 @@ jobs:
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: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Update homebrew
env:
# Variables used by the `gh` command
@@ -485,13 +498,18 @@ jobs:
if: ${{ !inputs.dry_run }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Sync fork
run: gh repo sync cdrci/winget-pkgs -b master
env:
GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
@@ -570,8 +588,13 @@ jobs:
needs: release
if: ${{ !inputs.dry_run }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 1
+52
View File
@@ -0,0 +1,52 @@
name: OpenSSF Scorecard
on:
branch_protection_rule:
schedule:
- cron: "27 7 * * 3" # A random time to run weekly
push:
branches: ["main"]
permissions: read-all
jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: "Checkout code"
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with:
results_file: results.sarif
results_format: sarif
repo_token: ${{ secrets.GITHUB_TOKEN }}
publish_results: true
# Upload the results as artifacts.
- name: "Upload artifact"
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4.4.1
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
sarif_file: results.sarif
+35 -23
View File
@@ -3,7 +3,6 @@ name: "security"
permissions:
actions: read
contents: read
security-events: write
on:
workflow_dispatch:
@@ -23,16 +22,23 @@ concurrency:
jobs:
codeql:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
permissions:
security-events: write
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
languages: go, javascript
@@ -42,7 +48,7 @@ jobs:
rm Makefile
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
- name: Send Slack notification on failure
if: ${{ failure() }}
@@ -56,10 +62,17 @@ jobs:
"${{ secrets.SLACK_SECURITY_FAILURE_WEBHOOK_URL }}"
trivy:
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
permissions:
security-events: write
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
@@ -85,13 +98,20 @@ jobs:
# protoc must be in lockstep with our dogfood Dockerfile or the
# version in the comments will differ. This is also defined in
# ci.yaml.
set -x
cd dogfood
set -euxo pipefail
cd dogfood/contents
mkdir -p /usr/local/bin
mkdir -p /usr/local/include
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
# Copy the generated files to the include directory.
docker run --rm -v /usr/local/include:/target protoc cp -r /tmp/include/google /target/
ls -la /usr/local/include/google/protobuf/
stat /usr/local/include/google/protobuf/timestamp.proto
- name: Build Coder linux amd64 Docker image
id: build
@@ -110,11 +130,13 @@ jobs:
# the registry.
export CODER_IMAGE_BUILD_BASE_TAG="$(CODER_IMAGE_BASE=coder-base ./scripts/image_tag.sh --version "$version")"
make -j "$image_job"
# We would like to use make -j here, but it doesn't work with the some recent additions
# to our code generation.
make "$image_job"
echo "image=$(cat "$image_job")" >> $GITHUB_OUTPUT
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@fd25fed6972e341ff0007ddb61f77e88103953c2
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0
with:
image-ref: ${{ steps.build.outputs.image }}
format: sarif
@@ -122,28 +144,18 @@ jobs:
severity: "CRITICAL,HIGH"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
with:
sarif_file: trivy-results.sarif
category: "Trivy"
- name: Upload Trivy scan results as an artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4.4.1
with:
name: trivy
path: trivy-results.sarif
retention-days: 7
# Prisma cloud scan runs last because it fails the entire job if it
# detects vulnerabilities. :|
- name: Run Prisma Cloud image scan
uses: PaloAltoNetworks/prisma-cloud-scan@v1
with:
pcc_console_url: ${{ secrets.PRISMA_CLOUD_URL }}
pcc_user: ${{ secrets.PRISMA_CLOUD_ACCESS_KEY }}
pcc_pass: ${{ secrets.PRISMA_CLOUD_SECRET_KEY }}
image_name: ${{ steps.build.outputs.image }}
- name: Send Slack notification on failure
if: ${{ failure() }}
run: |
+39 -10
View File
@@ -1,23 +1,36 @@
name: Stale Issue, Banch and Old Workflows Cleanup
name: Stale Issue, Branch and Old Workflows Cleanup
on:
schedule:
# Every day at midnight
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
issues:
runs-on: ubuntu-latest
permissions:
# Needed to close issues.
issues: write
# Needed to close PRs.
pull-requests: write
actions: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: stale
uses: actions/stale@v9.0.0
uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
with:
stale-issue-label: "stale"
stale-pr-label: "stale"
days-before-stale: 180
# days-before-stale: 180
# essentially disabled for now while we work through polish issues
days-before-stale: 3650
# Pull Requests become stale more quickly due to merge conflicts.
# Also, we promote minimizing WIP.
days-before-pr-stale: 7
@@ -31,7 +44,7 @@ jobs:
# Start with the oldest issues, always.
ascending: true
- name: "Close old issues labeled likely-no"
uses: actions/github-script@v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
@@ -57,7 +70,7 @@ jobs:
});
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}`);
@@ -78,11 +91,19 @@ jobs:
branches:
runs-on: ubuntu-latest
permissions:
# Needed to delete branches.
contents: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Run delete-old-branches-action
uses: beatlabs/delete-old-branches-action@v0.0.10
uses: beatlabs/delete-old-branches-action@6e94df089372a619c01ae2c2f666bf474f890911 # v0.0.10
with:
repo_token: ${{ github.token }}
date: "6 months ago"
@@ -92,9 +113,17 @@ jobs:
exclude_open_pr_branches: true
del_runs:
runs-on: ubuntu-latest
permissions:
# Needed to delete workflow runs.
actions: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Delete PR Cleanup workflow runs
uses: Mattraks/delete-workflow-runs@v2
uses: Mattraks/delete-workflow-runs@39f0bbed25d76b34de5594dceab824811479e5de # v2.0.6
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
@@ -103,7 +132,7 @@ jobs:
delete_workflow_pattern: pr-cleanup.yaml
- name: Delete PR Deploy workflow skipped runs
uses: Mattraks/delete-workflow-runs@v2
uses: Mattraks/delete-workflow-runs@39f0bbed25d76b34de5594dceab824811479e5de # v2.0.6
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
+12 -2
View File
@@ -14,8 +14,16 @@ darcula = "darcula"
Hashi = "Hashi"
trialer = "trialer"
encrypter = "encrypter"
hel = "hel" # as in helsinki
pn = "pn" # this is used as proto node
# as in helsinki
hel = "hel"
# this is used as proto node
pn = "pn"
# typos doesn't like the EDE in TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
EDE = "EDE"
# HELO is an SMTP command
HELO = "HELO"
LKE = "LKE"
byt = "byt"
[files]
extend-exclude = [
@@ -34,4 +42,6 @@ extend-exclude = [
"tailnet/testdata/**",
"site/src/pages/SetupPage/countries.tsx",
"provisioner/terraform/testdata/**",
# notifications' golden files confuse the detector because of quoted-printable encoding
"coderd/notifications/testdata/**"
]
+16 -7
View File
@@ -10,23 +10,32 @@ on:
paths:
- "docs/**"
permissions:
contents: read
jobs:
check-docs:
runs-on: ubuntu-latest
permissions:
pull-requests: write # required to post PR review comments by the action
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Check Markdown links
uses: gaurav-nelson/github-action-markdown-link-check@v1
uses: umbrelladocs/action-linkspector@fc382e19892aca958e189954912fe379a8df270c # v1.2.4
id: markdown-link-check
# checks all markdown files from /docs including all subfolders
with:
use-quiet-mode: "yes"
use-verbose-mode: "yes"
config-file: ".github/workflows/mlc_config.json"
folder-path: "docs/"
file-path: "./README.md"
reporter: github-pr-review
config_file: ".github/.linkspector.yml"
fail_on_error: "true"
filter_mode: "nofilter"
- name: Send Slack notification
if: failure() && github.event_name == 'schedule'
+8
View File
@@ -17,6 +17,8 @@ yarn-error.log
# Allow VSCode recommendations and default settings in project root.
!/.vscode/extensions.json
!/.vscode/settings.json
# Allow code snippets
!/.vscode/*.code-snippets
# Front-end ignore patterns.
.next/
@@ -68,3 +70,9 @@ result
# Filebrowser.db
**/filebrowser.db
# pnpm
.pnpm-store/
# Zed
.zed_server
+5
View File
@@ -195,6 +195,11 @@ linters-settings:
- name: var-naming
- name: waitgroup-by-value
# irrelevant as of Go v1.22: https://go.dev/blog/loopvar-preview
govet:
disable:
- loopclosure
issues:
# Rules listed here: https://github.com/securego/gosec#available-rules
exclude-rules:
+14 -12
View File
@@ -20,6 +20,8 @@ yarn-error.log
# Allow VSCode recommendations and default settings in project root.
!/.vscode/extensions.json
!/.vscode/settings.json
# Allow code snippets
!/.vscode/*.code-snippets
# Front-end ignore patterns.
.next/
@@ -71,24 +73,24 @@ result
# Filebrowser.db
**/filebrowser.db
# pnpm
.pnpm-store/
# Zed
.zed_server
# .prettierignore.include:
# Helm templates contain variables that are invalid YAML and can't be formatted
# by Prettier.
helm/**/templates/*.yaml
# Terraform state files used in tests, these are automatically generated.
# Example: provisioner/terraform/testdata/instance-id/instance-id.tfstate.json
**/testdata/**/*.tf*.json
# 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
testdata/
# Ignore generated files
**/pnpm-lock.yaml
# Ignore generated JSON (e.g. examples/examples.gen.json).
**/*.gen.json
# Everything in site/ is formatted by Biome. For the rest of the repo though, we
# need broader language support.
site/
+6 -12
View File
@@ -2,19 +2,13 @@
# by Prettier.
helm/**/templates/*.yaml
# Terraform state files used in tests, these are automatically generated.
# Example: provisioner/terraform/testdata/instance-id/instance-id.tfstate.json
**/testdata/**/*.tf*.json
# 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
testdata/
# Ignore generated files
**/pnpm-lock.yaml
# Ignore generated JSON (e.g. examples/examples.gen.json).
**/*.gen.json
# Everything in site/ is formatted by Biome. For the rest of the repo though, we
# need broader language support.
site/
+3 -3
View File
@@ -4,13 +4,13 @@
printWidth: 80
proseWrap: always
trailingComma: all
useTabs: false
useTabs: true
tabWidth: 2
overrides:
- files:
- README.md
- docs/api/**/*.md
- docs/cli/**/*.md
- docs/reference/api/**/*.md
- docs/reference/cli/**/*.md
- docs/changelogs/*.md
- .github/**/*.{yaml,yml,toml}
- scripts/**/*.{yaml,yml,toml}
+14 -13
View File
@@ -1,15 +1,16 @@
{
"recommendations": [
"github.vscode-codeql",
"golang.go",
"hashicorp.terraform",
"esbenp.prettier-vscode",
"foxundermoon.shell-format",
"emeraldwalk.runonsave",
"zxh404.vscode-proto3",
"redhat.vscode-yaml",
"streetsidesoftware.code-spell-checker",
"dbaeumer.vscode-eslint",
"EditorConfig.EditorConfig"
]
"recommendations": [
"github.vscode-codeql",
"golang.go",
"hashicorp.terraform",
"esbenp.prettier-vscode",
"foxundermoon.shell-format",
"emeraldwalk.runonsave",
"zxh404.vscode-proto3",
"redhat.vscode-yaml",
"tekumara.typos-vscode",
"EditorConfig.EditorConfig",
"biomejs.biome",
"bradlc.vscode-tailwindcss"
]
}
+38
View File
@@ -0,0 +1,38 @@
{
// For info about snippets, visit https://code.visualstudio.com/docs/editor/userdefinedsnippets
"admonition": {
"prefix": "#callout",
"body": [
"<blockquote class=\"admonition ${1|caution,important,note,tip,warning|}\">\n",
"${TM_SELECTED_TEXT:${2:add info here}}\n",
"</blockquote>\n"
],
"description": "callout admonition caution info note tip warning"
},
"fenced code block": {
"prefix": "#codeblock",
"body": ["```${1|apache,bash,console,diff,Dockerfile,env,go,hcl,ini,json,lisp,md,powershell,shell,sql,text,tf,tsx,yaml|}", "${TM_SELECTED_TEXT}$0", "```"],
"description": "fenced code block"
},
"image": {
"prefix": "#image",
"body": "![${TM_SELECTED_TEXT:${1:alt}}](${2:url})$0",
"description": "image"
},
"tabs": {
"prefix": "#tabs",
"body": [
"<div class=\"tabs\">\n",
"${1:optional description}\n",
"## ${2:tab title}\n",
"${TM_SELECTED_TEXT:${3:first tab content}}\n",
"## ${4:tab title}\n",
"${5:second tab content}\n",
"## ${6:tab title}\n",
"${7:third tab content}\n",
"</div>\n"
],
"description": "tabs"
}
}
+59 -225
View File
@@ -1,227 +1,61 @@
{
"cSpell.words": [
"afero",
"agentsdk",
"apps",
"ASKPASS",
"authcheck",
"autostop",
"awsidentity",
"bodyclose",
"buildinfo",
"buildname",
"circbuf",
"cliflag",
"cliui",
"codecov",
"coderd",
"coderdenttest",
"coderdtest",
"codersdk",
"contravariance",
"cronstrue",
"databasefake",
"dbgen",
"dbmem",
"dbtype",
"DERP",
"derphttp",
"derpmap",
"devel",
"devtunnel",
"dflags",
"drpc",
"drpcconn",
"drpcmux",
"drpcserver",
"Dsts",
"embeddedpostgres",
"enablements",
"enterprisemeta",
"errgroup",
"eventsourcemock",
"externalauth",
"Failf",
"fatih",
"Formik",
"gitauth",
"gitsshkey",
"goarch",
"gographviz",
"goleak",
"gonet",
"gossh",
"gsyslog",
"GTTY",
"hashicorp",
"hclsyntax",
"httpapi",
"httpmw",
"idtoken",
"Iflag",
"incpatch",
"initialisms",
"ipnstate",
"isatty",
"Jobf",
"Keygen",
"kirsle",
"Kubernetes",
"ldflags",
"magicsock",
"manifoldco",
"mapstructure",
"mattn",
"mitchellh",
"moby",
"namesgenerator",
"namespacing",
"netaddr",
"netip",
"netmap",
"netns",
"netstack",
"nettype",
"nfpms",
"nhooyr",
"nmcfg",
"nolint",
"nosec",
"ntqry",
"OIDC",
"oneof",
"opty",
"paralleltest",
"parameterscopeid",
"pqtype",
"prometheusmetrics",
"promhttp",
"protobuf",
"provisionerd",
"provisionerdserver",
"provisionersdk",
"ptty",
"ptys",
"ptytest",
"quickstart",
"reconfig",
"replicasync",
"retrier",
"rpty",
"SCIM",
"sdkproto",
"sdktrace",
"Signup",
"slogtest",
"sourcemapped",
"spinbutton",
"Srcs",
"stdbuf",
"stretchr",
"STTY",
"stuntest",
"tailbroker",
"tailcfg",
"tailexchange",
"tailnet",
"tailnettest",
"Tailscale",
"tanstack",
"tbody",
"TCGETS",
"tcpip",
"TCSETS",
"templateversions",
"testdata",
"testid",
"testutil",
"tfexec",
"tfjson",
"tfplan",
"tfstate",
"thead",
"tios",
"tmpdir",
"tokenconfig",
"Topbar",
"tparallel",
"trialer",
"trimprefix",
"tsdial",
"tslogger",
"tstun",
"turnconn",
"typegen",
"typesafe",
"unconvert",
"Untar",
"Userspace",
"VMID",
"walkthrough",
"weblinks",
"webrtc",
"wgcfg",
"wgconfig",
"wgengine",
"wgmonitor",
"wgnet",
"workspaceagent",
"workspaceagents",
"workspaceapp",
"workspaceapps",
"workspacebuilds",
"workspacename",
"wsjson",
"xerrors",
"xlarge",
"xsmall",
"yamux"
],
"cSpell.ignorePaths": ["site/package.json", ".vscode/settings.json"],
"emeraldwalk.runonsave": {
"commands": [
{
"match": "database/queries/*.sql",
"cmd": "make gen"
},
{
"match": "provisionerd/proto/provisionerd.proto",
"cmd": "make provisionerd/proto/provisionerd.pb.go"
}
]
},
"eslint.workingDirectories": ["./site"],
"search.exclude": {
"**.pb.go": true,
"**/*.gen.json": true,
"**/testdata/*": true,
"coderd/apidoc/**": true,
"docs/api/*.md": true,
"docs/templates/*.md": true,
"LICENSE": true,
"scripts/metricsdocgen/metrics": 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.coverageDecorator": {
"type": "gutter",
"coveredGutterStyle": "blockgreen",
"uncoveredGutterStyle": "blockred"
},
// The codersdk is used by coderd another other packages extensively.
// To reduce redundancy in tests, it's covered by other packages.
// Since package coverage pairing can't be defined, all packages cover
// all other packages.
"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",
// Playwright tests in VSCode will open a browser to live "view" the test.
"playwright.reuseBrowser": true
"emeraldwalk.runonsave": {
"commands": [
{
"match": "database/queries/*.sql",
"cmd": "make gen"
},
{
"match": "provisionerd/proto/provisionerd.proto",
"cmd": "make provisionerd/proto/provisionerd.pb.go"
}
]
},
"search.exclude": {
"**.pb.go": true,
"**/*.gen.json": true,
"**/testdata/*": true,
"coderd/apidoc/**": true,
"docs/reference/api/*.md": true,
"docs/reference/cli/*.md": true,
"docs/templates/*.md": true,
"LICENSE": true,
"scripts/metricsdocgen/metrics": 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.coverageDecorator": {
"type": "gutter",
"coveredGutterStyle": "blockgreen",
"uncoveredGutterStyle": "blockred"
},
// The codersdk is used by coderd another other packages extensively.
// To reduce redundancy in tests, it's covered by other packages.
// Since package coverage pairing can't be defined, all packages cover
// all other packages.
"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",
// Playwright tests in VSCode will open a browser to live "view" the test.
"playwright.reuseBrowser": true,
"[javascript][javascriptreact][json][jsonc][typescript][typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit"
// "source.organizeImports.biome": "explicit"
}
},
"[css][html][markdown][yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typos.config": ".github/workflows/typos.toml"
}
+6
View File
@@ -0,0 +1,6 @@
# These APIs are versioned, so any changes need to be carefully reviewed for whether
# to bump API major or minor versions.
agent/proto/ @spikecurtis @johnstcn
tailnet/proto/ @spikecurtis @johnstcn
vpn/vpn.proto @spikecurtis @johnstcn
vpn/version.go @spikecurtis @johnstcn
+1
View File
@@ -0,0 +1 @@
[https://coder.com/docs/coder-oss/latest/contributing/CODE_OF_CONDUCT](https://coder.com/docs/contributing/CODE_OF_CONDUCT)
+108 -100
View File
@@ -36,6 +36,7 @@ GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
GOOS_BIN_EXT := $(if $(filter windows, $(GOOS)),.exe,)
VERSION := $(shell ./scripts/version.sh)
POSTGRES_VERSION ?= 16
# Use the highest ZSTD compression level in CI.
ifdef CI
@@ -78,8 +79,12 @@ PACKAGE_OS_ARCHES := linux_amd64 linux_armv7 linux_arm64
# All architectures we build Docker images for (Linux only).
DOCKER_ARCHES := amd64 arm64 armv7
# All ${OS}_${ARCH} combos we build the desktop dylib for.
DYLIB_ARCHES := darwin_amd64 darwin_arm64
# Computed variables based on the above.
CODER_SLIM_BINARIES := $(addprefix build/coder-slim_$(VERSION)_,$(OS_ARCHES))
CODER_DYLIBS := $(foreach os_arch, $(DYLIB_ARCHES), build/coder-vpn_$(VERSION)_$(os_arch).dylib)
CODER_FAT_BINARIES := $(addprefix build/coder_$(VERSION)_,$(OS_ARCHES))
CODER_ALL_BINARIES := $(CODER_SLIM_BINARIES) $(CODER_FAT_BINARIES)
CODER_TAR_GZ_ARCHIVES := $(foreach os_arch, $(ARCHIVE_TAR_GZ), build/coder_$(VERSION)_$(os_arch).tar.gz)
@@ -237,6 +242,25 @@ $(CODER_ALL_BINARIES): go.mod go.sum \
cp "$@" "./site/out/bin/coder-$$os-$$arch$$dot_ext"
fi
# This task builds Coder Desktop dylibs
$(CODER_DYLIBS): go.mod go.sum $(GO_SRC_FILES)
@if [ "$(shell uname)" = "Darwin" ]; then
$(get-mode-os-arch-ext)
./scripts/build_go.sh \
--os "$$os" \
--arch "$$arch" \
--version "$(VERSION)" \
--output "$@" \
--dylib
else
echo "ERROR: Can't build dylib on non-Darwin OS" 1>&2
exit 1
fi
# This task builds both dylibs
build/coder-dylib: $(CODER_DYLIBS)
# This task builds all archives. It parses the target name to get the metadata
# for the build, so it must be specified in this format:
# build/coder_${version}_${os}_${arch}.${format}
@@ -390,25 +414,30 @@ BOLD := $(shell tput bold 2>/dev/null)
GREEN := $(shell tput setaf 2 2>/dev/null)
RESET := $(shell tput sgr0 2>/dev/null)
fmt: fmt/eslint fmt/prettier fmt/terraform fmt/shfmt fmt/go
fmt: fmt/ts fmt/go fmt/terraform fmt/shfmt fmt/prettier
.PHONY: fmt
fmt/go:
go mod tidy
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/go$(RESET)"
# VS Code users should check out
# https://github.com/mvdan/gofumpt#visual-studio-code
go run mvdan.cc/gofumpt@v0.4.0 -w -l .
.PHONY: fmt/go
fmt/eslint:
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/eslint$(RESET)"
fmt/ts:
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/ts$(RESET)"
cd site
pnpm run lint:fix
.PHONY: fmt/eslint
# Avoid writing files in CI to reduce file write activity
ifdef CI
pnpm run check --linter-enabled=false
else
pnpm run check:fix
endif
.PHONY: fmt/ts
fmt/prettier:
fmt/prettier: .prettierignore
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/prettier$(RESET)"
cd site
# Avoid writing files in CI to reduce file write activity
ifdef CI
pnpm run format:check
@@ -441,14 +470,14 @@ lint/site-icons:
lint/ts:
cd site
pnpm i && pnpm lint
pnpm lint
.PHONY: lint/ts
lint/go:
./scripts/check_enterprise_imports.sh
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
./scripts/check_codersdk_imports.sh
linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/contents/Dockerfile | cut -d '=' -f 2)
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver run
.PHONY: lint/go
lint/examples:
@@ -476,33 +505,39 @@ DB_GEN_FILES := \
coderd/database/dbauthz/dbauthz.go \
coderd/database/dbmock/dbmock.go
TAILNETTEST_MOCKS := \
tailnet/tailnettest/coordinatormock.go \
tailnet/tailnettest/coordinateemock.go \
tailnet/tailnettest/workspaceupdatesprovidermock.go \
tailnet/tailnettest/subscriptionmock.go
# all gen targets should be added here and to gen/mark-fresh
gen: \
tailnet/proto/tailnet.pb.go \
agent/proto/agent.pb.go \
provisionersdk/proto/provisioner.pb.go \
provisionerd/proto/provisionerd.pb.go \
vpn/vpn.pb.go \
coderd/database/dump.sql \
$(DB_GEN_FILES) \
site/src/api/typesGenerated.ts \
coderd/rbac/object_gen.go \
codersdk/rbacresources_gen.go \
docs/admin/prometheus.md \
docs/cli.md \
docs/admin/audit-logs.md \
site/src/api/rbacresourcesGenerated.ts \
site/src/api/countriesGenerated.ts \
docs/admin/integrations/prometheus.md \
docs/reference/cli/index.md \
docs/admin/security/audit-logs.md \
coderd/apidoc/swagger.json \
.prettierignore.include \
.prettierignore \
provisioner/terraform/testdata/version \
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
$(TAILNETTEST_MOCKS) \
coderd/database/pubsub/psmock/psmock.go
.PHONY: gen
# Mark all generated files as fresh so make thinks they're up-to-date. This is
@@ -513,26 +548,27 @@ gen/mark-fresh:
agent/proto/agent.pb.go \
provisionersdk/proto/provisioner.pb.go \
provisionerd/proto/provisionerd.pb.go \
vpn/vpn.pb.go \
coderd/database/dump.sql \
$(DB_GEN_FILES) \
site/src/api/typesGenerated.ts \
coderd/rbac/object_gen.go \
docs/admin/prometheus.md \
docs/cli.md \
docs/admin/audit-logs.md \
codersdk/rbacresources_gen.go \
site/src/api/rbacresourcesGenerated.ts \
site/src/api/countriesGenerated.ts \
docs/admin/integrations/prometheus.md \
docs/reference/cli/index.md \
docs/admin/security/audit-logs.md \
coderd/apidoc/swagger.json \
.prettierignore.include \
.prettierignore \
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 \
"
$(TAILNETTEST_MOCKS) \
coderd/database/pubsub/psmock/psmock.go \
"
for file in $$files; do
echo "$$file"
if [ ! -f "$$file" ]; then
@@ -562,7 +598,7 @@ coderd/database/dbmock/dbmock.go: coderd/database/db.go coderd/database/querier.
coderd/database/pubsub/psmock/psmock.go: coderd/database/pubsub/pubsub.go
go generate ./coderd/database/pubsub/psmock
tailnet/tailnettest/coordinatormock.go tailnet/tailnettest/multiagentmock.go tailnet/tailnettest/coordinateemock.go: tailnet/coordinator.go tailnet/multiagent.go
$(TAILNETTEST_MOCKS): tailnet/coordinator.go tailnet/service.go
go generate ./tailnet/tailnettest/
tailnet/proto/tailnet.pb.go: tailnet/proto/tailnet.proto
@@ -597,10 +633,15 @@ provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
--go-drpc_opt=paths=source_relative \
./provisionerd/proto/provisionerd.proto
vpn/vpn.pb.go: vpn/vpn.proto
protoc \
--go_out=. \
--go_opt=paths=source_relative \
./vpn/vpn.proto
site/src/api/typesGenerated.ts: $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
go run ./scripts/apitypings/ > $@
./scripts/pnpm_install.sh
pnpm exec prettier --write "$@"
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
cd site
@@ -610,36 +651,45 @@ site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisio
site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
go run ./scripts/gensite/ -icons "$@"
./scripts/pnpm_install.sh
pnpm exec prettier --write "$@"
pnpm -C site/ exec biome format --write src/theme/icons.json
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 rbac > coderd/rbac/object_gen.go
coderd/rbac/object_gen.go: scripts/typegen/rbacobject.gotmpl scripts/typegen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
go run scripts/typegen/main.go rbac object > coderd/rbac/object_gen.go
codersdk/rbacresources_gen.go: scripts/rbacgen/main.go coderd/rbac/object.go
go run scripts/rbacgen/main.go codersdk > codersdk/rbacresources_gen.go
codersdk/rbacresources_gen.go: scripts/typegen/codersdk.gotmpl scripts/typegen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
# Do no overwrite codersdk/rbacresources_gen.go directly, as it would make the file empty, breaking
# the `codersdk` package and any parallel build targets.
go run scripts/typegen/main.go rbac codersdk > /tmp/rbacresources_gen.go
mv /tmp/rbacresources_gen.go codersdk/rbacresources_gen.go
docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
site/src/api/rbacresourcesGenerated.ts: scripts/typegen/codersdk.gotmpl scripts/typegen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
go run scripts/typegen/main.go rbac typescript > "$@"
site/src/api/countriesGenerated.ts: scripts/typegen/countries.tstmpl scripts/typegen/main.go codersdk/countries.go
go run scripts/typegen/main.go countries > "$@"
docs/admin/integrations/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
go run scripts/metricsdocgen/main.go
./scripts/pnpm_install.sh
pnpm exec prettier --write ./docs/admin/prometheus.md
pnpm exec prettier --write ./docs/admin/integrations/prometheus.md
docs/cli.md: scripts/clidocgen/main.go examples/examples.gen.json $(GO_SRC_FILES)
docs/reference/cli/index.md: scripts/clidocgen/main.go examples/examples.gen.json $(GO_SRC_FILES)
CI=true BASE_PATH="." go run ./scripts/clidocgen
./scripts/pnpm_install.sh
pnpm exec prettier --write ./docs/cli.md ./docs/cli/*.md ./docs/manifest.json
pnpm exec prettier --write ./docs/reference/cli/index.md ./docs/reference/cli/*.md ./docs/manifest.json
docs/admin/audit-logs.md: coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
docs/admin/security/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
./scripts/pnpm_install.sh
pnpm exec prettier --write ./docs/admin/audit-logs.md
pnpm exec prettier --write ./docs/admin/security/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) $(DB_GEN_FILES) .swaggo docs/manifest.json coderd/rbac/object_gen.go
./scripts/apidocgen/generate.sh
./scripts/pnpm_install.sh
pnpm exec prettier --write ./docs/api ./docs/manifest.json ./coderd/apidoc/swagger.json
pnpm exec prettier --write ./docs/reference/api ./docs/manifest.json ./coderd/apidoc/swagger.json
update-golden-files: \
cli/testdata/.gen-golden \
@@ -650,6 +700,7 @@ update-golden-files: \
enterprise/tailnet/testdata/.gen-golden \
tailnet/testdata/.gen-golden \
coderd/.gen-golden \
coderd/notifications/.gen-golden \
provisioner/terraform/testdata/.gen-golden
.PHONY: update-golden-files
@@ -681,6 +732,10 @@ coderd/.gen-golden: $(wildcard coderd/testdata/*/*.golden) $(GO_SRC_FILES) $(wil
go test ./coderd -run="Test.*Golden$$" -update
touch "$@"
coderd/notifications/.gen-golden: $(wildcard coderd/notifications/testdata/*/*.golden) $(GO_SRC_FILES) $(wildcard coderd/notifications/*_test.go)
go test ./coderd/notifications -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 "$@"
@@ -695,23 +750,6 @@ scripts/ci-report/testdata/.gen-golden: $(wildcard scripts/ci-report/testdata/*)
go test ./scripts/ci-report -run=TestOutputMatchesGoldenFile -update
touch "$@"
# Generate a prettierrc for the site package that uses relative paths for
# overrides. This allows us to share the same prettier config between the
# site and the root of the repo.
site/.prettierrc.yaml: .prettierrc.yaml
. ./scripts/lib.sh
dependencies yq
echo "# Code generated by Makefile (../$<). DO NOT EDIT." > "$@"
echo "" >> "$@"
# Replace all listed override files with relative paths inside site/.
# - ./ -> ../
# - ./site -> ./
yq \
'.overrides[].files |= map(. | sub("^./"; "") | sub("^"; "../") | sub("../site/"; "./") | sub("../!"; "!../"))' \
"$<" >> "$@"
# Combine .gitignore with .prettierignore.include to generate .prettierignore.
.prettierignore: .gitignore .prettierignore.include
echo "# Code generated by Makefile ($^). DO NOT EDIT." > "$@"
@@ -721,40 +759,6 @@ site/.prettierrc.yaml: .prettierrc.yaml
cat "$$f" >> "$@"
done
# Generate ignore files based on gitignore into the site directory. We turn all
# rules into relative paths for the `site/` directory (where applicable),
# following the pattern format defined by git:
# https://git-scm.com/docs/gitignore#_pattern_format
#
# This is done for compatibility reasons, see:
# https://github.com/prettier/prettier/issues/8048
# https://github.com/prettier/prettier/issues/8506
# https://github.com/prettier/prettier/issues/8679
site/.eslintignore site/.prettierignore: .prettierignore Makefile
rm -f "$@"
touch "$@"
# Skip generated by header, inherit `.prettierignore` header as-is.
while read -r rule; do
# Remove leading ! if present to simplify rule, added back at the end.
tmp="$${rule#!}"
ignore="$${rule%"$$tmp"}"
rule="$$tmp"
case "$$rule" in
# Comments or empty lines (include).
\#*|'') ;;
# Generic rules (include).
\*\**) ;;
# Site prefixed rules (include).
site/*) rule="$${rule#site/}";;
./site/*) rule="$${rule#./site/}";;
# Rules that are non-generic and don't start with site (rewrite).
/*) rule=.."$$rule";;
*/?*) rule=../"$$rule";;
*) ;;
esac
echo "$${ignore}$${rule}" >> "$@"
done < "$<"
test:
$(GIT_FLAGS) gotestsum --format standard-quiet -- -v -short -count=1 ./...
.PHONY: test
@@ -792,7 +796,7 @@ sqlc-vet: test-postgres-docker
test-postgres: test-postgres-docker
# The postgres test is prone to failure, so we limit parallelism for
# more consistent execution.
$(GIT_FLAGS) DB=ci DB_FROM=$(shell go run scripts/migrate-ci/main.go) gotestsum \
$(GIT_FLAGS) DB=ci gotestsum \
--junitfile="gotests.xml" \
--jsonfile="gotests.json" \
--packages="./..." -- \
@@ -814,7 +818,7 @@ test-migrations: test-postgres-docker
# NOTE: we set --memory to the same size as a GitHub runner.
test-postgres-docker:
docker rm -f test-postgres-docker || true
docker rm -f test-postgres-docker-${POSTGRES_VERSION} || true
docker run \
--env POSTGRES_PASSWORD=postgres \
--env POSTGRES_USER=postgres \
@@ -822,11 +826,11 @@ test-postgres-docker:
--env PGDATA=/tmp \
--tmpfs /tmp \
--publish 5432:5432 \
--name test-postgres-docker \
--name test-postgres-docker-${POSTGRES_VERSION} \
--restart no \
--detach \
--memory 16GB \
gcr.io/coder-dev-1/postgres:13 \
gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} \
-c shared_buffers=1GB \
-c work_mem=1GB \
-c effective_cache_size=1GB \
@@ -844,7 +848,7 @@ test-postgres-docker:
# Make sure to keep this in sync with test-go-race from .github/workflows/ci.yaml.
test-race:
$(GIT_FLAGS) gotestsum --junitfile="gotests.xml" -- -race -count=1 ./...
$(GIT_FLAGS) gotestsum --junitfile="gotests.xml" -- -race -count=1 -parallel 4 -p 4 ./...
.PHONY: test-race
test-tailnet-integration:
@@ -865,3 +869,7 @@ test-tailnet-integration:
test-clean:
go clean -testcache
.PHONY: test-clean
.PHONY: test-e2e
test-e2e:
cd ./site && DEBUG=pw:api pnpm playwright:test --forbid-only --workers 1
+19 -16
View File
@@ -20,17 +20,19 @@
<br>
<br>
[Quickstart](#quickstart) | [Docs](https://coder.com/docs) | [Why Coder](https://coder.com/why) | [Enterprise](https://coder.com/docs/v2/latest/enterprise)
[Quickstart](#quickstart) | [Docs](https://coder.com/docs) | [Why Coder](https://coder.com/why) | [Premium](https://coder.com/pricing#compare-plans)
[![discord](https://img.shields.io/discord/747933592273027093?label=discord)](https://discord.gg/coder)
[![release](https://img.shields.io/github/v/release/coder/coder)](https://github.com/coder/coder/releases/latest)
[![godoc](https://pkg.go.dev/badge/github.com/coder/coder.svg)](https://pkg.go.dev/github.com/coder/coder)
[![Go Report Card](https://goreportcard.com/badge/github.com/coder/coder)](https://goreportcard.com/report/github.com/coder/coder)
[![Go Report Card](https://goreportcard.com/badge/github.com/coder/coder/v2)](https://goreportcard.com/report/github.com/coder/coder/v2)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9511/badge)](https://www.bestpractices.dev/projects/9511)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/coder/coder/badge)](https://scorecard.dev/viewer/?uri=github.com%2Fcoder%2Fcoder)
[![license](https://img.shields.io/github/license/coder/coder)](./LICENSE)
</div>
[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.
[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 automatically shut down when not used to save on costs. Coder gives engineering teams the flexibility to use the cloud for workloads most beneficial to them.
- Define cloud development environments in Terraform
- EC2 VMs, Kubernetes Pods, Docker Containers, etc.
@@ -53,7 +55,7 @@ curl -L https://coder.com/install.sh | sh
coder server
# Navigate to http://localhost:3000 to create your initial user,
# create a Docker template, and provision a workspace
# create a Docker template and provision a workspace
```
## Install
@@ -69,7 +71,7 @@ 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. Run the install script with `--help` for additional flags.
> See [install](https://coder.com/docs/v2/latest/install) for additional methods.
> See [install](https://coder.com/docs/install) for additional methods.
Once installed, you can start a production deployment with a single command:
@@ -81,27 +83,27 @@ coder server
coder server --postgres-url <url> --access-url <url>
```
Use `coder --help` to get a list of flags and environment variables. Use our [install guides](https://coder.com/docs/v2/latest/install) for a full walkthrough.
Use `coder --help` to get a list of flags and environment variables. Use our [install guides](https://coder.com/docs/install) for a complete walkthrough.
## Documentation
Browse our docs [here](https://coder.com/docs/v2) or visit a specific section below:
Browse our docs [here](https://coder.com/docs) or visit a specific section below:
- [**Templates**](https://coder.com/docs/v2/latest/templates): Templates are written in Terraform and describe the infrastructure for workspaces
- [**Workspaces**](https://coder.com/docs/v2/latest/workspaces): Workspaces contain the IDEs, dependencies, and configuration information needed for software development
- [**IDEs**](https://coder.com/docs/v2/latest/ides): Connect your existing editor to a workspace
- [**Administration**](https://coder.com/docs/v2/latest/admin): Learn how to operate Coder
- [**Enterprise**](https://coder.com/docs/v2/latest/enterprise): Learn about our paid features built for large teams
- [**Templates**](https://coder.com/docs/templates): Templates are written in Terraform and describe the infrastructure for workspaces
- [**Workspaces**](https://coder.com/docs/workspaces): Workspaces contain the IDEs, dependencies, and configuration information needed for software development
- [**IDEs**](https://coder.com/docs/ides): Connect your existing editor to a workspace
- [**Administration**](https://coder.com/docs/admin): Learn how to operate Coder
- [**Premium**](https://coder.com/pricing#compare-plans): Learn about our paid features built for large teams
## Support
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) to provide feedback on in-progress features and chat with the community using Coder!
## Integrations
We are always working on new integrations. Feel free to open an issue to request an integration. Contributions are welcome in any official or community repositories.
We are always working on new integrations. Please feel free to open an issue and ask for an integration. Contributions are welcome in any official or community repositories.
### Official
@@ -111,6 +113,7 @@ We are always working on new integrations. Feel free to open an issue to request
- [**Module Registry**](https://registry.coder.com): Extend development environments with common use-cases
- [**Kubernetes Log Stream**](https://github.com/coder/coder-logstream-kube): Stream Kubernetes Pod events to the Coder startup logs
- [**Self-Hosted VS Code Extension Marketplace**](https://github.com/coder/code-marketplace): A private extension marketplace that works in restricted or airgapped networks integrating with [code-server](https://github.com/coder/code-server).
- [**Setup Coder**](https://github.com/marketplace/actions/setup-coder): An action to setup coder CLI in GitHub workflows.
### Community
@@ -120,9 +123,9 @@ We are always working on new integrations. Feel free to open an issue to request
## Contributing
We are always happy to see new contributors to Coder. If you are new to the Coder codebase, we have
[a guide on how to get started](https://coder.com/docs/v2/latest/CONTRIBUTING). We'd love to see your
[a guide on how to get started](https://coder.com/docs/CONTRIBUTING). We'd love to see your
contributions!
## Hiring
Apply [here](https://cdr.co/github-apply) if you're interested in joining our team.
Apply [here](https://jobs.ashbyhq.com/coder?utm_source=github&utm_medium=readme&utm_campaign=unknown) if you're interested in joining our team.
+163 -219
View File
@@ -3,12 +3,10 @@ package agent
import (
"bytes"
"context"
"encoding/binary"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"net/http"
"net/netip"
"os"
@@ -31,7 +29,6 @@ import (
"golang.org/x/exp/slices"
"golang.org/x/sync/errgroup"
"golang.org/x/xerrors"
"storj.io/drpc"
"tailscale.com/net/speedtest"
"tailscale.com/tailcfg"
"tailscale.com/types/netlogtype"
@@ -82,7 +79,6 @@ type Options struct {
SSHMaxTimeout time.Duration
TailnetListenPort uint16
Subsystems []codersdk.AgentSubsystem
Addresses []netip.Prefix
PrometheusRegistry *prometheus.Registry
ReportMetadataInterval time.Duration
ServiceBannerRefreshInterval time.Duration
@@ -91,10 +87,13 @@ type Options struct {
ModifiedProcesses chan []*agentproc.Process
// ProcessManagementTick is used for testing process priority management.
ProcessManagementTick <-chan time.Time
BlockFileTransfer bool
}
type Client interface {
ConnectRPC(ctx context.Context) (drpc.Conn, error)
ConnectRPC23(ctx context.Context) (
proto.DRPCAgentClient23, tailnetproto.DRPCTailnetClient23, error,
)
RewriteDERPMap(derpMap *tailcfg.DERPMap)
}
@@ -179,11 +178,11 @@ func New(options Options) Agent {
announcementBannersRefreshInterval: options.ServiceBannerRefreshInterval,
sshMaxTimeout: options.SSHMaxTimeout,
subsystems: options.Subsystems,
addresses: options.Addresses,
syscaller: options.Syscaller,
modifiedProcs: options.ModifiedProcesses,
processManagementTick: options.ProcessManagementTick,
logSender: agentsdk.NewLogSender(options.Logger),
blockFileTransfer: options.BlockFileTransfer,
prometheusRegistry: prometheusRegistry,
metrics: newAgentMetrics(prometheusRegistry),
@@ -215,8 +214,8 @@ type agent struct {
portCacheDuration time.Duration
subsystems []codersdk.AgentSubsystem
reconnectingPTYs sync.Map
reconnectingPTYTimeout time.Duration
reconnectingPTYServer *reconnectingpty.Server
// we track 2 contexts and associated cancel functions: "graceful" which is Done when it is time
// to start gracefully shutting down and "hard" which is Done when it is time to close
@@ -239,6 +238,7 @@ type agent struct {
sessionToken atomic.Pointer[string]
sshServer *agentssh.Server
sshMaxTimeout time.Duration
blockFileTransfer bool
lifecycleUpdate chan struct{}
lifecycleReported chan codersdk.WorkspaceAgentLifecycle
@@ -247,12 +247,9 @@ type agent struct {
lifecycleLastReportedIndex int // Keeps track of the last lifecycle state we successfully reported.
network *tailnet.Conn
addresses []netip.Prefix
statsReporter *statsReporter
logSender *agentsdk.LogSender
connCountReconnectingPTY atomic.Int64
prometheusRegistry *prometheus.Registry
// metrics are prometheus registered metrics that will be collected and
// labeled in Coder with the agent + workspace.
@@ -277,6 +274,7 @@ func (a *agent) init() {
AnnouncementBanners: func() *[]codersdk.BannerConfig { return a.announcementBanners.Load() },
UpdateEnv: a.updateCommandEnv,
WorkingDirectory: func() string { return a.manifest.Load().Directory },
BlockFileTransfer: a.blockFileTransfer,
})
if err != nil {
panic(err)
@@ -295,6 +293,13 @@ func (a *agent) init() {
// Register runner metrics. If the prom registry is nil, the metrics
// will not report anywhere.
a.scriptRunner.RegisterMetrics(a.prometheusRegistry)
a.reconnectingPTYServer = reconnectingpty.NewServer(
a.logger.Named("reconnecting-pty"),
a.sshServer,
a.metrics.connectionsTotal, a.metrics.reconnectingPTYErrors,
a.reconnectingPTYTimeout,
)
go a.runLoop()
}
@@ -409,7 +414,7 @@ func (t *trySingleflight) Do(key string, fn func()) {
fn()
}
func (a *agent) reportMetadata(ctx context.Context, conn drpc.Conn) error {
func (a *agent) reportMetadata(ctx context.Context, aAPI proto.DRPCAgentClient23) error {
tickerDone := make(chan struct{})
collectDone := make(chan struct{})
ctx, cancel := context.WithCancel(ctx)
@@ -571,7 +576,6 @@ func (a *agent) reportMetadata(ctx context.Context, conn drpc.Conn) error {
reportTimeout = 30 * time.Second
reportError = make(chan error, 1)
reportInFlight = false
aAPI = proto.NewDRPCAgentClient(conn)
)
for {
@@ -584,10 +588,12 @@ func (a *agent) reportMetadata(ctx context.Context, conn drpc.Conn) error {
updatedMetadata[mr.key] = mr.result
continue
case err := <-reportError:
a.logger.Debug(ctx, "batch update metadata complete", slog.Error(err))
logMsg := "batch update metadata complete"
if err != nil {
a.logger.Debug(ctx, logMsg, slog.Error(err))
return xerrors.Errorf("failed to report metadata: %w", err)
}
a.logger.Debug(ctx, logMsg)
reportInFlight = false
case <-report:
if len(updatedMetadata) == 0 {
@@ -624,8 +630,7 @@ func (a *agent) reportMetadata(ctx context.Context, conn drpc.Conn) error {
// reportLifecycle reports the current lifecycle state once. All state
// changes are reported in order.
func (a *agent) reportLifecycle(ctx context.Context, conn drpc.Conn) error {
aAPI := proto.NewDRPCAgentClient(conn)
func (a *agent) reportLifecycle(ctx context.Context, aAPI proto.DRPCAgentClient23) error {
for {
select {
case <-a.lifecycleUpdate:
@@ -707,8 +712,7 @@ func (a *agent) setLifecycle(state codersdk.WorkspaceAgentLifecycle) {
// fetchServiceBannerLoop fetches the service banner on an interval. It will
// not be fetched immediately; the expectation is that it is primed elsewhere
// (and must be done before the session actually starts).
func (a *agent) fetchServiceBannerLoop(ctx context.Context, conn drpc.Conn) error {
aAPI := proto.NewDRPCAgentClient(conn)
func (a *agent) fetchServiceBannerLoop(ctx context.Context, aAPI proto.DRPCAgentClient23) error {
ticker := time.NewTicker(a.announcementBannersRefreshInterval)
defer ticker.Stop()
for {
@@ -734,7 +738,7 @@ func (a *agent) fetchServiceBannerLoop(ctx context.Context, conn drpc.Conn) erro
}
func (a *agent) run() (retErr error) {
// This allows the agent to refresh it's token if necessary.
// This allows the agent to refresh its token if necessary.
// For instance identity this is required, since the instance
// may not have re-provisioned, but a new agent ID was created.
sessionToken, err := a.exchangeToken(a.hardCtx)
@@ -744,12 +748,12 @@ func (a *agent) run() (retErr error) {
a.sessionToken.Store(&sessionToken)
// ConnectRPC returns the dRPC connection we use for the Agent and Tailnet v2+ APIs
conn, err := a.client.ConnectRPC(a.hardCtx)
aAPI, tAPI, err := a.client.ConnectRPC23(a.hardCtx)
if err != nil {
return err
}
defer func() {
cErr := conn.Close()
cErr := aAPI.DRPCConn().Close()
if cErr != nil {
a.logger.Debug(a.hardCtx, "error closing drpc connection", slog.Error(err))
}
@@ -758,11 +762,10 @@ func (a *agent) run() (retErr error) {
// A lot of routines need the agent API / tailnet API connection. We run them in their own
// goroutines in parallel, but errors in any routine will cause them all to exit so we can
// redial the coder server and retry.
connMan := newAPIConnRoutineManager(a.gracefulCtx, a.hardCtx, a.logger, conn)
connMan := newAPIConnRoutineManager(a.gracefulCtx, a.hardCtx, a.logger, aAPI, tAPI)
connMan.start("init notification banners", gracefulShutdownBehaviorStop,
func(ctx context.Context, conn drpc.Conn) error {
aAPI := proto.NewDRPCAgentClient(conn)
connMan.startAgentAPI("init notification banners", gracefulShutdownBehaviorStop,
func(ctx context.Context, aAPI proto.DRPCAgentClient23) error {
bannersProto, err := aAPI.GetAnnouncementBanners(ctx, &proto.GetAnnouncementBannersRequest{})
if err != nil {
return xerrors.Errorf("fetch service banner: %w", err)
@@ -778,9 +781,9 @@ func (a *agent) run() (retErr error) {
// sending logs gets gracefulShutdownBehaviorRemain because we want to send logs generated by
// shutdown scripts.
connMan.start("send logs", gracefulShutdownBehaviorRemain,
func(ctx context.Context, conn drpc.Conn) error {
err := a.logSender.SendLoop(ctx, proto.NewDRPCAgentClient(conn))
connMan.startAgentAPI("send logs", gracefulShutdownBehaviorRemain,
func(ctx context.Context, aAPI proto.DRPCAgentClient23) error {
err := a.logSender.SendLoop(ctx, aAPI)
if xerrors.Is(err, agentsdk.LogLimitExceededError) {
// we don't want this error to tear down the API connection and propagate to the
// other routines that use the API. The LogSender has already dropped a warning
@@ -792,10 +795,10 @@ func (a *agent) run() (retErr error) {
// part of graceful shut down is reporting the final lifecycle states, e.g "ShuttingDown" so the
// lifecycle reporting has to be via gracefulShutdownBehaviorRemain
connMan.start("report lifecycle", gracefulShutdownBehaviorRemain, a.reportLifecycle)
connMan.startAgentAPI("report lifecycle", gracefulShutdownBehaviorRemain, a.reportLifecycle)
// metadata reporting can cease as soon as we start gracefully shutting down
connMan.start("report metadata", gracefulShutdownBehaviorStop, a.reportMetadata)
connMan.startAgentAPI("report metadata", gracefulShutdownBehaviorStop, a.reportMetadata)
// channels to sync goroutines below
// handle manifest
@@ -816,55 +819,55 @@ func (a *agent) run() (retErr error) {
networkOK := newCheckpoint(a.logger)
manifestOK := newCheckpoint(a.logger)
connMan.start("handle manifest", gracefulShutdownBehaviorStop, a.handleManifest(manifestOK))
connMan.startAgentAPI("handle manifest", gracefulShutdownBehaviorStop, a.handleManifest(manifestOK))
connMan.start("app health reporter", gracefulShutdownBehaviorStop,
func(ctx context.Context, conn drpc.Conn) error {
connMan.startAgentAPI("app health reporter", gracefulShutdownBehaviorStop,
func(ctx context.Context, aAPI proto.DRPCAgentClient23) error {
if err := manifestOK.wait(ctx); err != nil {
return xerrors.Errorf("no manifest: %w", err)
}
manifest := a.manifest.Load()
NewWorkspaceAppHealthReporter(
a.logger, manifest.Apps, agentsdk.AppHealthPoster(proto.NewDRPCAgentClient(conn)),
a.logger, manifest.Apps, agentsdk.AppHealthPoster(aAPI),
)(ctx)
return nil
})
connMan.start("create or update network", gracefulShutdownBehaviorStop,
connMan.startAgentAPI("create or update network", gracefulShutdownBehaviorStop,
a.createOrUpdateNetwork(manifestOK, networkOK))
connMan.start("coordination", gracefulShutdownBehaviorStop,
func(ctx context.Context, conn drpc.Conn) error {
connMan.startTailnetAPI("coordination", gracefulShutdownBehaviorStop,
func(ctx context.Context, tAPI tailnetproto.DRPCTailnetClient23) error {
if err := networkOK.wait(ctx); err != nil {
return xerrors.Errorf("no network: %w", err)
}
return a.runCoordinator(ctx, conn, a.network)
return a.runCoordinator(ctx, tAPI, a.network)
},
)
connMan.start("derp map subscriber", gracefulShutdownBehaviorStop,
func(ctx context.Context, conn drpc.Conn) error {
connMan.startTailnetAPI("derp map subscriber", gracefulShutdownBehaviorStop,
func(ctx context.Context, tAPI tailnetproto.DRPCTailnetClient23) error {
if err := networkOK.wait(ctx); err != nil {
return xerrors.Errorf("no network: %w", err)
}
return a.runDERPMapSubscriber(ctx, conn, a.network)
return a.runDERPMapSubscriber(ctx, tAPI, a.network)
})
connMan.start("fetch service banner loop", gracefulShutdownBehaviorStop, a.fetchServiceBannerLoop)
connMan.startAgentAPI("fetch service banner loop", gracefulShutdownBehaviorStop, a.fetchServiceBannerLoop)
connMan.start("stats report loop", gracefulShutdownBehaviorStop, func(ctx context.Context, conn drpc.Conn) error {
connMan.startAgentAPI("stats report loop", gracefulShutdownBehaviorStop, func(ctx context.Context, aAPI proto.DRPCAgentClient23) error {
if err := networkOK.wait(ctx); err != nil {
return xerrors.Errorf("no network: %w", err)
}
return a.statsReporter.reportLoop(ctx, proto.NewDRPCAgentClient(conn))
return a.statsReporter.reportLoop(ctx, aAPI)
})
return connMan.wait()
}
// handleManifest returns a function that fetches and processes the manifest
func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context, conn drpc.Conn) error {
return func(ctx context.Context, conn drpc.Conn) error {
func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context, aAPI proto.DRPCAgentClient23) error {
return func(ctx context.Context, aAPI proto.DRPCAgentClient23) error {
var (
sentResult = false
err error
@@ -874,7 +877,6 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
manifestOK.complete(err)
}
}()
aAPI := proto.NewDRPCAgentClient(conn)
mp, err := aAPI.GetManifest(ctx, &proto.GetManifestRequest{})
if err != nil {
return xerrors.Errorf("fetch metadata: %w", err)
@@ -935,7 +937,7 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
}
}
err = a.scriptRunner.Init(manifest.Scripts)
err = a.scriptRunner.Init(manifest.Scripts, aAPI.ScriptCompleted)
if err != nil {
return xerrors.Errorf("init script runner: %w", err)
}
@@ -943,9 +945,7 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
start := time.Now()
// here we use the graceful context because the script runner is not directly tied
// to the agent API.
err := a.scriptRunner.Execute(a.gracefulCtx, func(script codersdk.WorkspaceAgentScript) bool {
return script.RunOnStart
})
err := a.scriptRunner.Execute(a.gracefulCtx, agentscripts.ExecuteStartScripts)
// Measure the time immediately after the script has finished
dur := time.Since(start).Seconds()
if err != nil {
@@ -976,8 +976,8 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
// createOrUpdateNetwork waits for the manifest to be set using manifestOK, then creates or updates
// the tailnet using the information in the manifest
func (a *agent) createOrUpdateNetwork(manifestOK, networkOK *checkpoint) func(context.Context, drpc.Conn) error {
return func(ctx context.Context, _ drpc.Conn) (retErr error) {
func (a *agent) createOrUpdateNetwork(manifestOK, networkOK *checkpoint) func(context.Context, proto.DRPCAgentClient23) error {
return func(ctx context.Context, _ proto.DRPCAgentClient23) (retErr error) {
if err := manifestOK.wait(ctx); err != nil {
return xerrors.Errorf("no manifest: %w", err)
}
@@ -1108,18 +1108,14 @@ func (a *agent) updateCommandEnv(current []string) (updated []string, err error)
return updated, nil
}
func (a *agent) wireguardAddresses(agentID uuid.UUID) []netip.Prefix {
if len(a.addresses) == 0 {
return []netip.Prefix{
// This is the IP that should be used primarily.
netip.PrefixFrom(tailnet.IPFromUUID(agentID), 128),
// We also listen on the legacy codersdk.WorkspaceAgentIP. This
// allows for a transition away from wsconncache.
netip.PrefixFrom(workspacesdk.AgentIP, 128),
}
func (*agent) wireguardAddresses(agentID uuid.UUID) []netip.Prefix {
return []netip.Prefix{
// This is the IP that should be used primarily.
tailnet.TailscaleServicePrefix.PrefixFromUUID(agentID),
// We'll need this address for CoderVPN, but aren't using it from clients until that feature
// is ready
tailnet.CoderServicePrefix.PrefixFromUUID(agentID),
}
return a.addresses
}
func (a *agent) trackGoroutine(fn func()) error {
@@ -1137,11 +1133,19 @@ func (a *agent) trackGoroutine(fn func()) error {
}
func (a *agent) createTailnet(ctx context.Context, agentID uuid.UUID, derpMap *tailcfg.DERPMap, derpForceWebSockets, disableDirectConnections bool) (_ *tailnet.Conn, err error) {
// Inject `CODER_AGENT_HEADER` into the DERP header.
var header http.Header
if client, ok := a.client.(*agentsdk.Client); ok {
if headerTransport, ok := client.SDK.HTTPClient.Transport.(*codersdk.HeaderTransport); ok {
header = headerTransport.Header
}
}
network, err := tailnet.NewConn(&tailnet.Options{
ID: agentID,
Addresses: a.wireguardAddresses(agentID),
DERPMap: derpMap,
DERPForceWebSockets: derpForceWebSockets,
DERPHeader: &header,
Logger: a.logger.Named("net.tailnet"),
ListenPort: a.tailnetListenPort,
BlockEndpoints: disableDirectConnections,
@@ -1180,55 +1184,12 @@ func (a *agent) createTailnet(ctx context.Context, agentID uuid.UUID, derpMap *t
}
}()
if err = a.trackGoroutine(func() {
logger := a.logger.Named("reconnecting-pty")
var wg sync.WaitGroup
for {
conn, err := reconnectingPTYListener.Accept()
if err != nil {
if !a.isClosed() {
logger.Debug(ctx, "accept pty failed", slog.Error(err))
}
break
}
clog := logger.With(
slog.F("remote", conn.RemoteAddr().String()),
slog.F("local", conn.LocalAddr().String()))
clog.Info(ctx, "accepted conn")
wg.Add(1)
closed := make(chan struct{})
go func() {
select {
case <-closed:
case <-a.hardCtx.Done():
_ = conn.Close()
}
wg.Done()
}()
go func() {
defer close(closed)
// This cannot use a JSON decoder, since that can
// buffer additional data that is required for the PTY.
rawLen := make([]byte, 2)
_, err = conn.Read(rawLen)
if err != nil {
return
}
length := binary.LittleEndian.Uint16(rawLen)
data := make([]byte, length)
_, err = conn.Read(data)
if err != nil {
return
}
var msg workspacesdk.AgentReconnectingPTYInit
err = json.Unmarshal(data, &msg)
if err != nil {
logger.Warn(ctx, "failed to unmarshal init", slog.F("raw", data))
return
}
_ = a.handleReconnectingPTY(ctx, clog, msg, conn)
}()
rPTYServeErr := a.reconnectingPTYServer.Serve(a.gracefulCtx, a.hardCtx, reconnectingPTYListener)
if rPTYServeErr != nil &&
a.gracefulCtx.Err() == nil &&
!strings.Contains(rPTYServeErr.Error(), "use of closed network connection") {
a.logger.Error(ctx, "error serving reconnecting PTY", slog.Error(err))
}
wg.Wait()
}); err != nil {
return nil, err
}
@@ -1307,9 +1268,9 @@ func (a *agent) createTailnet(ctx context.Context, agentID uuid.UUID, derpMap *t
_ = server.Close()
}()
err := server.Serve(apiListener)
if err != nil && !xerrors.Is(err, http.ErrServerClosed) && !strings.Contains(err.Error(), "use of closed network connection") {
a.logger.Critical(ctx, "serve HTTP API server", slog.Error(err))
apiServErr := server.Serve(apiListener)
if apiServErr != nil && !xerrors.Is(apiServErr, http.ErrServerClosed) && !strings.Contains(apiServErr.Error(), "use of closed network connection") {
a.logger.Critical(ctx, "serve HTTP API server", slog.Error(apiServErr))
}
}); err != nil {
return nil, err
@@ -1320,9 +1281,8 @@ func (a *agent) createTailnet(ctx context.Context, agentID uuid.UUID, derpMap *t
// runCoordinator runs a coordinator and returns whether a reconnect
// should occur.
func (a *agent) runCoordinator(ctx context.Context, conn drpc.Conn, network *tailnet.Conn) error {
func (a *agent) runCoordinator(ctx context.Context, tClient tailnetproto.DRPCTailnetClient23, network *tailnet.Conn) error {
defer a.logger.Debug(ctx, "disconnected from coordination RPC")
tClient := tailnetproto.NewDRPCTailnetClient(conn)
// we run the RPC on the hardCtx so that we have a chance to send the disconnect message if we
// gracefully shut down.
coordinate, err := tClient.Coordinate(a.hardCtx)
@@ -1347,19 +1307,20 @@ func (a *agent) runCoordinator(ctx context.Context, conn drpc.Conn, network *tai
defer close(disconnected)
a.closeMutex.Unlock()
coordination := tailnet.NewRemoteCoordination(a.logger, coordinate, network, uuid.Nil)
ctrl := tailnet.NewAgentCoordinationController(a.logger, network)
coordination := ctrl.New(coordinate)
errCh := make(chan error, 1)
go func() {
defer close(errCh)
select {
case <-ctx.Done():
err := coordination.Close()
err := coordination.Close(a.hardCtx)
if err != nil {
a.logger.Warn(ctx, "failed to close remote coordination", slog.Error(err))
}
return
case err := <-coordination.Error():
case err := <-coordination.Wait():
errCh <- err
}
}()
@@ -1367,11 +1328,10 @@ func (a *agent) runCoordinator(ctx context.Context, conn drpc.Conn, network *tai
}
// runDERPMapSubscriber runs a coordinator and returns if a reconnect should occur.
func (a *agent) runDERPMapSubscriber(ctx context.Context, conn drpc.Conn, network *tailnet.Conn) error {
func (a *agent) runDERPMapSubscriber(ctx context.Context, tClient tailnetproto.DRPCTailnetClient23, network *tailnet.Conn) error {
defer a.logger.Debug(ctx, "disconnected from derp map RPC")
ctx, cancel := context.WithCancel(ctx)
defer cancel()
tClient := tailnetproto.NewDRPCTailnetClient(conn)
stream, err := tClient.StreamDERPMaps(ctx, &tailnetproto.StreamDERPMapsRequest{})
if err != nil {
return xerrors.Errorf("stream DERP Maps: %w", err)
@@ -1394,87 +1354,6 @@ func (a *agent) runDERPMapSubscriber(ctx context.Context, conn drpc.Conn, networ
}
}
func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, msg workspacesdk.AgentReconnectingPTYInit, conn net.Conn) (retErr error) {
defer conn.Close()
a.metrics.connectionsTotal.Add(1)
a.connCountReconnectingPTY.Add(1)
defer a.connCountReconnectingPTY.Add(-1)
connectionID := uuid.NewString()
connLogger := logger.With(slog.F("message_id", msg.ID), slog.F("connection_id", connectionID))
connLogger.Debug(ctx, "starting handler")
defer func() {
if err := retErr; err != nil {
a.closeMutex.Lock()
closed := a.isClosed()
a.closeMutex.Unlock()
// If the agent is closed, we don't want to
// log this as an error since it's expected.
if closed {
connLogger.Info(ctx, "reconnecting pty failed with attach error (agent closed)", slog.Error(err))
} else {
connLogger.Error(ctx, "reconnecting pty failed with attach error", slog.Error(err))
}
}
connLogger.Info(ctx, "reconnecting pty connection closed")
}()
var rpty reconnectingpty.ReconnectingPTY
sendConnected := make(chan reconnectingpty.ReconnectingPTY, 1)
// On store, reserve this ID to prevent multiple concurrent new connections.
waitReady, ok := a.reconnectingPTYs.LoadOrStore(msg.ID, sendConnected)
if ok {
close(sendConnected) // Unused.
connLogger.Debug(ctx, "connecting to existing reconnecting pty")
c, ok := waitReady.(chan reconnectingpty.ReconnectingPTY)
if !ok {
return xerrors.Errorf("found invalid type in reconnecting pty map: %T", waitReady)
}
rpty, ok = <-c
if !ok || rpty == nil {
return xerrors.Errorf("reconnecting pty closed before connection")
}
c <- rpty // Put it back for the next reconnect.
} else {
connLogger.Debug(ctx, "creating new reconnecting pty")
connected := false
defer func() {
if !connected && retErr != nil {
a.reconnectingPTYs.Delete(msg.ID)
close(sendConnected)
}
}()
// Empty command will default to the users shell!
cmd, err := a.sshServer.CreateCommand(ctx, msg.Command, nil)
if err != nil {
a.metrics.reconnectingPTYErrors.WithLabelValues("create_command").Add(1)
return xerrors.Errorf("create command: %w", err)
}
rpty = reconnectingpty.New(ctx, cmd, &reconnectingpty.Options{
Timeout: a.reconnectingPTYTimeout,
Metrics: a.metrics.reconnectingPTYErrors,
}, logger.With(slog.F("message_id", msg.ID)))
if err = a.trackGoroutine(func() {
rpty.Wait()
a.reconnectingPTYs.Delete(msg.ID)
}); err != nil {
rpty.Close(err)
return xerrors.Errorf("start routine: %w", err)
}
connected = true
sendConnected <- rpty
}
return rpty.Attach(ctx, connectionID, conn, msg.Height, msg.Width, connLogger)
}
// Collect collects additional stats from the agent
func (a *agent) Collect(ctx context.Context, networkStats map[netlogtype.Connection]netlogtype.Counts) *proto.Stats {
a.logger.Debug(context.Background(), "computing stats report")
@@ -1496,7 +1375,7 @@ func (a *agent) Collect(ctx context.Context, networkStats map[netlogtype.Connect
stats.SessionCountVscode = sshStats.VSCode
stats.SessionCountJetbrains = sshStats.JetBrains
stats.SessionCountReconnectingPty = a.connCountReconnectingPTY.Load()
stats.SessionCountReconnectingPty = a.reconnectingPTYServer.ConnCount()
// Compute the median connection latency!
a.logger.Debug(ctx, "starting peer latency measurement for stats")
@@ -1504,6 +1383,8 @@ func (a *agent) Collect(ctx context.Context, networkStats map[netlogtype.Connect
var mu sync.Mutex
status := a.network.Status()
durations := []float64{}
p2pConns := 0
derpConns := 0
pingCtx, cancelFunc := context.WithTimeout(ctx, 5*time.Second)
defer cancelFunc()
for nodeID, peer := range status.Peer {
@@ -1520,13 +1401,18 @@ func (a *agent) Collect(ctx context.Context, networkStats map[netlogtype.Connect
wg.Add(1)
go func() {
defer wg.Done()
duration, _, _, err := a.network.Ping(pingCtx, addresses[0].Addr())
duration, p2p, _, err := a.network.Ping(pingCtx, addresses[0].Addr())
if err != nil {
return
}
mu.Lock()
defer mu.Unlock()
durations = append(durations, float64(duration.Microseconds()))
if p2p {
p2pConns++
} else {
derpConns++
}
}()
}
wg.Wait()
@@ -1546,6 +1432,9 @@ func (a *agent) Collect(ctx context.Context, networkStats map[netlogtype.Connect
// Agent metrics are changing all the time, so there is no need to perform
// reflect.DeepEqual to see if stats should be transferred.
// currentConnections behaves like a hypothetical `GaugeFuncVec` and is only set at collection time.
a.metrics.currentConnections.WithLabelValues("p2p").Set(float64(p2pConns))
a.metrics.currentConnections.WithLabelValues("derp").Set(float64(derpConns))
metricsCtx, cancelFunc := context.WithTimeout(ctx, 5*time.Second)
defer cancelFunc()
a.logger.Debug(ctx, "collecting agent metrics for stats")
@@ -1663,13 +1552,12 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
}
score, niceErr := proc.Niceness(a.syscaller)
if niceErr != nil && !xerrors.Is(niceErr, os.ErrPermission) {
if niceErr != nil && !isBenignProcessErr(niceErr) {
debouncer.Warn(ctx, "unable to get proc niceness",
slog.F("cmd", proc.Cmd()),
slog.F("pid", proc.PID),
slog.Error(niceErr),
)
continue
}
// We only want processes that don't have a nice value set
@@ -1683,7 +1571,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
if niceErr == nil {
err := proc.SetNiceness(a.syscaller, niceness)
if err != nil && !xerrors.Is(err, os.ErrPermission) {
if err != nil && !isBenignProcessErr(err) {
debouncer.Warn(ctx, "unable to set proc niceness",
slog.F("cmd", proc.Cmd()),
slog.F("pid", proc.PID),
@@ -1697,7 +1585,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
if oomScore != unsetOOMScore && oomScore != proc.OOMScoreAdj && !isCustomOOMScore(agentScore, proc) {
oomScoreStr := strconv.Itoa(oomScore)
err := afero.WriteFile(a.filesystem, fmt.Sprintf("/proc/%d/oom_score_adj", proc.PID), []byte(oomScoreStr), 0o644)
if err != nil && !xerrors.Is(err, os.ErrPermission) {
if err != nil && !isBenignProcessErr(err) {
debouncer.Warn(ctx, "unable to set oom_score_adj",
slog.F("cmd", proc.Cmd()),
slog.F("pid", proc.PID),
@@ -1781,7 +1669,7 @@ func (a *agent) HandleHTTPDebugLogs(w http.ResponseWriter, r *http.Request) {
}
defer f.Close()
// Limit to 10MB.
// Limit to 10MiB.
w.WriteHeader(http.StatusOK)
_, err = io.Copy(w, io.LimitReader(f, 10*1024*1024))
if err != nil && !errors.Is(err, io.EOF) {
@@ -1832,9 +1720,7 @@ func (a *agent) Close() error {
a.gracefulCancel()
lifecycleState := codersdk.WorkspaceAgentLifecycleOff
err = a.scriptRunner.Execute(a.hardCtx, func(script codersdk.WorkspaceAgentScript) bool {
return script.RunOnStop
})
err = a.scriptRunner.Execute(a.hardCtx, agentscripts.ExecuteStopScripts)
if err != nil {
a.logger.Warn(a.hardCtx, "shutdown script(s) failed", slog.Error(err))
if errors.Is(err, agentscripts.ErrTimeout) {
@@ -1968,13 +1854,17 @@ const (
type apiConnRoutineManager struct {
logger slog.Logger
conn drpc.Conn
aAPI proto.DRPCAgentClient23
tAPI tailnetproto.DRPCTailnetClient23
eg *errgroup.Group
stopCtx context.Context
remainCtx context.Context
}
func newAPIConnRoutineManager(gracefulCtx, hardCtx context.Context, logger slog.Logger, conn drpc.Conn) *apiConnRoutineManager {
func newAPIConnRoutineManager(
gracefulCtx, hardCtx context.Context, logger slog.Logger,
aAPI proto.DRPCAgentClient23, tAPI tailnetproto.DRPCTailnetClient23,
) *apiConnRoutineManager {
// routines that remain in operation during graceful shutdown use the remainCtx. They'll still
// exit if the errgroup hits an error, which usually means a problem with the conn.
eg, remainCtx := errgroup.WithContext(hardCtx)
@@ -1994,17 +1884,23 @@ func newAPIConnRoutineManager(gracefulCtx, hardCtx context.Context, logger slog.
stopCtx := eitherContext(remainCtx, gracefulCtx)
return &apiConnRoutineManager{
logger: logger,
conn: conn,
aAPI: aAPI,
tAPI: tAPI,
eg: eg,
stopCtx: stopCtx,
remainCtx: remainCtx,
}
}
func (a *apiConnRoutineManager) start(name string, b gracefulShutdownBehavior, f func(context.Context, drpc.Conn) error) {
// startAgentAPI starts a routine that uses the Agent API. c.f. startTailnetAPI which is the same
// but for Tailnet.
func (a *apiConnRoutineManager) startAgentAPI(
name string, behavior gracefulShutdownBehavior,
f func(context.Context, proto.DRPCAgentClient23) error,
) {
logger := a.logger.With(slog.F("name", name))
var ctx context.Context
switch b {
switch behavior {
case gracefulShutdownBehaviorStop:
ctx = a.stopCtx
case gracefulShutdownBehaviorRemain:
@@ -2013,8 +1909,45 @@ func (a *apiConnRoutineManager) start(name string, b gracefulShutdownBehavior, f
panic("unknown behavior")
}
a.eg.Go(func() error {
logger.Debug(ctx, "starting routine")
err := f(ctx, a.conn)
logger.Debug(ctx, "starting agent routine")
err := f(ctx, a.aAPI)
if xerrors.Is(err, context.Canceled) && ctx.Err() != nil {
logger.Debug(ctx, "swallowing context canceled")
// Don't propagate context canceled errors to the error group, because we don't want the
// graceful context being canceled to halt the work of routines with
// gracefulShutdownBehaviorRemain. Note that we check both that the error is
// context.Canceled and that *our* context is currently canceled, because when Coderd
// unilaterally closes the API connection (for example if the build is outdated), it can
// sometimes show up as context.Canceled in our RPC calls.
return nil
}
logger.Debug(ctx, "routine exited", slog.Error(err))
if err != nil {
return xerrors.Errorf("error in routine %s: %w", name, err)
}
return nil
})
}
// startTailnetAPI starts a routine that uses the Tailnet API. c.f. startAgentAPI which is the same
// but for the Agent API.
func (a *apiConnRoutineManager) startTailnetAPI(
name string, behavior gracefulShutdownBehavior,
f func(context.Context, tailnetproto.DRPCTailnetClient23) error,
) {
logger := a.logger.With(slog.F("name", name))
var ctx context.Context
switch behavior {
case gracefulShutdownBehaviorStop:
ctx = a.stopCtx
case gracefulShutdownBehaviorRemain:
ctx = a.remainCtx
default:
panic("unknown behavior")
}
a.eg.Go(func() error {
logger.Debug(ctx, "starting tailnet routine")
err := f(ctx, a.tAPI)
if xerrors.Is(err, context.Canceled) && ctx.Err() != nil {
logger.Debug(ctx, "swallowing context canceled")
// Don't propagate context canceled errors to the error group, because we don't want the
@@ -2133,3 +2066,14 @@ func (l *logDebouncer) log(ctx context.Context, level slog.Level, msg string, fi
}
l.messages[msg] = time.Now()
}
func isBenignProcessErr(err error) bool {
return err != nil &&
(xerrors.Is(err, os.ErrNotExist) ||
xerrors.Is(err, os.ErrPermission) ||
isNoSuchProcessErr(err))
}
func isNoSuchProcessErr(err error) bool {
return err != nil && strings.Contains(err.Error(), "no such process")
}
+200 -64
View File
@@ -19,6 +19,7 @@ import (
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"sync"
"sync/atomic"
@@ -970,6 +971,99 @@ func TestAgent_SCP(t *testing.T) {
require.NoError(t, err)
}
func TestAgent_FileTransferBlocked(t *testing.T) {
t.Parallel()
assertFileTransferBlocked := func(t *testing.T, errorMessage string) {
// NOTE: Checking content of the error message is flaky. Most likely there is a race condition, which results
// in stopping the client in different phases, and returning different errors:
// - client read the full error message: File transfer has been disabled.
// - client's stream was terminated before reading the error message: EOF
// - client just read the error code (Windows): Process exited with status 65
isErr := strings.Contains(errorMessage, agentssh.BlockedFileTransferErrorMessage) ||
strings.Contains(errorMessage, "EOF") ||
strings.Contains(errorMessage, "Process exited with status 65")
require.True(t, isErr, fmt.Sprintf("Message: "+errorMessage))
}
t.Run("SFTP", func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
//nolint:dogsled
conn, _, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.BlockFileTransfer = true
})
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)
defer sshClient.Close()
_, err = sftp.NewClient(sshClient)
require.Error(t, err)
assertFileTransferBlocked(t, err.Error())
})
t.Run("SCP with go-scp package", func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
//nolint:dogsled
conn, _, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.BlockFileTransfer = true
})
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)
defer sshClient.Close()
scpClient, err := scp.NewClientBySSH(sshClient)
require.NoError(t, err)
defer scpClient.Close()
tempFile := filepath.Join(t.TempDir(), "scp")
err = scpClient.CopyFile(context.Background(), strings.NewReader("hello world"), tempFile, "0755")
require.Error(t, err)
assertFileTransferBlocked(t, err.Error())
})
t.Run("Forbidden commands", func(t *testing.T) {
t.Parallel()
for _, c := range agentssh.BlockedFileTransferCommands {
t.Run(c, func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
//nolint:dogsled
conn, _, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
o.BlockFileTransfer = true
})
sshClient, err := conn.SSHClient(ctx)
require.NoError(t, err)
defer sshClient.Close()
session, err := sshClient.NewSession()
require.NoError(t, err)
defer session.Close()
stdout, err := session.StdoutPipe()
require.NoError(t, err)
//nolint:govet // we don't need `c := c` in Go 1.22
err = session.Start(c)
require.NoError(t, err)
defer session.Close()
msg, err := io.ReadAll(stdout)
require.NoError(t, err)
assertFileTransferBlocked(t, string(msg))
})
}
})
}
func TestAgent_EnvironmentVariables(t *testing.T) {
t.Parallel()
key := "EXAMPLE"
@@ -1414,7 +1508,7 @@ func TestAgent_Lifecycle(t *testing.T) {
t.Run("ShutdownScriptOnce", func(t *testing.T) {
t.Parallel()
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
logger := testutil.Logger(t)
expected := "this-is-shutdown"
derpMap, _ := tailnettest.RunDERPAndSTUN(t)
@@ -1424,10 +1518,12 @@ func TestAgent_Lifecycle(t *testing.T) {
agentsdk.Manifest{
DERPMap: derpMap,
Scripts: []codersdk.WorkspaceAgentScript{{
ID: uuid.New(),
LogPath: "coder-startup-script.log",
Script: "echo 1",
RunOnStart: true,
}, {
ID: uuid.New(),
LogPath: "coder-shutdown-script.log",
Script: "echo " + expected,
RunOnStop: true,
@@ -1719,20 +1815,45 @@ func TestAgent_Dial(t *testing.T) {
go func() {
defer close(done)
c, err := l.Accept()
if assert.NoError(t, err, "accept connection") {
defer c.Close()
testAccept(ctx, t, c)
for range 2 {
c, err := l.Accept()
if assert.NoError(t, err, "accept connection") {
testAccept(ctx, t, c)
_ = c.Close()
}
}
}()
agentID := uuid.UUID{0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8}
//nolint:dogsled
agentConn, _, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
agentConn, _, _, _, _ := setupAgent(t, agentsdk.Manifest{
AgentID: agentID,
}, 0)
require.True(t, agentConn.AwaitReachable(ctx))
conn, err := agentConn.DialContext(ctx, l.Addr().Network(), l.Addr().String())
require.NoError(t, err)
defer conn.Close()
testDial(ctx, t, conn)
err = conn.Close()
require.NoError(t, err)
// also connect via the CoderServicePrefix, to test that we can reach the agent on this
// IP. This will be required for CoderVPN.
_, rawPort, _ := net.SplitHostPort(l.Addr().String())
port, _ := strconv.ParseUint(rawPort, 10, 16)
ipp := netip.AddrPortFrom(tailnet.CoderServicePrefix.AddrFromUUID(agentID), uint16(port))
switch l.Addr().Network() {
case "tcp":
conn, err = agentConn.Conn.DialContextTCP(ctx, ipp)
case "udp":
conn, err = agentConn.Conn.DialContextUDP(ctx, ipp)
default:
t.Fatalf("unknown network: %s", l.Addr().Network())
}
require.NoError(t, err)
testDial(ctx, t, conn)
err = conn.Close()
require.NoError(t, err)
})
}
}
@@ -1742,7 +1863,7 @@ func TestAgent_Dial(t *testing.T) {
func TestAgent_UpdatedDERP(t *testing.T) {
t.Parallel()
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
logger := testutil.Logger(t)
originalDerpMap, _ := tailnettest.RunDERPAndSTUN(t)
require.NotNil(t, originalDerpMap)
@@ -1785,7 +1906,7 @@ func TestAgent_UpdatedDERP(t *testing.T) {
// Setup a client connection.
newClientConn := func(derpMap *tailcfg.DERPMap, name string) *workspacesdk.AgentConn {
conn, err := tailnet.NewConn(&tailnet.Options{
Addresses: []netip.Prefix{netip.PrefixFrom(tailnet.IP(), 128)},
Addresses: []netip.Prefix{tailnet.TailscaleServicePrefix.RandomPrefix()},
DERPMap: derpMap,
Logger: logger.Named(name),
})
@@ -1797,13 +1918,15 @@ func TestAgent_UpdatedDERP(t *testing.T) {
testCtx, testCtxCancel := context.WithCancel(context.Background())
t.Cleanup(testCtxCancel)
clientID := uuid.New()
coordination := tailnet.NewInMemoryCoordination(
testCtx, logger,
clientID, agentID,
coordinator, conn)
ctrl := tailnet.NewTunnelSrcCoordController(logger, conn)
ctrl.AddDestination(agentID)
auth := tailnet.ClientCoordinateeAuth{AgentID: agentID}
coordination := ctrl.New(tailnet.NewInMemoryCoordinatorClient(logger, clientID, auth, coordinator))
t.Cleanup(func() {
t.Logf("closing coordination %s", name)
err := coordination.Close()
cctx, ccancel := context.WithTimeout(testCtx, testutil.WaitShort)
defer ccancel()
err := coordination.Close(cctx)
if err != nil {
t.Logf("error closing in-memory coordination: %s", err.Error())
}
@@ -1896,7 +2019,7 @@ func TestAgent_Speedtest(t *testing.T) {
func TestAgent_Reconnect(t *testing.T) {
t.Parallel()
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
logger := testutil.Logger(t)
// After the agent is disconnected from a coordinator, it's supposed
// to reconnect!
coordinator := tailnet.NewCoordinator(logger)
@@ -1937,7 +2060,7 @@ func TestAgent_Reconnect(t *testing.T) {
func TestAgent_WriteVSCodeConfigs(t *testing.T) {
t.Parallel()
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
logger := testutil.Logger(t)
coordinator := tailnet.NewCoordinator(logger)
defer coordinator.Close()
@@ -2275,7 +2398,7 @@ func setupAgent(t *testing.T, metadata agentsdk.Manifest, ptyTimeout time.Durati
_ = agnt.Close()
})
conn, err := tailnet.NewConn(&tailnet.Options{
Addresses: []netip.Prefix{netip.PrefixFrom(tailnet.IP(), 128)},
Addresses: []netip.Prefix{netip.PrefixFrom(tailnet.TailscaleServicePrefix.RandomAddr(), 128)},
DERPMap: metadata.DERPMap,
Logger: logger.Named("client"),
})
@@ -2286,12 +2409,15 @@ func setupAgent(t *testing.T, metadata agentsdk.Manifest, ptyTimeout time.Durati
testCtx, testCtxCancel := context.WithCancel(context.Background())
t.Cleanup(testCtxCancel)
clientID := uuid.New()
coordination := tailnet.NewInMemoryCoordination(
testCtx, logger,
clientID, metadata.AgentID,
coordinator, conn)
ctrl := tailnet.NewTunnelSrcCoordController(logger, conn)
ctrl.AddDestination(metadata.AgentID)
auth := tailnet.ClientCoordinateeAuth{AgentID: metadata.AgentID}
coordination := ctrl.New(tailnet.NewInMemoryCoordinatorClient(
logger, clientID, auth, coordinator))
t.Cleanup(func() {
err := coordination.Close()
cctx, ccancel := context.WithTimeout(testCtx, testutil.WaitShort)
defer ccancel()
err := coordination.Close(cctx)
if err != nil {
t.Logf("error closing in-mem coordination: %s", err.Error())
}
@@ -2438,17 +2564,17 @@ func TestAgent_Metrics_SSH(t *testing.T) {
err = session.Shell()
require.NoError(t, err)
expected := []agentsdk.AgentMetric{
expected := []*proto.Stats_Metric{
{
Name: "agent_reconnecting_pty_connections_total",
Type: agentsdk.AgentMetricTypeCounter,
Type: proto.Stats_Metric_COUNTER,
Value: 0,
},
{
Name: "agent_sessions_total",
Type: agentsdk.AgentMetricTypeCounter,
Type: proto.Stats_Metric_COUNTER,
Value: 1,
Labels: []agentsdk.AgentMetricLabel{
Labels: []*proto.Stats_Metric_Label{
{
Name: "magic_type",
Value: "ssh",
@@ -2461,30 +2587,46 @@ func TestAgent_Metrics_SSH(t *testing.T) {
},
{
Name: "agent_ssh_server_failed_connections_total",
Type: agentsdk.AgentMetricTypeCounter,
Type: proto.Stats_Metric_COUNTER,
Value: 0,
},
{
Name: "agent_ssh_server_sftp_connections_total",
Type: agentsdk.AgentMetricTypeCounter,
Type: proto.Stats_Metric_COUNTER,
Value: 0,
},
{
Name: "agent_ssh_server_sftp_server_errors_total",
Type: agentsdk.AgentMetricTypeCounter,
Type: proto.Stats_Metric_COUNTER,
Value: 0,
},
{
Name: "coderd_agentstats_startup_script_seconds",
Type: agentsdk.AgentMetricTypeGauge,
Name: "coderd_agentstats_currently_reachable_peers",
Type: proto.Stats_Metric_GAUGE,
Value: 0,
Labels: []agentsdk.AgentMetricLabel{
Labels: []*proto.Stats_Metric_Label{
{
Name: "success",
Value: "true",
Name: "connection_type",
Value: "derp",
},
},
},
{
Name: "coderd_agentstats_currently_reachable_peers",
Type: proto.Stats_Metric_GAUGE,
Value: 1,
Labels: []*proto.Stats_Metric_Label{
{
Name: "connection_type",
Value: "p2p",
},
},
},
{
Name: "coderd_agentstats_startup_script_seconds",
Type: proto.Stats_Metric_GAUGE,
Value: 1,
},
}
var actual []*promgo.MetricFamily
@@ -2493,17 +2635,33 @@ func TestAgent_Metrics_SSH(t *testing.T) {
if err != nil {
return false
}
if len(expected) != len(actual) {
return false
count := 0
for _, m := range actual {
count += len(m.GetMetric())
}
return verifyCollectedMetrics(t, expected, actual)
return count == len(expected)
}, testutil.WaitLong, testutil.IntervalFast)
require.Len(t, actual, len(expected))
collected := verifyCollectedMetrics(t, expected, actual)
require.True(t, collected, "expected metrics were not collected")
i := 0
for _, mf := range actual {
for _, m := range mf.GetMetric() {
assert.Equal(t, expected[i].Name, mf.GetName())
assert.Equal(t, expected[i].Type.String(), mf.GetType().String())
// Value is max expected
if expected[i].Type == proto.Stats_Metric_GAUGE {
assert.GreaterOrEqualf(t, expected[i].Value, m.GetGauge().GetValue(), "expected %s to be greater than or equal to %f, got %f", expected[i].Name, expected[i].Value, m.GetGauge().GetValue())
} else if expected[i].Type == proto.Stats_Metric_COUNTER {
assert.GreaterOrEqualf(t, expected[i].Value, m.GetCounter().GetValue(), "expected %s to be greater than or equal to %f, got %f", expected[i].Name, expected[i].Value, m.GetCounter().GetValue())
}
for j, lbl := range expected[i].Labels {
assert.Equal(t, m.GetLabel()[j], &promgo.LabelPair{
Name: &lbl.Name,
Value: &lbl.Value,
})
}
i++
}
}
_ = stdin.Close()
err = session.Wait()
@@ -2735,28 +2893,6 @@ func TestAgent_ManageProcessPriority(t *testing.T) {
})
}
func verifyCollectedMetrics(t *testing.T, expected []agentsdk.AgentMetric, actual []*promgo.MetricFamily) bool {
t.Helper()
for i, e := range expected {
assert.Equal(t, e.Name, actual[i].GetName())
assert.Equal(t, string(e.Type), strings.ToLower(actual[i].GetType().String()))
for _, m := range actual[i].GetMetric() {
assert.Equal(t, e.Value, m.Counter.GetValue())
if len(m.GetLabel()) > 0 {
for j, lbl := range m.GetLabel() {
assert.Equal(t, e.Labels[j].Name, lbl.GetName())
assert.Equal(t, e.Labels[j].Value, lbl.GetValue())
}
}
m.GetLabel()
}
}
return true
}
type syncWriter struct {
mu sync.Mutex
w io.Writer
+145
View File
@@ -0,0 +1,145 @@
//go:build linux
// +build linux
package agentexec
import (
"flag"
"fmt"
"os"
"os/exec"
"runtime"
"strconv"
"strings"
"syscall"
"golang.org/x/sys/unix"
"golang.org/x/xerrors"
)
// unset is set to an invalid value for nice and oom scores.
const unset = -2000
// CLI runs the agent-exec command. It should only be called by the cli package.
func CLI() error {
// We lock the OS thread here to avoid a race condition where the nice priority
// we get is on a different thread from the one we set it on.
runtime.LockOSThread()
// Nop on success but we do it anyway in case of an error.
defer runtime.UnlockOSThread()
var (
fs = flag.NewFlagSet("agent-exec", flag.ExitOnError)
nice = fs.Int("coder-nice", unset, "")
oom = fs.Int("coder-oom", unset, "")
)
if len(os.Args) < 3 {
return xerrors.Errorf("malformed command %+v", os.Args)
}
// Parse everything after "coder agent-exec".
err := fs.Parse(os.Args[2:])
if err != nil {
return xerrors.Errorf("parse flags: %w", err)
}
// Get everything after "coder agent-exec --"
args := execArgs(os.Args)
if len(args) == 0 {
return xerrors.Errorf("no exec command provided %+v", os.Args)
}
if *nice == unset {
// If an explicit nice score isn't set, we use the default.
*nice, err = defaultNiceScore()
if err != nil {
return xerrors.Errorf("get default nice score: %w", err)
}
}
if *oom == unset {
// If an explicit oom score isn't set, we use the default.
*oom, err = defaultOOMScore()
if err != nil {
return xerrors.Errorf("get default oom score: %w", err)
}
}
err = unix.Setpriority(unix.PRIO_PROCESS, 0, *nice)
if err != nil {
return xerrors.Errorf("set nice score: %w", err)
}
err = writeOOMScoreAdj(*oom)
if err != nil {
return xerrors.Errorf("set oom score: %w", err)
}
path, err := exec.LookPath(args[0])
if err != nil {
return xerrors.Errorf("look path: %w", err)
}
return syscall.Exec(path, args, os.Environ())
}
func defaultNiceScore() (int, error) {
score, err := unix.Getpriority(unix.PRIO_PROCESS, 0)
if err != nil {
return 0, xerrors.Errorf("get nice score: %w", err)
}
// See https://linux.die.net/man/2/setpriority#Notes
score = 20 - score
score += 5
if score > 19 {
return 19, nil
}
return score, nil
}
func defaultOOMScore() (int, error) {
score, err := oomScoreAdj()
if err != nil {
return 0, xerrors.Errorf("get oom score: %w", err)
}
// If the agent has a negative oom_score_adj, we set the child to 0
// so it's treated like every other process.
if score < 0 {
return 0, nil
}
// If the agent is already almost at the maximum then set it to the max.
if score >= 998 {
return 1000, nil
}
// If the agent oom_score_adj is >=0, we set the child to slightly
// less than the maximum. If users want a different score they set it
// directly.
return 998, nil
}
func oomScoreAdj() (int, error) {
scoreStr, err := os.ReadFile("/proc/self/oom_score_adj")
if err != nil {
return 0, xerrors.Errorf("read oom_score_adj: %w", err)
}
return strconv.Atoi(strings.TrimSpace(string(scoreStr)))
}
func writeOOMScoreAdj(score int) error {
return os.WriteFile("/proc/self/oom_score_adj", []byte(fmt.Sprintf("%d", score)), 0o600)
}
// execArgs returns the arguments to pass to syscall.Exec after the "--" delimiter.
func execArgs(args []string) []string {
for i, arg := range args {
if arg == "--" {
return args[i+1:]
}
}
return nil
}
+178
View File
@@ -0,0 +1,178 @@
//go:build linux
// +build linux
package agentexec_test
import (
"bytes"
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"syscall"
"testing"
"time"
"github.com/stretchr/testify/require"
"golang.org/x/sys/unix"
"github.com/coder/coder/v2/testutil"
)
func TestCLI(t *testing.T) {
t.Parallel()
t.Run("OK", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitMedium)
cmd, path := cmd(ctx, t, 123, 12)
err := cmd.Start()
require.NoError(t, err)
go cmd.Wait()
waitForSentinel(ctx, t, cmd, path)
requireOOMScore(t, cmd.Process.Pid, 123)
requireNiceScore(t, cmd.Process.Pid, 12)
})
t.Run("Defaults", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitMedium)
cmd, path := cmd(ctx, t, 0, 0)
err := cmd.Start()
require.NoError(t, err)
go cmd.Wait()
waitForSentinel(ctx, t, cmd, path)
expectedNice := expectedNiceScore(t)
expectedOOM := expectedOOMScore(t)
requireOOMScore(t, cmd.Process.Pid, expectedOOM)
requireNiceScore(t, cmd.Process.Pid, expectedNice)
})
}
func requireNiceScore(t *testing.T, pid int, score int) {
t.Helper()
nice, err := unix.Getpriority(unix.PRIO_PROCESS, pid)
require.NoError(t, err)
// See https://linux.die.net/man/2/setpriority#Notes
require.Equal(t, score, 20-nice)
}
func requireOOMScore(t *testing.T, pid int, expected int) {
t.Helper()
actual, err := os.ReadFile(fmt.Sprintf("/proc/%d/oom_score_adj", pid))
require.NoError(t, err)
score := strings.TrimSpace(string(actual))
require.Equal(t, strconv.Itoa(expected), score)
}
func waitForSentinel(ctx context.Context, t *testing.T, cmd *exec.Cmd, path string) {
t.Helper()
ticker := time.NewTicker(testutil.IntervalFast)
defer ticker.Stop()
// RequireEventually doesn't work well with require.NoError or similar require functions.
for {
err := cmd.Process.Signal(syscall.Signal(0))
require.NoError(t, err)
_, err = os.Stat(path)
if err == nil {
return
}
select {
case <-ticker.C:
case <-ctx.Done():
require.NoError(t, ctx.Err())
}
}
}
func cmd(ctx context.Context, t *testing.T, oom, nice int) (*exec.Cmd, string) {
var (
args = execArgs(oom, nice)
dir = t.TempDir()
file = filepath.Join(dir, "sentinel")
)
args = append(args, "sh", "-c", fmt.Sprintf("touch %s && sleep 10m", file))
//nolint:gosec
cmd := exec.CommandContext(ctx, TestBin, args...)
// We set this so we can also easily kill the sleep process the shell spawns.
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
}
cmd.Env = os.Environ()
var buf bytes.Buffer
cmd.Stdout = &buf
cmd.Stderr = &buf
t.Cleanup(func() {
// Print output of a command if the test fails.
if t.Failed() {
t.Logf("cmd %q output: %s", cmd.Args, buf.String())
}
if cmd.Process != nil {
// We use -cmd.Process.Pid to kill the whole process group.
_ = syscall.Kill(-cmd.Process.Pid, syscall.SIGINT)
}
})
return cmd, file
}
func expectedOOMScore(t *testing.T) int {
t.Helper()
score, err := os.ReadFile(fmt.Sprintf("/proc/%d/oom_score_adj", os.Getpid()))
require.NoError(t, err)
scoreInt, err := strconv.Atoi(strings.TrimSpace(string(score)))
require.NoError(t, err)
if scoreInt < 0 {
return 0
}
if scoreInt >= 998 {
return 1000
}
return 998
}
func expectedNiceScore(t *testing.T) int {
t.Helper()
score, err := unix.Getpriority(unix.PRIO_PROCESS, os.Getpid())
require.NoError(t, err)
// Priority is niceness + 20.
score = 20 - score
score += 5
if score > 19 {
return 19
}
return score
}
func execArgs(oom int, nice int) []string {
execArgs := []string{"agent-exec"}
if oom != 0 {
execArgs = append(execArgs, fmt.Sprintf("--coder-oom=%d", oom))
}
if nice != 0 {
execArgs = append(execArgs, fmt.Sprintf("--coder-nice=%d", nice))
}
execArgs = append(execArgs, "--")
return execArgs
}
+10
View File
@@ -0,0 +1,10 @@
//go:build !linux
// +build !linux
package agentexec
import "golang.org/x/xerrors"
func CLI() error {
return xerrors.New("agent-exec is only supported on Linux")
}
+19
View File
@@ -0,0 +1,19 @@
//go:build linux
// +build linux
package main
import (
"fmt"
"os"
"github.com/coder/coder/v2/agent/agentexec"
)
func main() {
err := agentexec.CLI()
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
+86
View File
@@ -0,0 +1,86 @@
package agentexec
import (
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"golang.org/x/xerrors"
)
const (
// EnvProcPrioMgmt is the environment variable that determines whether
// we attempt to manage process CPU and OOM Killer priority.
EnvProcPrioMgmt = "CODER_PROC_PRIO_MGMT"
EnvProcOOMScore = "CODER_PROC_OOM_SCORE"
EnvProcNiceScore = "CODER_PROC_NICE_SCORE"
)
// CommandContext returns an exec.Cmd that calls "coder agent-exec" prior to exec'ing
// the provided command if CODER_PROC_PRIO_MGMT is set, otherwise a normal exec.Cmd
// is returned. All instances of exec.Cmd should flow through this function to ensure
// proper resource constraints are applied to the child process.
func CommandContext(ctx context.Context, cmd string, args ...string) (*exec.Cmd, error) {
_, enabled := os.LookupEnv(EnvProcPrioMgmt)
if runtime.GOOS != "linux" || !enabled {
return exec.CommandContext(ctx, cmd, args...), nil
}
executable, err := os.Executable()
if err != nil {
return nil, xerrors.Errorf("get executable: %w", err)
}
bin, err := filepath.EvalSymlinks(executable)
if err != nil {
return nil, xerrors.Errorf("eval symlinks: %w", err)
}
execArgs := []string{"agent-exec"}
if score, ok := envValInt(EnvProcOOMScore); ok {
execArgs = append(execArgs, oomScoreArg(score))
}
if score, ok := envValInt(EnvProcNiceScore); ok {
execArgs = append(execArgs, niceScoreArg(score))
}
execArgs = append(execArgs, "--", cmd)
execArgs = append(execArgs, args...)
return exec.CommandContext(ctx, bin, execArgs...), nil
}
// envValInt searches for a key in a list of environment variables and parses it to an int.
// If the key is not found or cannot be parsed, returns 0 and false.
func envValInt(key string) (int, bool) {
val, ok := os.LookupEnv(key)
if !ok {
return 0, false
}
i, err := strconv.Atoi(val)
if err != nil {
return 0, false
}
return i, true
}
// The following are flags used by the agent-exec command. We use flags instead of
// environment variables to avoid having to deal with a caller overriding the
// environment variables.
const (
niceFlag = "coder-nice"
oomFlag = "coder-oom"
)
func niceScoreArg(score int) string {
return fmt.Sprintf("--%s=%d", niceFlag, score)
}
func oomScoreArg(score int) string {
return fmt.Sprintf("--%s=%d", oomFlag, score)
}
+119
View File
@@ -0,0 +1,119 @@
package agentexec_test
import (
"context"
"os"
"os/exec"
"runtime"
"testing"
"github.com/stretchr/testify/require"
"github.com/coder/coder/v2/agent/agentexec"
)
//nolint:paralleltest // we need to test environment variables
func TestExec(t *testing.T) {
//nolint:paralleltest // we need to test environment variables
t.Run("NonLinux", func(t *testing.T) {
t.Setenv(agentexec.EnvProcPrioMgmt, "true")
if runtime.GOOS == "linux" {
t.Skip("skipping on linux")
}
cmd, err := agentexec.CommandContext(context.Background(), "sh", "-c", "sleep")
require.NoError(t, err)
path, err := exec.LookPath("sh")
require.NoError(t, err)
require.Equal(t, path, cmd.Path)
require.Equal(t, []string{"sh", "-c", "sleep"}, cmd.Args)
})
//nolint:paralleltest // we need to test environment variables
t.Run("Linux", func(t *testing.T) {
//nolint:paralleltest // we need to test environment variables
t.Run("Disabled", func(t *testing.T) {
if runtime.GOOS != "linux" {
t.Skip("skipping on linux")
}
cmd, err := agentexec.CommandContext(context.Background(), "sh", "-c", "sleep")
require.NoError(t, err)
path, err := exec.LookPath("sh")
require.NoError(t, err)
require.Equal(t, path, cmd.Path)
require.Equal(t, []string{"sh", "-c", "sleep"}, cmd.Args)
})
//nolint:paralleltest // we need to test environment variables
t.Run("Enabled", func(t *testing.T) {
t.Setenv(agentexec.EnvProcPrioMgmt, "hello")
if runtime.GOOS != "linux" {
t.Skip("skipping on linux")
}
executable, err := os.Executable()
require.NoError(t, err)
cmd, err := agentexec.CommandContext(context.Background(), "sh", "-c", "sleep")
require.NoError(t, err)
require.Equal(t, executable, cmd.Path)
require.Equal(t, []string{executable, "agent-exec", "--", "sh", "-c", "sleep"}, cmd.Args)
})
t.Run("Nice", func(t *testing.T) {
t.Setenv(agentexec.EnvProcPrioMgmt, "hello")
t.Setenv(agentexec.EnvProcNiceScore, "10")
if runtime.GOOS != "linux" {
t.Skip("skipping on linux")
}
executable, err := os.Executable()
require.NoError(t, err)
cmd, err := agentexec.CommandContext(context.Background(), "sh", "-c", "sleep")
require.NoError(t, err)
require.Equal(t, executable, cmd.Path)
require.Equal(t, []string{executable, "agent-exec", "--coder-nice=10", "--", "sh", "-c", "sleep"}, cmd.Args)
})
t.Run("OOM", func(t *testing.T) {
t.Setenv(agentexec.EnvProcPrioMgmt, "hello")
t.Setenv(agentexec.EnvProcOOMScore, "123")
if runtime.GOOS != "linux" {
t.Skip("skipping on linux")
}
executable, err := os.Executable()
require.NoError(t, err)
cmd, err := agentexec.CommandContext(context.Background(), "sh", "-c", "sleep")
require.NoError(t, err)
require.Equal(t, executable, cmd.Path)
require.Equal(t, []string{executable, "agent-exec", "--coder-oom=123", "--", "sh", "-c", "sleep"}, cmd.Args)
})
t.Run("Both", func(t *testing.T) {
t.Setenv(agentexec.EnvProcPrioMgmt, "hello")
t.Setenv(agentexec.EnvProcOOMScore, "432")
t.Setenv(agentexec.EnvProcNiceScore, "14")
if runtime.GOOS != "linux" {
t.Skip("skipping on linux")
}
executable, err := os.Executable()
require.NoError(t, err)
cmd, err := agentexec.CommandContext(context.Background(), "sh", "-c", "sleep")
require.NoError(t, err)
require.Equal(t, executable, cmd.Path)
require.Equal(t, []string{executable, "agent-exec", "--coder-oom=432", "--coder-nice=14", "--", "sh", "-c", "sleep"}, cmd.Args)
})
})
}
+46
View File
@@ -0,0 +1,46 @@
//go:build linux
// +build linux
package agentexec_test
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"testing"
)
var TestBin string
func TestMain(m *testing.M) {
code := func() int {
// We generate a unique directory per test invocation to avoid collisions between two
// processes attempting to create the same temp file.
dir := genDir()
defer os.RemoveAll(dir)
TestBin = buildBinary(dir)
return m.Run()
}()
os.Exit(code)
}
func buildBinary(dir string) string {
path := filepath.Join(dir, "agent-test")
out, err := exec.Command("go", "build", "-o", path, "./cmdtest").CombinedOutput()
mustf(err, "build binary: %s", out)
return path
}
func mustf(err error, msg string, args ...any) {
if err != nil {
panic(fmt.Sprintf(msg, args...))
}
}
func genDir() string {
dir, err := os.MkdirTemp(os.TempDir(), "agentexec")
mustf(err, "create temp dir: %v", err)
return dir
}
+11 -3
View File
@@ -45,8 +45,7 @@ func List(fs afero.Fs, syscaller Syscaller) ([]*Process, error) {
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 {
if isBenignError(err) {
continue
}
return nil, xerrors.Errorf("read cmdline: %w", err)
@@ -54,7 +53,7 @@ func List(fs afero.Fs, syscaller Syscaller) ([]*Process, error) {
oomScore, err := afero.ReadFile(fs, filepath.Join(defaultProcDir, entry, "oom_score_adj"))
if err != nil {
if xerrors.Is(err, os.ErrPermission) {
if isBenignError(err) {
continue
}
@@ -124,3 +123,12 @@ func (p *Process) Cmd() string {
func (p *Process) cmdLine() []string {
return strings.Split(p.CmdLine, "\x00")
}
func isBenignError(err error) bool {
var errno syscall.Errno
if !xerrors.As(err, &errno) {
return false
}
return errno == syscall.ESRCH || errno == syscall.EPERM || xerrors.Is(err, os.ErrNotExist)
}
+98 -26
View File
@@ -19,10 +19,13 @@ import (
"github.com/spf13/afero"
"golang.org/x/sync/errgroup"
"golang.org/x/xerrors"
"google.golang.org/protobuf/types/known/timestamppb"
"cdr.dev/slog"
"github.com/coder/coder/v2/agent/agentssh"
"github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/coderd/database/dbtime"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
)
@@ -75,18 +78,21 @@ func New(opts Options) *Runner {
}
}
type ScriptCompletedFunc func(context.Context, *proto.WorkspaceAgentScriptCompletedRequest) (*proto.WorkspaceAgentScriptCompletedResponse, error)
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
dataDir string
cronCtx context.Context
cronCtxCancel context.CancelFunc
cmdCloseWait sync.WaitGroup
closed chan struct{}
closeMutex sync.Mutex
cron *cron.Cron
initialized atomic.Bool
scripts []codersdk.WorkspaceAgentScript
dataDir string
scriptCompleted ScriptCompletedFunc
// scriptsExecuted includes all scripts executed by the workspace agent. Agents
// execute startup scripts, and scripts on a cron schedule. Both will increment
@@ -116,12 +122,13 @@ func (r *Runner) RegisterMetrics(reg prometheus.Registerer) {
// 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 {
func (r *Runner) Init(scripts []codersdk.WorkspaceAgentScript, scriptCompleted ScriptCompletedFunc) error {
if r.initialized.Load() {
return xerrors.New("init: already initialized")
}
r.initialized.Store(true)
r.scripts = scripts
r.scriptCompleted = scriptCompleted
r.Logger.Info(r.cronCtx, "initializing agent scripts", slog.F("script_count", len(scripts)), slog.F("log_dir", r.LogDir))
err := r.Filesystem.MkdirAll(r.ScriptBinDir(), 0o700)
@@ -135,7 +142,7 @@ func (r *Runner) Init(scripts []codersdk.WorkspaceAgentScript) error {
}
script := script
_, err := r.cron.AddFunc(script.Cron, func() {
err := r.trackRun(r.cronCtx, script)
err := r.trackRun(r.cronCtx, script, ExecuteCronScripts)
if err != nil {
r.Logger.Warn(context.Background(), "run agent script on schedule", slog.Error(err))
}
@@ -172,22 +179,33 @@ func (r *Runner) StartCron() {
}
}
// ExecuteOption describes what scripts we want to execute.
type ExecuteOption int
// ExecuteOption enums.
const (
ExecuteAllScripts ExecuteOption = iota
ExecuteStartScripts
ExecuteStopScripts
ExecuteCronScripts
)
// 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
}
}
func (r *Runner) Execute(ctx context.Context, option ExecuteOption) error {
var eg errgroup.Group
for _, script := range r.scripts {
if !filter(script) {
runScript := (option == ExecuteStartScripts && script.RunOnStart) ||
(option == ExecuteStopScripts && script.RunOnStop) ||
(option == ExecuteCronScripts && script.Cron != "") ||
option == ExecuteAllScripts
if !runScript {
continue
}
script := script
eg.Go(func() error {
err := r.trackRun(ctx, script)
err := r.trackRun(ctx, script, option)
if err != nil {
return xerrors.Errorf("run agent script %q: %w", script.LogSourceID, err)
}
@@ -198,8 +216,8 @@ func (r *Runner) Execute(ctx context.Context, filter func(script codersdk.Worksp
}
// trackRun wraps "run" with metrics.
func (r *Runner) trackRun(ctx context.Context, script codersdk.WorkspaceAgentScript) error {
err := r.run(ctx, script)
func (r *Runner) trackRun(ctx context.Context, script codersdk.WorkspaceAgentScript, option ExecuteOption) error {
err := r.run(ctx, script, option)
if err != nil {
r.scriptsExecuted.WithLabelValues("false").Add(1)
} else {
@@ -212,7 +230,7 @@ func (r *Runner) trackRun(ctx context.Context, script codersdk.WorkspaceAgentScr
// 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 {
func (r *Runner) run(ctx context.Context, script codersdk.WorkspaceAgentScript, option ExecuteOption) error {
logPath := script.LogPath
if logPath == "" {
logPath = fmt.Sprintf("coder-script-%s.log", script.LogSourceID)
@@ -299,9 +317,9 @@ func (r *Runner) run(ctx context.Context, script codersdk.WorkspaceAgentScript)
cmd.Stdout = io.MultiWriter(fileWriter, infoW)
cmd.Stderr = io.MultiWriter(fileWriter, errW)
start := time.Now()
start := dbtime.Now()
defer func() {
end := time.Now()
end := dbtime.Now()
execTime := end.Sub(start)
exitCode := 0
if err != nil {
@@ -314,6 +332,60 @@ func (r *Runner) run(ctx context.Context, script codersdk.WorkspaceAgentScript)
} else {
logger.Info(ctx, fmt.Sprintf("%s script completed", logPath), slog.F("execution_time", execTime), slog.F("exit_code", exitCode))
}
if r.scriptCompleted == nil {
logger.Debug(ctx, "r.scriptCompleted unexpectedly nil")
return
}
// We want to check this outside of the goroutine to avoid a race condition
timedOut := errors.Is(err, ErrTimeout)
pipesLeftOpen := errors.Is(err, ErrOutputPipesOpen)
err = r.trackCommandGoroutine(func() {
var stage proto.Timing_Stage
switch option {
case ExecuteStartScripts:
stage = proto.Timing_START
case ExecuteStopScripts:
stage = proto.Timing_STOP
case ExecuteCronScripts:
stage = proto.Timing_CRON
}
var status proto.Timing_Status
switch {
case timedOut:
status = proto.Timing_TIMED_OUT
case pipesLeftOpen:
status = proto.Timing_PIPES_LEFT_OPEN
case exitCode != 0:
status = proto.Timing_EXIT_FAILURE
default:
status = proto.Timing_OK
}
reportTimeout := 30 * time.Second
reportCtx, cancel := context.WithTimeout(context.Background(), reportTimeout)
defer cancel()
_, err := r.scriptCompleted(reportCtx, &proto.WorkspaceAgentScriptCompletedRequest{
Timing: &proto.Timing{
ScriptId: script.ID[:],
Start: timestamppb.New(start),
End: timestamppb.New(end),
ExitCode: int32(exitCode),
Stage: stage,
Status: status,
},
})
if err != nil {
logger.Error(ctx, fmt.Sprintf("reporting script completed: %s", err.Error()))
}
})
if err != nil {
logger.Error(ctx, fmt.Sprintf("reporting script completed: track command goroutine: %s", err.Error()))
}
}()
err = cmd.Start()
@@ -349,7 +421,7 @@ func (r *Runner) run(ctx context.Context, script codersdk.WorkspaceAgentScript)
"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.",
"https://coder.com/docs/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)
+41 -12
View File
@@ -14,9 +14,9 @@ import (
"github.com/stretchr/testify/require"
"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/agent/agenttest"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/coder/v2/testutil"
@@ -34,14 +34,13 @@ func TestExecuteBasic(t *testing.T) {
return fLogger
})
defer runner.Close()
aAPI := agenttest.NewFakeAgentAPI(t, testutil.Logger(t), nil, nil)
err := runner.Init([]codersdk.WorkspaceAgentScript{{
LogSourceID: uuid.New(),
Script: "echo hello",
}})
}}, aAPI.ScriptCompleted)
require.NoError(t, err)
require.NoError(t, runner.Execute(context.Background(), func(script codersdk.WorkspaceAgentScript) bool {
return true
}))
require.NoError(t, runner.Execute(context.Background(), agentscripts.ExecuteAllScripts))
log := testutil.RequireRecvCtx(ctx, t, fLogger.logs)
require.Equal(t, "hello", log.Output)
}
@@ -61,18 +60,17 @@ func TestEnv(t *testing.T) {
cmd.exe /c echo %CODER_SCRIPT_BIN_DIR%
`
}
aAPI := agenttest.NewFakeAgentAPI(t, testutil.Logger(t), nil, nil)
err := runner.Init([]codersdk.WorkspaceAgentScript{{
LogSourceID: id,
Script: script,
}})
}}, aAPI.ScriptCompleted)
require.NoError(t, err)
ctx := testutil.Context(t, testutil.WaitLong)
done := testutil.Go(t, func() {
err := runner.Execute(ctx, func(script codersdk.WorkspaceAgentScript) bool {
return true
})
err := runner.Execute(ctx, agentscripts.ExecuteAllScripts)
assert.NoError(t, err)
})
defer func() {
@@ -103,13 +101,44 @@ func TestTimeout(t *testing.T) {
t.Parallel()
runner := setup(t, nil)
defer runner.Close()
aAPI := agenttest.NewFakeAgentAPI(t, testutil.Logger(t), nil, nil)
err := runner.Init([]codersdk.WorkspaceAgentScript{{
LogSourceID: uuid.New(),
Script: "sleep infinity",
Timeout: time.Millisecond,
}})
}}, aAPI.ScriptCompleted)
require.NoError(t, err)
require.ErrorIs(t, runner.Execute(context.Background(), nil), agentscripts.ErrTimeout)
require.ErrorIs(t, runner.Execute(context.Background(), agentscripts.ExecuteAllScripts), agentscripts.ErrTimeout)
}
func TestScriptReportsTiming(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
fLogger := newFakeScriptLogger()
runner := setup(t, func(uuid2 uuid.UUID) agentscripts.ScriptLogger {
return fLogger
})
aAPI := agenttest.NewFakeAgentAPI(t, testutil.Logger(t), nil, nil)
err := runner.Init([]codersdk.WorkspaceAgentScript{{
DisplayName: "say-hello",
LogSourceID: uuid.New(),
Script: "echo hello",
}}, aAPI.ScriptCompleted)
require.NoError(t, err)
require.NoError(t, runner.Execute(ctx, agentscripts.ExecuteAllScripts))
runner.Close()
log := testutil.RequireRecvCtx(ctx, t, fLogger.logs)
require.Equal(t, "hello", log.Output)
timings := aAPI.GetTimings()
require.Equal(t, 1, len(timings))
timing := timings[0]
require.Equal(t, int32(0), timing.ExitCode)
require.GreaterOrEqual(t, timing.End.AsTime(), timing.Start.AsTime())
}
// TestCronClose exists because cron.Run() can happen after cron.Close().
@@ -130,7 +159,7 @@ func setup(t *testing.T, getScriptLogger func(logSourceID uuid.UUID) agentscript
}
}
fs := afero.NewMemMapFs()
logger := slogtest.Make(t, nil)
logger := testutil.Logger(t)
s, err := agentssh.NewServer(context.Background(), logger, prometheus.NewRegistry(), fs, nil)
require.NoError(t, err)
t.Cleanup(func() {
+61 -7
View File
@@ -52,8 +52,16 @@ const (
// MagicProcessCmdlineJetBrains is a string in a process's command line that
// uniquely identifies it as JetBrains software.
MagicProcessCmdlineJetBrains = "idea.vendor.name=JetBrains"
// BlockedFileTransferErrorCode indicates that SSH server restricted the raw command from performing
// the file transfer.
BlockedFileTransferErrorCode = 65 // Error code: host not allowed to connect
BlockedFileTransferErrorMessage = "File transfer has been disabled."
)
// BlockedFileTransferCommands contains a list of restricted file transfer commands.
var BlockedFileTransferCommands = []string{"nc", "rsync", "scp", "sftp"}
// Config sets configuration parameters for the agent SSH server.
type Config struct {
// MaxTimeout sets the absolute connection timeout, none if empty. If set to
@@ -71,9 +79,11 @@ type Config struct {
// where users will land when they connect via SSH. Default is the home
// directory of the user.
WorkingDirectory func() string
// X11SocketDir is the directory where X11 sockets are created. Default is
// /tmp/.X11-unix.
X11SocketDir string
// X11DisplayOffset is the offset to add to the X11 display number.
// Default is 10.
X11DisplayOffset *int
// BlockFileTransfer restricts use of file transfer applications.
BlockFileTransfer bool
}
type Server struct {
@@ -114,8 +124,9 @@ func NewServer(ctx context.Context, logger slog.Logger, prometheusRegistry *prom
if config == nil {
config = &Config{}
}
if config.X11SocketDir == "" {
config.X11SocketDir = filepath.Join(os.TempDir(), ".X11-unix")
if config.X11DisplayOffset == nil {
offset := X11DefaultDisplayOffset
config.X11DisplayOffset = &offset
}
if config.UpdateEnv == nil {
config.UpdateEnv = func(current []string) ([]string, error) { return current, nil }
@@ -263,13 +274,25 @@ func (s *Server) sessionHandler(session ssh.Session) {
extraEnv := make([]string, 0)
x11, hasX11 := session.X11()
if hasX11 {
handled := s.x11Handler(session.Context(), x11)
display, 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))
extraEnv = append(extraEnv, fmt.Sprintf("DISPLAY=localhost:%d.%d", display, x11.ScreenNumber))
}
if s.fileTransferBlocked(session) {
s.logger.Warn(ctx, "file transfer blocked", slog.F("session_subsystem", session.Subsystem()), slog.F("raw_command", session.RawCommand()))
if session.Subsystem() == "" { // sftp does not expect error, otherwise it fails with "package too long"
// Response format: <status_code><message body>\n
errorMessage := fmt.Sprintf("\x02%s\n", BlockedFileTransferErrorMessage)
_, _ = session.Write([]byte(errorMessage))
}
_ = session.Exit(BlockedFileTransferErrorCode)
return
}
switch ss := session.Subsystem(); ss {
@@ -322,6 +345,37 @@ func (s *Server) sessionHandler(session ssh.Session) {
_ = session.Exit(0)
}
// fileTransferBlocked method checks if the file transfer commands should be blocked.
//
// Warning: consider this mechanism as "Do not trespass" sign, as a violator can still ssh to the host,
// smuggle the `scp` binary, or just manually send files outside with `curl` or `ftp`.
// If a user needs a more sophisticated and battle-proof solution, consider full endpoint security.
func (s *Server) fileTransferBlocked(session ssh.Session) bool {
if !s.config.BlockFileTransfer {
return false // file transfers are permitted
}
// File transfers are restricted.
if session.Subsystem() == "sftp" {
return true
}
cmd := session.Command()
if len(cmd) == 0 {
return false // no command?
}
c := cmd[0]
c = filepath.Base(c) // in case the binary is absolute path, /usr/sbin/scp
for _, cmd := range BlockedFileTransferCommands {
if cmd == c {
return true
}
}
return false
}
func (s *Server) sessionStart(logger slog.Logger, session ssh.Session, extraEnv []string) (retErr error) {
ctx := session.Context()
env := append(session.Environ(), extraEnv...)
+1 -3
View File
@@ -17,8 +17,6 @@ import (
"github.com/coder/coder/v2/pty"
"github.com/coder/coder/v2/testutil"
"cdr.dev/slog/sloggers/slogtest"
)
const longScript = `
@@ -36,7 +34,7 @@ func Test_sessionStart_orphan(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitMedium)
defer cancel()
logger := slogtest.Make(t, nil)
logger := testutil.Logger(t)
s, err := NewServer(ctx, logger, prometheus.NewRegistry(), afero.NewMemMapFs(), nil)
require.NoError(t, err)
defer s.Close()
+4 -4
View File
@@ -35,7 +35,7 @@ func TestNewServer_ServeClient(t *testing.T) {
t.Parallel()
ctx := context.Background()
logger := slogtest.Make(t, nil)
logger := testutil.Logger(t)
s, err := agentssh.NewServer(ctx, logger, prometheus.NewRegistry(), afero.NewMemMapFs(), nil)
require.NoError(t, err)
defer s.Close()
@@ -76,7 +76,7 @@ func TestNewServer_ExecuteShebang(t *testing.T) {
}
ctx := context.Background()
logger := slogtest.Make(t, nil)
logger := testutil.Logger(t)
s, err := agentssh.NewServer(ctx, logger, prometheus.NewRegistry(), afero.NewMemMapFs(), nil)
require.NoError(t, err)
t.Cleanup(func() {
@@ -158,7 +158,7 @@ func TestNewServer_Signal(t *testing.T) {
t.Parallel()
ctx := context.Background()
logger := slogtest.Make(t, nil)
logger := testutil.Logger(t)
s, err := agentssh.NewServer(ctx, logger, prometheus.NewRegistry(), afero.NewMemMapFs(), nil)
require.NoError(t, err)
defer s.Close()
@@ -223,7 +223,7 @@ func TestNewServer_Signal(t *testing.T) {
t.Parallel()
ctx := context.Background()
logger := slogtest.Make(t, nil)
logger := testutil.Logger(t)
s, err := agentssh.NewServer(ctx, logger, prometheus.NewRegistry(), afero.NewMemMapFs(), nil)
require.NoError(t, err)
defer s.Close()
+91 -56
View File
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"io"
"math"
"net"
"os"
"path/filepath"
@@ -22,61 +23,69 @@ import (
"cdr.dev/slog"
)
const (
// X11StartPort is the starting port for X11 forwarding, this is the
// port used for "DISPLAY=localhost:0".
X11StartPort = 6000
// X11DefaultDisplayOffset is the default offset for X11 forwarding.
X11DefaultDisplayOffset = 10
)
// x11Callback is called when the client requests X11 forwarding.
// It adds an Xauthority entry to the Xauthority file.
func (s *Server) x11Callback(ctx ssh.Context, x11 ssh.X11) bool {
hostname, err := os.Hostname()
if err != nil {
s.logger.Warn(ctx, "failed to get hostname", slog.Error(err))
s.metrics.x11HandlerErrors.WithLabelValues("hostname").Add(1)
return false
}
err = s.fs.MkdirAll(s.config.X11SocketDir, 0o700)
if err != nil {
s.logger.Warn(ctx, "failed to make the x11 socket dir", slog.F("dir", s.config.X11SocketDir), slog.Error(err))
s.metrics.x11HandlerErrors.WithLabelValues("socker_dir").Add(1)
return false
}
err = addXauthEntry(ctx, s.fs, hostname, strconv.Itoa(int(x11.ScreenNumber)), x11.AuthProtocol, x11.AuthCookie)
if err != nil {
s.logger.Warn(ctx, "failed to add Xauthority entry", slog.Error(err))
s.metrics.x11HandlerErrors.WithLabelValues("xauthority").Add(1)
return false
}
func (*Server) x11Callback(_ ssh.Context, _ ssh.X11) bool {
// Always allow.
return true
}
// x11Handler is called when a session has requested X11 forwarding.
// It listens for X11 connections and forwards them to the client.
func (s *Server) x11Handler(ctx ssh.Context, x11 ssh.X11) bool {
func (s *Server) x11Handler(ctx ssh.Context, x11 ssh.X11) (displayNumber int, handled bool) {
serverConn, valid := ctx.Value(ssh.ContextKeyConn).(*gossh.ServerConn)
if !valid {
s.logger.Warn(ctx, "failed to get server connection")
return false
return -1, false
}
// We want to overwrite the socket so that subsequent connections will succeed.
socketPath := filepath.Join(s.config.X11SocketDir, fmt.Sprintf("X%d", x11.ScreenNumber))
err := os.Remove(socketPath)
if err != nil && !errors.Is(err, os.ErrNotExist) {
s.logger.Warn(ctx, "failed to remove existing X11 socket", slog.Error(err))
return false
}
listener, err := net.Listen("unix", socketPath)
hostname, err := os.Hostname()
if err != nil {
s.logger.Warn(ctx, "failed to listen for X11", slog.Error(err))
return false
s.logger.Warn(ctx, "failed to get hostname", slog.Error(err))
s.metrics.x11HandlerErrors.WithLabelValues("hostname").Add(1)
return -1, false
}
ln, display, err := createX11Listener(ctx, *s.config.X11DisplayOffset)
if err != nil {
s.logger.Warn(ctx, "failed to create X11 listener", slog.Error(err))
s.metrics.x11HandlerErrors.WithLabelValues("listen").Add(1)
return -1, false
}
s.trackListener(ln, true)
defer func() {
if !handled {
s.trackListener(ln, false)
_ = ln.Close()
}
}()
err = addXauthEntry(ctx, s.fs, hostname, strconv.Itoa(display), x11.AuthProtocol, x11.AuthCookie)
if err != nil {
s.logger.Warn(ctx, "failed to add Xauthority entry", slog.Error(err))
s.metrics.x11HandlerErrors.WithLabelValues("xauthority").Add(1)
return -1, false
}
s.trackListener(listener, true)
go func() {
defer listener.Close()
defer s.trackListener(listener, false)
handledFirstConnection := false
// Don't leave the listener open after the session is gone.
<-ctx.Done()
_ = ln.Close()
}()
go func() {
defer ln.Close()
defer s.trackListener(ln, false)
for {
conn, err := listener.Accept()
conn, err := ln.Accept()
if err != nil {
if errors.Is(err, net.ErrClosed) {
return
@@ -84,40 +93,66 @@ func (s *Server) x11Handler(ctx ssh.Context, x11 ssh.X11) bool {
s.logger.Warn(ctx, "failed to accept X11 connection", slog.Error(err))
return
}
if x11.SingleConnection && handledFirstConnection {
s.logger.Warn(ctx, "X11 connection rejected because single connection is enabled")
if x11.SingleConnection {
s.logger.Debug(ctx, "single connection requested, closing X11 listener")
_ = ln.Close()
}
tcpConn, ok := conn.(*net.TCPConn)
if !ok {
s.logger.Warn(ctx, fmt.Sprintf("failed to cast connection to TCPConn. got: %T", conn))
_ = conn.Close()
continue
}
handledFirstConnection = true
unixConn, ok := conn.(*net.UnixConn)
tcpAddr, ok := tcpConn.LocalAddr().(*net.TCPAddr)
if !ok {
s.logger.Warn(ctx, fmt.Sprintf("failed to cast connection to UnixConn. got: %T", conn))
return
}
unixAddr, ok := unixConn.LocalAddr().(*net.UnixAddr)
if !ok {
s.logger.Warn(ctx, fmt.Sprintf("failed to cast local address to UnixAddr. got: %T", unixConn.LocalAddr()))
return
s.logger.Warn(ctx, fmt.Sprintf("failed to cast local address to TCPAddr. got: %T", tcpConn.LocalAddr()))
_ = conn.Close()
continue
}
channel, reqs, err := serverConn.OpenChannel("x11", gossh.Marshal(struct {
OriginatorAddress string
OriginatorPort uint32
}{
OriginatorAddress: unixAddr.Name,
OriginatorPort: 0,
OriginatorAddress: tcpAddr.IP.String(),
OriginatorPort: uint32(tcpAddr.Port),
}))
if err != nil {
s.logger.Warn(ctx, "failed to open X11 channel", slog.Error(err))
return
_ = conn.Close()
continue
}
go gossh.DiscardRequests(reqs)
go Bicopy(ctx, conn, channel)
if !s.trackConn(ln, conn, true) {
s.logger.Warn(ctx, "failed to track X11 connection")
_ = conn.Close()
continue
}
go func() {
defer s.trackConn(ln, conn, false)
Bicopy(ctx, conn, channel)
}()
}
}()
return true
return display, true
}
// createX11Listener creates a listener for X11 forwarding, it will use
// the next available port starting from X11StartPort and displayOffset.
func createX11Listener(ctx context.Context, displayOffset int) (ln net.Listener, display int, err error) {
var lc net.ListenConfig
// Look for an open port to listen on.
for port := X11StartPort + displayOffset; port < math.MaxUint16; port++ {
ln, err = lc.Listen(ctx, "tcp", fmt.Sprintf("localhost:%d", port))
if err == nil {
display = port - X11StartPort
return ln, display, nil
}
}
return nil, -1, xerrors.Errorf("failed to find open port for X11 listener: %w", err)
}
// addXauthEntry adds an Xauthority entry to the Xauthority file.
+34 -10
View File
@@ -1,12 +1,17 @@
package agentssh_test
import (
"bufio"
"bytes"
"context"
"encoding/hex"
"fmt"
"net"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"testing"
"github.com/gliderlabs/ssh"
@@ -16,8 +21,6 @@ import (
"github.com/stretchr/testify/require"
gossh "golang.org/x/crypto/ssh"
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/v2/agent/agentssh"
"github.com/coder/coder/v2/testutil"
)
@@ -29,12 +32,9 @@ func TestServer_X11(t *testing.T) {
}
ctx := context.Background()
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
logger := testutil.Logger(t)
fs := afero.NewOsFs()
dir := t.TempDir()
s, err := agentssh.NewServer(ctx, logger, prometheus.NewRegistry(), fs, &agentssh.Config{
X11SocketDir: dir,
})
s, err := agentssh.NewServer(ctx, logger, prometheus.NewRegistry(), fs, &agentssh.Config{})
require.NoError(t, err)
defer s.Close()
@@ -53,21 +53,45 @@ func TestServer_X11(t *testing.T) {
sess, err := c.NewSession()
require.NoError(t, err)
wantScreenNumber := 1
reply, err := sess.SendRequest("x11-req", true, gossh.Marshal(ssh.X11{
AuthProtocol: "MIT-MAGIC-COOKIE-1",
AuthCookie: hex.EncodeToString([]byte("cookie")),
ScreenNumber: 0,
ScreenNumber: uint32(wantScreenNumber),
}))
require.NoError(t, err)
assert.True(t, reply)
err = sess.Shell()
// Want: ~DISPLAY=localhost:10.1
out, err := sess.Output("echo DISPLAY=$DISPLAY")
require.NoError(t, err)
sc := bufio.NewScanner(bytes.NewReader(out))
displayNumber := -1
for sc.Scan() {
line := strings.TrimSpace(sc.Text())
t.Log(line)
if strings.HasPrefix(line, "DISPLAY=") {
parts := strings.SplitN(line, "=", 2)
display := parts[1]
parts = strings.SplitN(display, ":", 2)
parts = strings.SplitN(parts[1], ".", 2)
displayNumber, err = strconv.Atoi(parts[0])
require.NoError(t, err)
assert.GreaterOrEqual(t, displayNumber, 10, "display number should be >= 10")
gotScreenNumber, err := strconv.Atoi(parts[1])
require.NoError(t, err)
assert.Equal(t, wantScreenNumber, gotScreenNumber, "screen number should match")
break
}
}
require.NoError(t, sc.Err())
require.NotEqual(t, -1, displayNumber)
x11Chans := c.HandleChannelOpen("x11")
payload := "hello world"
require.Eventually(t, func() bool {
conn, err := net.Dial("unix", filepath.Join(dir, "X0"))
conn, err := net.Dial("tcp", fmt.Sprintf("localhost:%d", agentssh.X11StartPort+displayNumber))
if err == nil {
_, err = conn.Write([]byte(payload))
assert.NoError(t, err)
+2 -3
View File
@@ -7,10 +7,9 @@ import (
"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"
"github.com/coder/coder/v2/testutil"
)
// New starts a new agent for use in tests.
@@ -24,7 +23,7 @@ func New(t testing.TB, coderURL *url.URL, agentToken string, opts ...func(*agent
t.Helper()
var o agent.Options
log := slogtest.Make(t, nil).Leveled(slog.LevelDebug).Named("agent")
log := testutil.Logger(t).Named("agent")
o.Logger = log
for _, opt := range opts {
+38 -11
View File
@@ -15,7 +15,6 @@ import (
"golang.org/x/exp/slices"
"golang.org/x/xerrors"
"google.golang.org/protobuf/types/known/durationpb"
"storj.io/drpc"
"storj.io/drpc/drpcmux"
"storj.io/drpc/drpcserver"
"tailscale.com/tailcfg"
@@ -71,7 +70,6 @@ func NewClient(t testing.TB,
t: t,
logger: logger.Named("client"),
agentID: agentID,
coordinator: coordinator,
server: server,
fakeAgentAPI: fakeAAPI,
derpMapUpdates: derpMapUpdates,
@@ -82,7 +80,6 @@ type Client struct {
t testing.TB
logger slog.Logger
agentID uuid.UUID
coordinator tailnet.Coordinator
server *drpcserver.Server
fakeAgentAPI *FakeAgentAPI
LastWorkspaceAgent func()
@@ -99,7 +96,9 @@ func (c *Client) Close() {
c.derpMapOnce.Do(func() { close(c.derpMapUpdates) })
}
func (c *Client) ConnectRPC(ctx context.Context) (drpc.Conn, error) {
func (c *Client) ConnectRPC23(ctx context.Context) (
agentproto.DRPCAgentClient23, proto.DRPCTailnetClient23, error,
) {
conn, lis := drpcsdk.MemTransportPipe()
c.LastWorkspaceAgent = func() {
_ = conn.Close()
@@ -117,7 +116,7 @@ func (c *Client) ConnectRPC(ctx context.Context) (drpc.Conn, error) {
go func() {
_ = c.server.Serve(serveCtx, lis)
}()
return conn, nil
return agentproto.NewDRPCAgentClient(conn), proto.NewDRPCTailnetClient(conn), nil
}
func (c *Client) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle {
@@ -170,6 +169,7 @@ type FakeAgentAPI struct {
logsCh chan<- *agentproto.BatchCreateLogsRequest
lifecycleStates []codersdk.WorkspaceAgentLifecycle
metadata map[string]agentsdk.Metadata
timings []*agentproto.Timing
getAnnouncementBannersFunc func() ([]codersdk.BannerConfig, error)
}
@@ -182,6 +182,12 @@ func (*FakeAgentAPI) GetServiceBanner(context.Context, *agentproto.GetServiceBan
return &agentproto.ServiceBanner{}, nil
}
func (f *FakeAgentAPI) GetTimings() []*agentproto.Timing {
f.Lock()
defer f.Unlock()
return slices.Clone(f.timings)
}
func (f *FakeAgentAPI) SetAnnouncementBannersFunc(fn func() ([]codersdk.BannerConfig, error)) {
f.Lock()
defer f.Unlock()
@@ -210,7 +216,12 @@ func (f *FakeAgentAPI) UpdateStats(ctx context.Context, req *agentproto.UpdateSt
f.logger.Debug(ctx, "update stats called", slog.F("req", req))
// empty request is sent to get the interval; but our tests don't want empty stats requests
if req.Stats != nil {
f.statsCh <- req.Stats
select {
case <-ctx.Done():
return nil, ctx.Err()
case f.statsCh <- req.Stats:
// OK!
}
}
return &agentproto.UpdateStatsResponse{ReportInterval: durationpb.New(statsInterval)}, nil
}
@@ -233,17 +244,25 @@ func (f *FakeAgentAPI) UpdateLifecycle(_ context.Context, req *agentproto.Update
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))
f.appHealthCh <- req
return &agentproto.BatchUpdateAppHealthResponse{}, nil
select {
case <-ctx.Done():
return nil, ctx.Err()
case f.appHealthCh <- req:
return &agentproto.BatchUpdateAppHealthResponse{}, nil
}
}
func (f *FakeAgentAPI) AppHealthCh() <-chan *agentproto.BatchUpdateAppHealthRequest {
return f.appHealthCh
}
func (f *FakeAgentAPI) UpdateStartup(_ context.Context, req *agentproto.UpdateStartupRequest) (*agentproto.Startup, error) {
f.startupCh <- req.GetStartup()
return req.GetStartup(), nil
func (f *FakeAgentAPI) UpdateStartup(ctx context.Context, req *agentproto.UpdateStartupRequest) (*agentproto.Startup, error) {
select {
case <-ctx.Done():
return nil, ctx.Err()
case f.startupCh <- req.GetStartup():
return req.GetStartup(), nil
}
}
func (f *FakeAgentAPI) GetMetadata() map[string]agentsdk.Metadata {
@@ -288,6 +307,14 @@ func (f *FakeAgentAPI) BatchCreateLogs(ctx context.Context, req *agentproto.Batc
return &agentproto.BatchCreateLogsResponse{}, nil
}
func (f *FakeAgentAPI) ScriptCompleted(_ context.Context, req *agentproto.WorkspaceAgentScriptCompletedRequest) (*agentproto.WorkspaceAgentScriptCompletedResponse, error) {
f.Lock()
f.timings = append(f.timings, req.Timing)
f.Unlock()
return &agentproto.WorkspaceAgentScriptCompletedResponse{}, nil
}
func NewFakeAgentAPI(t testing.TB, logger slog.Logger, manifest *agentproto.Manifest, statsCh chan *agentproto.Stats) *FakeAgentAPI {
return &FakeAgentAPI{
t: t,
+1
View File
@@ -37,6 +37,7 @@ func (a *agent) apiHandler() http.Handler {
}
promHandler := PrometheusMetricsHandler(a.prometheusRegistry, a.logger)
r.Get("/api/v0/listening-ports", lp.handler)
r.Get("/api/v0/netcheck", a.HandleNetcheck)
r.Get("/debug/logs", a.HandleHTTPDebugLogs)
r.Get("/debug/magicsock", a.HandleHTTPDebugMagicsock)
r.Get("/debug/magicsock/debug-logging/{state}", a.HandleHTTPMagicsockDebugLoggingState)
+53 -59
View File
@@ -12,12 +12,9 @@ import (
"cdr.dev/slog"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/retry"
"github.com/coder/quartz"
)
// WorkspaceAgentApps fetches the workspace apps.
type WorkspaceAgentApps func(context.Context) ([]codersdk.WorkspaceApp, error)
// PostWorkspaceAgentAppHealth updates the workspace app health.
type PostWorkspaceAgentAppHealth func(context.Context, agentsdk.PostAppHealthsRequest) error
@@ -26,15 +23,26 @@ type WorkspaceAppHealthReporter func(ctx context.Context)
// NewWorkspaceAppHealthReporter creates a WorkspaceAppHealthReporter that reports app health to coderd.
func NewWorkspaceAppHealthReporter(logger slog.Logger, apps []codersdk.WorkspaceApp, postWorkspaceAgentAppHealth PostWorkspaceAgentAppHealth) WorkspaceAppHealthReporter {
return NewAppHealthReporterWithClock(logger, apps, postWorkspaceAgentAppHealth, quartz.NewReal())
}
// NewAppHealthReporterWithClock is only called directly by test code. Product code should call
// NewAppHealthReporter.
func NewAppHealthReporterWithClock(
logger slog.Logger,
apps []codersdk.WorkspaceApp,
postWorkspaceAgentAppHealth PostWorkspaceAgentAppHealth,
clk quartz.Clock,
) WorkspaceAppHealthReporter {
logger = logger.Named("apphealth")
runHealthcheckLoop := func(ctx context.Context) error {
return func(ctx context.Context) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
// no need to run this loop if no apps for this workspace.
if len(apps) == 0 {
return nil
return
}
hasHealthchecksEnabled := false
@@ -49,7 +57,7 @@ func NewWorkspaceAppHealthReporter(logger slog.Logger, apps []codersdk.Workspace
// no need to run this loop if no health checks are configured.
if !hasHealthchecksEnabled {
return nil
return
}
// run a ticker for each app health check.
@@ -61,25 +69,29 @@ func NewWorkspaceAppHealthReporter(logger slog.Logger, apps []codersdk.Workspace
}
app := nextApp
go func() {
t := time.NewTicker(time.Duration(app.Healthcheck.Interval) * time.Second)
defer t.Stop()
_ = clk.TickerFunc(ctx, time.Duration(app.Healthcheck.Interval)*time.Second, func() error {
// We time out at the healthcheck interval to prevent getting too backed up, but
// set it 1ms early so that it's not simultaneous with the next tick in testing,
// which makes the test easier to understand.
//
// It would be idiomatic to use the http.Client.Timeout or a context.WithTimeout,
// but we are passing this off to the native http library, which is not aware
// of the clock library we are using. That means in testing, with a mock clock
// it will compare mocked times with real times, and we will get strange results.
// So, we just implement the timeout as a context we cancel with an AfterFunc
reqCtx, reqCancel := context.WithCancel(ctx)
timeout := clk.AfterFunc(
time.Duration(app.Healthcheck.Interval)*time.Second-time.Millisecond,
reqCancel,
"timeout", app.Slug)
defer timeout.Stop()
for {
select {
case <-ctx.Done():
return
case <-t.C:
}
// we set the http timeout to the healthcheck interval to prevent getting too backed up.
client := &http.Client{
Timeout: time.Duration(app.Healthcheck.Interval) * time.Second,
}
err := func() error {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, app.Healthcheck.URL, nil)
req, err := http.NewRequestWithContext(reqCtx, http.MethodGet, app.Healthcheck.URL, nil)
if err != nil {
return err
}
res, err := client.Do(req)
res, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
@@ -118,54 +130,36 @@ func NewWorkspaceAppHealthReporter(logger slog.Logger, apps []codersdk.Workspace
mu.Unlock()
logger.Debug(ctx, "workspace app healthy", slog.F("id", app.ID.String()), slog.F("slug", app.Slug))
}
t.Reset(time.Duration(app.Healthcheck.Interval) * time.Second)
}
return nil
}, "healthcheck", app.Slug)
}()
}
mu.Lock()
lastHealth := copyHealth(health)
mu.Unlock()
reportTicker := time.NewTicker(time.Second)
defer reportTicker.Stop()
// every second we check if the health values of the apps have changed
// and if there is a change we will report the new values.
for {
select {
case <-ctx.Done():
reportTicker := clk.TickerFunc(ctx, time.Second, func() error {
mu.RLock()
changed := healthChanged(lastHealth, health)
mu.RUnlock()
if !changed {
return nil
case <-reportTicker.C:
mu.RLock()
changed := healthChanged(lastHealth, health)
mu.RUnlock()
if !changed {
continue
}
mu.Lock()
lastHealth = copyHealth(health)
mu.Unlock()
err := postWorkspaceAgentAppHealth(ctx, agentsdk.PostAppHealthsRequest{
Healths: lastHealth,
})
if err != nil {
logger.Error(ctx, "failed to report workspace app health", slog.Error(err))
} else {
logger.Debug(ctx, "sent workspace app health", slog.F("health", lastHealth))
}
}
}
}
return func(ctx context.Context) {
for r := retry.New(time.Second, 30*time.Second); r.Wait(ctx); {
err := runHealthcheckLoop(ctx)
if err == nil || xerrors.Is(err, context.Canceled) || xerrors.Is(err, context.DeadlineExceeded) {
return
mu.Lock()
lastHealth = copyHealth(health)
mu.Unlock()
err := postWorkspaceAgentAppHealth(ctx, agentsdk.PostAppHealthsRequest{
Healths: lastHealth,
})
if err != nil {
logger.Error(ctx, "failed to report workspace app health", slog.Error(err))
} else {
logger.Debug(ctx, "sent workspace app health", slog.F("health", lastHealth))
}
logger.Error(ctx, "failed running workspace app reporter", slog.Error(err))
}
return nil
}, "report")
_ = reportTicker.Wait() // only possible error is context done
}
}
+155 -116
View File
@@ -4,18 +4,14 @@ import (
"context"
"net/http"
"net/http/httptest"
"slices"
"strings"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/v2/agent"
"github.com/coder/coder/v2/agent/agenttest"
"github.com/coder/coder/v2/agent/proto"
@@ -23,19 +19,22 @@ import (
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/coder/v2/testutil"
"github.com/coder/quartz"
)
func TestAppHealth_Healthy(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort)
defer cancel()
apps := []codersdk.WorkspaceApp{
{
ID: uuid.UUID{1},
Slug: "app1",
Healthcheck: codersdk.Healthcheck{},
Health: codersdk.WorkspaceAppHealthDisabled,
},
{
ID: uuid.UUID{2},
Slug: "app2",
Healthcheck: codersdk.Healthcheck{
// URL: We don't set the URL for this test because the setup will
@@ -46,6 +45,7 @@ func TestAppHealth_Healthy(t *testing.T) {
Health: codersdk.WorkspaceAppHealthInitializing,
},
{
ID: uuid.UUID{3},
Slug: "app3",
Healthcheck: codersdk.Healthcheck{
Interval: 2,
@@ -54,36 +54,71 @@ func TestAppHealth_Healthy(t *testing.T) {
Health: codersdk.WorkspaceAppHealthInitializing,
},
}
checks2 := 0
checks3 := 0
handlers := []http.Handler{
nil,
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
checks2++
httpapi.Write(r.Context(), w, http.StatusOK, nil)
}),
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
checks3++
httpapi.Write(r.Context(), w, http.StatusOK, nil)
}),
}
getApps, closeFn := setupAppReporter(ctx, t, apps, handlers)
defer closeFn()
apps, err := getApps(ctx)
require.NoError(t, err)
require.EqualValues(t, codersdk.WorkspaceAppHealthDisabled, apps[0].Health)
require.Eventually(t, func() bool {
apps, err := getApps(ctx)
if err != nil {
return false
}
mClock := quartz.NewMock(t)
healthcheckTrap := mClock.Trap().TickerFunc("healthcheck")
defer healthcheckTrap.Close()
reportTrap := mClock.Trap().TickerFunc("report")
defer reportTrap.Close()
return apps[1].Health == codersdk.WorkspaceAppHealthHealthy && apps[2].Health == codersdk.WorkspaceAppHealthHealthy
}, testutil.WaitLong, testutil.IntervalSlow)
fakeAPI, closeFn := setupAppReporter(ctx, t, slices.Clone(apps), handlers, mClock)
defer closeFn()
healthchecksStarted := make([]string, 2)
for i := 0; i < 2; i++ {
c := healthcheckTrap.MustWait(ctx)
c.Release()
healthchecksStarted[i] = c.Tags[1]
}
slices.Sort(healthchecksStarted)
require.Equal(t, []string{"app2", "app3"}, healthchecksStarted)
// advance the clock 1ms before the report ticker starts, so that it's not
// simultaneous with the checks.
mClock.Advance(time.Millisecond).MustWait(ctx)
reportTrap.MustWait(ctx).Release()
mClock.Advance(999 * time.Millisecond).MustWait(ctx) // app2 is now healthy
mClock.Advance(time.Millisecond).MustWait(ctx) // report gets triggered
update := testutil.RequireRecvCtx(ctx, t, fakeAPI.AppHealthCh())
require.Len(t, update.GetUpdates(), 2)
applyUpdate(t, apps, update)
require.Equal(t, codersdk.WorkspaceAppHealthHealthy, apps[1].Health)
require.Equal(t, codersdk.WorkspaceAppHealthInitializing, apps[2].Health)
mClock.Advance(999 * time.Millisecond).MustWait(ctx) // app3 is now healthy
mClock.Advance(time.Millisecond).MustWait(ctx) // report gets triggered
update = testutil.RequireRecvCtx(ctx, t, fakeAPI.AppHealthCh())
require.Len(t, update.GetUpdates(), 2)
applyUpdate(t, apps, update)
require.Equal(t, codersdk.WorkspaceAppHealthHealthy, apps[1].Health)
require.Equal(t, codersdk.WorkspaceAppHealthHealthy, apps[2].Health)
// ensure we aren't spamming
require.Equal(t, 2, checks2)
require.Equal(t, 1, checks3)
}
func TestAppHealth_500(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort)
defer cancel()
apps := []codersdk.WorkspaceApp{
{
ID: uuid.UUID{2},
Slug: "app2",
Healthcheck: codersdk.Healthcheck{
// URL: We don't set the URL for this test because the setup will
@@ -99,59 +134,40 @@ func TestAppHealth_500(t *testing.T) {
httpapi.Write(r.Context(), w, http.StatusInternalServerError, nil)
}),
}
getApps, closeFn := setupAppReporter(ctx, t, apps, handlers)
defer closeFn()
require.Eventually(t, func() bool {
apps, err := getApps(ctx)
if err != nil {
return false
}
return apps[0].Health == codersdk.WorkspaceAppHealthUnhealthy
}, testutil.WaitLong, testutil.IntervalSlow)
mClock := quartz.NewMock(t)
healthcheckTrap := mClock.Trap().TickerFunc("healthcheck")
defer healthcheckTrap.Close()
reportTrap := mClock.Trap().TickerFunc("report")
defer reportTrap.Close()
fakeAPI, closeFn := setupAppReporter(ctx, t, slices.Clone(apps), handlers, mClock)
defer closeFn()
healthcheckTrap.MustWait(ctx).Release()
// advance the clock 1ms before the report ticker starts, so that it's not
// simultaneous with the checks.
mClock.Advance(time.Millisecond).MustWait(ctx)
reportTrap.MustWait(ctx).Release()
mClock.Advance(999 * time.Millisecond).MustWait(ctx) // check gets triggered
mClock.Advance(time.Millisecond).MustWait(ctx) // report gets triggered, but unsent since we are at the threshold
mClock.Advance(999 * time.Millisecond).MustWait(ctx) // 2nd check, crosses threshold
mClock.Advance(time.Millisecond).MustWait(ctx) // 2nd report, sends update
update := testutil.RequireRecvCtx(ctx, t, fakeAPI.AppHealthCh())
require.Len(t, update.GetUpdates(), 1)
applyUpdate(t, apps, update)
require.Equal(t, codersdk.WorkspaceAppHealthUnhealthy, apps[0].Health)
}
func TestAppHealth_Timeout(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
apps := []codersdk.WorkspaceApp{
{
Slug: "app2",
Healthcheck: codersdk.Healthcheck{
// URL: We don't set the URL for this test because the setup will
// create a httptest server for us and set it for us.
Interval: 1,
Threshold: 1,
},
Health: codersdk.WorkspaceAppHealthInitializing,
},
}
handlers := []http.Handler{
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// sleep longer than the interval to cause the health check to time out
time.Sleep(2 * time.Second)
httpapi.Write(r.Context(), w, http.StatusOK, nil)
}),
}
getApps, closeFn := setupAppReporter(ctx, t, apps, handlers)
defer closeFn()
require.Eventually(t, func() bool {
apps, err := getApps(ctx)
if err != nil {
return false
}
return apps[0].Health == codersdk.WorkspaceAppHealthUnhealthy
}, testutil.WaitLong, testutil.IntervalSlow)
}
func TestAppHealth_NotSpamming(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort)
defer cancel()
apps := []codersdk.WorkspaceApp{
{
ID: uuid.UUID{2},
Slug: "app2",
Healthcheck: codersdk.Healthcheck{
// URL: We don't set the URL for this test because the setup will
@@ -163,27 +179,65 @@ func TestAppHealth_NotSpamming(t *testing.T) {
},
}
counter := new(int32)
handlers := []http.Handler{
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
atomic.AddInt32(counter, 1)
http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
// allow the request to time out
<-r.Context().Done()
}),
}
_, closeFn := setupAppReporter(ctx, t, apps, handlers)
mClock := quartz.NewMock(t)
start := mClock.Now()
// for this test, it's easier to think in the number of milliseconds elapsed
// since start.
ms := func(n int) time.Time {
return start.Add(time.Duration(n) * time.Millisecond)
}
healthcheckTrap := mClock.Trap().TickerFunc("healthcheck")
defer healthcheckTrap.Close()
reportTrap := mClock.Trap().TickerFunc("report")
defer reportTrap.Close()
timeoutTrap := mClock.Trap().AfterFunc("timeout")
defer timeoutTrap.Close()
fakeAPI, closeFn := setupAppReporter(ctx, t, apps, handlers, mClock)
defer closeFn()
// Ensure we haven't made more than 2 (expected 1 + 1 for buffer) requests in the last second.
// if there is a bug where we are spamming the healthcheck route this will catch it.
time.Sleep(time.Second)
require.LessOrEqual(t, atomic.LoadInt32(counter), int32(2))
healthcheckTrap.MustWait(ctx).Release()
// advance the clock 1ms before the report ticker starts, so that it's not
// simultaneous with the checks.
mClock.Set(ms(1)).MustWait(ctx)
reportTrap.MustWait(ctx).Release()
w := mClock.Set(ms(1000)) // 1st check starts
timeoutTrap.MustWait(ctx).Release()
mClock.Set(ms(1001)).MustWait(ctx) // report tick, no change
mClock.Set(ms(1999)) // timeout pops
w.MustWait(ctx) // 1st check finished
w = mClock.Set(ms(2000)) // 2nd check starts
timeoutTrap.MustWait(ctx).Release()
mClock.Set(ms(2001)).MustWait(ctx) // report tick, no change
mClock.Set(ms(2999)) // timeout pops
w.MustWait(ctx) // 2nd check finished
// app is now unhealthy after 2 timeouts
mClock.Set(ms(3000)) // 3rd check starts
timeoutTrap.MustWait(ctx).Release()
mClock.Set(ms(3001)).MustWait(ctx) // report tick, sends changes
update := testutil.RequireRecvCtx(ctx, t, fakeAPI.AppHealthCh())
require.Len(t, update.GetUpdates(), 1)
applyUpdate(t, apps, update)
require.Equal(t, codersdk.WorkspaceAppHealthUnhealthy, apps[0].Health)
}
func setupAppReporter(ctx context.Context, t *testing.T, apps []codersdk.WorkspaceApp, handlers []http.Handler) (agent.WorkspaceAgentApps, func()) {
func setupAppReporter(
ctx context.Context, t *testing.T,
apps []codersdk.WorkspaceApp,
handlers []http.Handler,
clk quartz.Clock,
) (*agenttest.FakeAgentAPI, func()) {
closers := []func(){}
for i, app := range apps {
if app.ID == uuid.Nil {
app.ID = uuid.New()
apps[i] = app
}
for _, app := range apps {
require.NotEqual(t, uuid.Nil, app.ID, "all apps must have ID set")
}
for i, handler := range handlers {
if handler == nil {
@@ -196,54 +250,39 @@ func setupAppReporter(ctx context.Context, t *testing.T, apps []codersdk.Workspa
closers = append(closers, ts.Close)
}
var mu sync.Mutex
workspaceAgentApps := func(context.Context) ([]codersdk.WorkspaceApp, error) {
mu.Lock()
defer mu.Unlock()
var newApps []codersdk.WorkspaceApp
return append(newApps, apps...), nil
}
// We don't care about manifest or stats in this test since it's not using
// a full agent and these RPCs won't get called.
//
// We use a proper fake agent API so we can test the conversion code and the
// request code as well. Before we were bypassing these by using a custom
// post function.
fakeAAPI := agenttest.NewFakeAgentAPI(t, slogtest.Make(t, nil), nil, nil)
fakeAAPI := agenttest.NewFakeAgentAPI(t, testutil.Logger(t), nil, nil)
// Process events from the channel and update the health of the apps.
go func() {
appHealthCh := fakeAAPI.AppHealthCh()
for {
select {
case <-ctx.Done():
return
case req := <-appHealthCh:
mu.Lock()
for _, update := range req.Updates {
updateID, err := uuid.FromBytes(update.Id)
assert.NoError(t, err)
updateHealth := codersdk.WorkspaceAppHealth(strings.ToLower(proto.AppHealth_name[int32(update.Health)]))
go agent.NewAppHealthReporterWithClock(
testutil.Logger(t),
apps, agentsdk.AppHealthPoster(fakeAAPI), clk,
)(ctx)
for i, app := range apps {
if app.ID != updateID {
continue
}
app.Health = updateHealth
apps[i] = app
}
}
mu.Unlock()
}
}
}()
go agent.NewWorkspaceAppHealthReporter(slogtest.Make(t, nil).Leveled(slog.LevelDebug), apps, agentsdk.AppHealthPoster(fakeAAPI))(ctx)
return workspaceAgentApps, func() {
return fakeAAPI, func() {
for _, closeFn := range closers {
closeFn()
}
}
}
func applyUpdate(t *testing.T, apps []codersdk.WorkspaceApp, req *proto.BatchUpdateAppHealthRequest) {
t.Helper()
for _, update := range req.Updates {
updateID, err := uuid.FromBytes(update.Id)
require.NoError(t, err)
updateHealth := codersdk.WorkspaceAppHealth(strings.ToLower(proto.AppHealth_name[int32(update.Health)]))
for i, app := range apps {
if app.ID != updateID {
continue
}
app.Health = updateHealth
apps[i] = app
}
}
}
+2 -2
View File
@@ -12,7 +12,7 @@ import (
func TestCheckpoint_CompleteWait(t *testing.T) {
t.Parallel()
logger := slogtest.Make(t, nil)
logger := testutil.Logger(t)
ctx := testutil.Context(t, testutil.WaitShort)
uut := newCheckpoint(logger)
err := xerrors.New("test")
@@ -35,7 +35,7 @@ func TestCheckpoint_CompleteTwice(t *testing.T) {
func TestCheckpoint_WaitComplete(t *testing.T) {
t.Parallel()
logger := slogtest.Make(t, nil)
logger := testutil.Logger(t)
ctx := testutil.Context(t, testutil.WaitShort)
uut := newCheckpoint(logger)
err := xerrors.New("test")
+31
View File
@@ -0,0 +1,31 @@
package agent
import (
"net/http"
"github.com/coder/coder/v2/coderd/healthcheck/health"
"github.com/coder/coder/v2/coderd/httpapi"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/healthsdk"
)
func (a *agent) HandleNetcheck(rw http.ResponseWriter, r *http.Request) {
ni := a.TailnetConn().GetNetInfo()
ifReport, err := healthsdk.RunInterfacesReport()
if err != nil {
httpapi.Write(r.Context(), rw, http.StatusInternalServerError, codersdk.Response{
Message: "Failed to run interfaces report",
Detail: err.Error(),
})
return
}
httpapi.Write(r.Context(), rw, http.StatusOK, healthsdk.AgentNetcheckReport{
BaseReport: healthsdk.BaseReport{
Severity: health.SeverityOK,
},
NetInfo: ni,
Interfaces: ifReport,
})
}
+10
View File
@@ -19,6 +19,7 @@ type agentMetrics struct {
// startupScriptSeconds is the time in seconds that the start script(s)
// took to run. This is reported once per agent.
startupScriptSeconds *prometheus.GaugeVec
currentConnections *prometheus.GaugeVec
}
func newAgentMetrics(registerer prometheus.Registerer) *agentMetrics {
@@ -45,10 +46,19 @@ func newAgentMetrics(registerer prometheus.Registerer) *agentMetrics {
}, []string{"success"})
registerer.MustRegister(startupScriptSeconds)
currentConnections := prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "coderd",
Subsystem: "agentstats",
Name: "currently_reachable_peers",
Help: "The number of peers (e.g. clients) that are currently reachable over the encrypted network.",
}, []string{"connection_type"})
registerer.MustRegister(currentConnections)
return &agentMetrics{
connectionsTotal: connectionsTotal,
reconnectingPTYErrors: reconnectingPTYErrors,
startupScriptSeconds: startupScriptSeconds,
currentConnections: currentConnections,
}
}
+881 -491
View File
File diff suppressed because it is too large Load Diff
+33
View File
@@ -41,6 +41,7 @@ message WorkspaceApp {
UNHEALTHY = 4;
}
Health health = 12;
bool hidden = 13;
}
message WorkspaceAgentScript {
@@ -52,6 +53,8 @@ message WorkspaceAgentScript {
bool run_on_stop = 6;
bool start_blocks_login = 7;
google.protobuf.Duration timeout = 8;
string display_name = 9;
bytes id = 10;
}
message WorkspaceAgentMetadata {
@@ -263,6 +266,35 @@ message BannerConfig {
string background_color = 3;
}
message WorkspaceAgentScriptCompletedRequest {
Timing timing = 1;
}
message WorkspaceAgentScriptCompletedResponse {
}
message Timing {
bytes script_id = 1;
google.protobuf.Timestamp start = 2;
google.protobuf.Timestamp end = 3;
int32 exit_code = 4;
enum Stage {
START = 0;
STOP = 1;
CRON = 2;
}
Stage stage = 5;
enum Status {
OK = 0;
EXIT_FAILURE = 1;
TIMED_OUT = 2;
PIPES_LEFT_OPEN = 3;
}
Status status = 6;
}
service Agent {
rpc GetManifest(GetManifestRequest) returns (Manifest);
rpc GetServiceBanner(GetServiceBannerRequest) returns (ServiceBanner);
@@ -273,4 +305,5 @@ service Agent {
rpc BatchUpdateMetadata(BatchUpdateMetadataRequest) returns (BatchUpdateMetadataResponse);
rpc BatchCreateLogs(BatchCreateLogsRequest) returns (BatchCreateLogsResponse);
rpc GetAnnouncementBanners(GetAnnouncementBannersRequest) returns (GetAnnouncementBannersResponse);
rpc ScriptCompleted(WorkspaceAgentScriptCompletedRequest) returns (WorkspaceAgentScriptCompletedResponse);
}
+41 -1
View File
@@ -47,6 +47,7 @@ type DRPCAgentClient interface {
BatchUpdateMetadata(ctx context.Context, in *BatchUpdateMetadataRequest) (*BatchUpdateMetadataResponse, error)
BatchCreateLogs(ctx context.Context, in *BatchCreateLogsRequest) (*BatchCreateLogsResponse, error)
GetAnnouncementBanners(ctx context.Context, in *GetAnnouncementBannersRequest) (*GetAnnouncementBannersResponse, error)
ScriptCompleted(ctx context.Context, in *WorkspaceAgentScriptCompletedRequest) (*WorkspaceAgentScriptCompletedResponse, error)
}
type drpcAgentClient struct {
@@ -140,6 +141,15 @@ func (c *drpcAgentClient) GetAnnouncementBanners(ctx context.Context, in *GetAnn
return out, nil
}
func (c *drpcAgentClient) ScriptCompleted(ctx context.Context, in *WorkspaceAgentScriptCompletedRequest) (*WorkspaceAgentScriptCompletedResponse, error) {
out := new(WorkspaceAgentScriptCompletedResponse)
err := c.cc.Invoke(ctx, "/coder.agent.v2.Agent/ScriptCompleted", 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)
@@ -150,6 +160,7 @@ type DRPCAgentServer interface {
BatchUpdateMetadata(context.Context, *BatchUpdateMetadataRequest) (*BatchUpdateMetadataResponse, error)
BatchCreateLogs(context.Context, *BatchCreateLogsRequest) (*BatchCreateLogsResponse, error)
GetAnnouncementBanners(context.Context, *GetAnnouncementBannersRequest) (*GetAnnouncementBannersResponse, error)
ScriptCompleted(context.Context, *WorkspaceAgentScriptCompletedRequest) (*WorkspaceAgentScriptCompletedResponse, error)
}
type DRPCAgentUnimplementedServer struct{}
@@ -190,9 +201,13 @@ func (s *DRPCAgentUnimplementedServer) GetAnnouncementBanners(context.Context, *
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCAgentUnimplementedServer) ScriptCompleted(context.Context, *WorkspaceAgentScriptCompletedRequest) (*WorkspaceAgentScriptCompletedResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
type DRPCAgentDescription struct{}
func (DRPCAgentDescription) NumMethods() int { return 9 }
func (DRPCAgentDescription) NumMethods() int { return 10 }
func (DRPCAgentDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n {
@@ -277,6 +292,15 @@ func (DRPCAgentDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver,
in1.(*GetAnnouncementBannersRequest),
)
}, DRPCAgentServer.GetAnnouncementBanners, true
case 9:
return "/coder.agent.v2.Agent/ScriptCompleted", drpcEncoding_File_agent_proto_agent_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAgentServer).
ScriptCompleted(
ctx,
in1.(*WorkspaceAgentScriptCompletedRequest),
)
}, DRPCAgentServer.ScriptCompleted, true
default:
return "", nil, nil, nil, false
}
@@ -429,3 +453,19 @@ func (x *drpcAgent_GetAnnouncementBannersStream) SendAndClose(m *GetAnnouncement
}
return x.CloseSend()
}
type DRPCAgent_ScriptCompletedStream interface {
drpc.Stream
SendAndClose(*WorkspaceAgentScriptCompletedResponse) error
}
type drpcAgent_ScriptCompletedStream struct {
drpc.Stream
}
func (x *drpcAgent_ScriptCompletedStream) SendAndClose(m *WorkspaceAgentScriptCompletedResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_agent_proto_agent_proto{}); err != nil {
return err
}
return x.CloseSend()
}
+42
View File
@@ -0,0 +1,42 @@
package proto
import (
"context"
"storj.io/drpc"
)
// DRPCAgentClient20 is the Agent API at v2.0. Notably, it is missing GetAnnouncementBanners, but
// is useful when you want to be maximally compatible with Coderd Release Versions from 2.9+
type DRPCAgentClient20 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)
}
// DRPCAgentClient21 is the Agent API at v2.1. It is useful if you want to be maximally compatible
// with Coderd Release Versions from 2.12+
type DRPCAgentClient21 interface {
DRPCAgentClient20
GetAnnouncementBanners(ctx context.Context, in *GetAnnouncementBannersRequest) (*GetAnnouncementBannersResponse, error)
}
// DRPCAgentClient22 is the Agent API at v2.2. It is identical to 2.1, since the change was made on
// the Tailnet API, which uses the same version number. Compatible with Coder v2.13+
type DRPCAgentClient22 interface {
DRPCAgentClient21
}
// DRPCAgentClient23 is the Agent API at v2.3. It adds the ScriptCompleted RPC. Compatible with
// Coder v2.18+
type DRPCAgentClient23 interface {
DRPCAgentClient22
ScriptCompleted(ctx context.Context, in *WorkspaceAgentScriptCompletedRequest) (*WorkspaceAgentScriptCompletedResponse, error)
}
+2 -2
View File
@@ -67,8 +67,6 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.
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.
@@ -124,6 +122,8 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.
return rpty
}
go rpty.lifecycle(ctx, logger)
return rpty
}
+191
View File
@@ -0,0 +1,191 @@
package reconnectingpty
import (
"context"
"encoding/binary"
"encoding/json"
"net"
"sync"
"sync/atomic"
"time"
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/xerrors"
"cdr.dev/slog"
"github.com/coder/coder/v2/agent/agentssh"
"github.com/coder/coder/v2/codersdk/workspacesdk"
)
type Server struct {
logger slog.Logger
connectionsTotal prometheus.Counter
errorsTotal *prometheus.CounterVec
commandCreator *agentssh.Server
connCount atomic.Int64
reconnectingPTYs sync.Map
timeout time.Duration
}
// NewServer returns a new ReconnectingPTY server
func NewServer(logger slog.Logger, commandCreator *agentssh.Server,
connectionsTotal prometheus.Counter, errorsTotal *prometheus.CounterVec,
timeout time.Duration,
) *Server {
return &Server{
logger: logger,
commandCreator: commandCreator,
connectionsTotal: connectionsTotal,
errorsTotal: errorsTotal,
timeout: timeout,
}
}
func (s *Server) Serve(ctx, hardCtx context.Context, l net.Listener) (retErr error) {
var wg sync.WaitGroup
for {
if ctx.Err() != nil {
break
}
conn, err := l.Accept()
if err != nil {
s.logger.Debug(ctx, "accept pty failed", slog.Error(err))
retErr = err
break
}
clog := s.logger.With(
slog.F("remote", conn.RemoteAddr().String()),
slog.F("local", conn.LocalAddr().String()))
clog.Info(ctx, "accepted conn")
wg.Add(1)
closed := make(chan struct{})
go func() {
select {
case <-closed:
case <-hardCtx.Done():
_ = conn.Close()
}
wg.Done()
}()
wg.Add(1)
go func() {
defer close(closed)
defer wg.Done()
_ = s.handleConn(ctx, clog, conn)
}()
}
wg.Wait()
return retErr
}
func (s *Server) ConnCount() int64 {
return s.connCount.Load()
}
func (s *Server) handleConn(ctx context.Context, logger slog.Logger, conn net.Conn) (retErr error) {
defer conn.Close()
s.connectionsTotal.Add(1)
s.connCount.Add(1)
defer s.connCount.Add(-1)
// This cannot use a JSON decoder, since that can
// buffer additional data that is required for the PTY.
rawLen := make([]byte, 2)
_, err := conn.Read(rawLen)
if err != nil {
// logging at info since a single incident isn't too worrying (the client could just have
// hung up), but if we get a lot of these we'd want to investigate.
logger.Info(ctx, "failed to read AgentReconnectingPTYInit length", slog.Error(err))
return nil
}
length := binary.LittleEndian.Uint16(rawLen)
data := make([]byte, length)
_, err = conn.Read(data)
if err != nil {
// logging at info since a single incident isn't too worrying (the client could just have
// hung up), but if we get a lot of these we'd want to investigate.
logger.Info(ctx, "failed to read AgentReconnectingPTYInit", slog.Error(err))
return nil
}
var msg workspacesdk.AgentReconnectingPTYInit
err = json.Unmarshal(data, &msg)
if err != nil {
logger.Warn(ctx, "failed to unmarshal init", slog.F("raw", data))
return nil
}
connectionID := uuid.NewString()
connLogger := logger.With(slog.F("message_id", msg.ID), slog.F("connection_id", connectionID))
connLogger.Debug(ctx, "starting handler")
defer func() {
if err := retErr; err != nil {
// If the context is done, we don't want to log this as an error since it's expected.
if ctx.Err() != nil {
connLogger.Info(ctx, "reconnecting pty failed with attach error (agent closed)", slog.Error(err))
} else {
connLogger.Error(ctx, "reconnecting pty failed with attach error", slog.Error(err))
}
}
connLogger.Info(ctx, "reconnecting pty connection closed")
}()
var rpty ReconnectingPTY
sendConnected := make(chan ReconnectingPTY, 1)
// On store, reserve this ID to prevent multiple concurrent new connections.
waitReady, ok := s.reconnectingPTYs.LoadOrStore(msg.ID, sendConnected)
if ok {
close(sendConnected) // Unused.
connLogger.Debug(ctx, "connecting to existing reconnecting pty")
c, ok := waitReady.(chan ReconnectingPTY)
if !ok {
return xerrors.Errorf("found invalid type in reconnecting pty map: %T", waitReady)
}
rpty, ok = <-c
if !ok || rpty == nil {
return xerrors.Errorf("reconnecting pty closed before connection")
}
c <- rpty // Put it back for the next reconnect.
} else {
connLogger.Debug(ctx, "creating new reconnecting pty")
connected := false
defer func() {
if !connected && retErr != nil {
s.reconnectingPTYs.Delete(msg.ID)
close(sendConnected)
}
}()
// Empty command will default to the users shell!
cmd, err := s.commandCreator.CreateCommand(ctx, msg.Command, nil)
if err != nil {
s.errorsTotal.WithLabelValues("create_command").Add(1)
return xerrors.Errorf("create command: %w", err)
}
rpty = New(ctx, cmd, &Options{
Timeout: s.timeout,
Metrics: s.errorsTotal,
}, logger.With(slog.F("message_id", msg.ID)))
done := make(chan struct{})
go func() {
select {
case <-done:
case <-ctx.Done():
rpty.Close(ctx.Err())
}
}()
go func() {
rpty.Wait()
s.reconnectingPTYs.Delete(msg.ID)
}()
connected = true
sendConnected <- rpty
}
return rpty.Attach(ctx, connectionID, conn, msg.Height, msg.Width, connLogger)
}
+1 -2
View File
@@ -18,7 +18,6 @@ import (
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogjson"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/testutil"
)
@@ -26,7 +25,7 @@ import (
func TestStatsReporter(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug)
logger := testutil.Logger(t)
fSource := newFakeNetworkStatsSource(ctx, t)
fCollector := newFakeCollector(t)
fDest := newFakeStatsDest()
+1 -1
View File
@@ -26,7 +26,7 @@ type APIVersion struct {
}
func (v *APIVersion) WithBackwardCompat(majs ...int) *APIVersion {
v.additionalMajors = append(v.additionalMajors, majs[:]...)
v.additionalMajors = append(v.additionalMajors, majs...)
return v
}
+14 -11
View File
@@ -1,4 +1,4 @@
package coderd
package archive
import (
"archive/tar"
@@ -10,21 +10,22 @@ import (
"strings"
)
func CreateTarFromZip(zipReader *zip.Reader) ([]byte, error) {
// CreateTarFromZip converts the given zipReader to a tar archive.
func CreateTarFromZip(zipReader *zip.Reader, maxSize int64) ([]byte, error) {
var tarBuffer bytes.Buffer
err := writeTarArchive(&tarBuffer, zipReader)
err := writeTarArchive(&tarBuffer, zipReader, maxSize)
if err != nil {
return nil, err
}
return tarBuffer.Bytes(), nil
}
func writeTarArchive(w io.Writer, zipReader *zip.Reader) error {
func writeTarArchive(w io.Writer, zipReader *zip.Reader, maxSize int64) error {
tarWriter := tar.NewWriter(w)
defer tarWriter.Close()
for _, file := range zipReader.File {
err := processFileInZipArchive(file, tarWriter)
err := processFileInZipArchive(file, tarWriter, maxSize)
if err != nil {
return err
}
@@ -32,7 +33,7 @@ func writeTarArchive(w io.Writer, zipReader *zip.Reader) error {
return nil
}
func processFileInZipArchive(file *zip.File, tarWriter *tar.Writer) error {
func processFileInZipArchive(file *zip.File, tarWriter *tar.Writer, maxSize int64) error {
fileReader, err := file.Open()
if err != nil {
return err
@@ -52,7 +53,7 @@ func processFileInZipArchive(file *zip.File, tarWriter *tar.Writer) error {
return err
}
n, err := io.CopyN(tarWriter, fileReader, httpFileMaxBytes)
n, err := io.CopyN(tarWriter, fileReader, maxSize)
log.Println(file.Name, n, err)
if errors.Is(err, io.EOF) {
err = nil
@@ -60,16 +61,18 @@ func processFileInZipArchive(file *zip.File, tarWriter *tar.Writer) error {
return err
}
func CreateZipFromTar(tarReader *tar.Reader) ([]byte, error) {
// CreateZipFromTar converts the given tarReader to a zip archive.
func CreateZipFromTar(tarReader *tar.Reader, maxSize int64) ([]byte, error) {
var zipBuffer bytes.Buffer
err := WriteZipArchive(&zipBuffer, tarReader)
err := WriteZip(&zipBuffer, tarReader, maxSize)
if err != nil {
return nil, err
}
return zipBuffer.Bytes(), nil
}
func WriteZipArchive(w io.Writer, tarReader *tar.Reader) error {
// WriteZip writes the given tarReader to w.
func WriteZip(w io.Writer, tarReader *tar.Reader, maxSize int64) error {
zipWriter := zip.NewWriter(w)
defer zipWriter.Close()
@@ -100,7 +103,7 @@ func WriteZipArchive(w io.Writer, tarReader *tar.Reader) error {
return err
}
_, err = io.CopyN(zipEntry, tarReader, httpFileMaxBytes)
_, err = io.CopyN(zipEntry, tarReader, maxSize)
if errors.Is(err, io.EOF) {
err = nil
}
@@ -1,10 +1,9 @@
package coderd_test
package archive_test
import (
"archive/tar"
"archive/zip"
"bytes"
"io"
"io/fs"
"os"
"os/exec"
@@ -12,13 +11,12 @@ import (
"runtime"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/xerrors"
"github.com/coder/coder/v2/coderd"
"github.com/coder/coder/v2/archive"
"github.com/coder/coder/v2/archive/archivetest"
"github.com/coder/coder/v2/testutil"
)
@@ -30,18 +28,17 @@ func TestCreateTarFromZip(t *testing.T) {
// Read a zip file we prepared earlier
ctx := testutil.Context(t, testutil.WaitShort)
zipBytes, err := os.ReadFile(filepath.Join("testdata", "test.zip"))
require.NoError(t, err, "failed to read sample zip file")
zipBytes := archivetest.TestZipFileBytes()
// Assert invariant
assertSampleZipFile(t, zipBytes)
archivetest.AssertSampleZipFile(t, zipBytes)
zr, err := zip.NewReader(bytes.NewReader(zipBytes), int64(len(zipBytes)))
require.NoError(t, err, "failed to parse sample zip file")
tarBytes, err := coderd.CreateTarFromZip(zr)
tarBytes, err := archive.CreateTarFromZip(zr, int64(len(zipBytes)))
require.NoError(t, err, "failed to convert zip to tar")
assertSampleTarFile(t, tarBytes)
archivetest.AssertSampleTarFile(t, tarBytes)
tempDir := t.TempDir()
tempFilePath := filepath.Join(tempDir, "test.tar")
@@ -60,14 +57,13 @@ func TestCreateZipFromTar(t *testing.T) {
}
t.Run("OK", func(t *testing.T) {
t.Parallel()
tarBytes, err := os.ReadFile(filepath.Join(".", "testdata", "test.tar"))
require.NoError(t, err, "failed to read sample tar file")
tarBytes := archivetest.TestTarFileBytes()
tr := tar.NewReader(bytes.NewReader(tarBytes))
zipBytes, err := coderd.CreateZipFromTar(tr)
zipBytes, err := archive.CreateZipFromTar(tr, int64(len(tarBytes)))
require.NoError(t, err)
assertSampleZipFile(t, zipBytes)
archivetest.AssertSampleZipFile(t, zipBytes)
tempDir := t.TempDir()
tempFilePath := filepath.Join(tempDir, "test.zip")
@@ -99,7 +95,7 @@ func TestCreateZipFromTar(t *testing.T) {
// When: we convert this to a zip
tr := tar.NewReader(&tarBytes)
zipBytes, err := coderd.CreateZipFromTar(tr)
zipBytes, err := archive.CreateZipFromTar(tr, int64(tarBytes.Len()))
require.NoError(t, err)
// Then: the resulting zip should contain a corresponding directory
@@ -133,7 +129,7 @@ func assertExtractedFiles(t *testing.T, dir string, checkModePerm bool) {
if checkModePerm {
assert.Equal(t, fs.ModePerm&0o755, stat.Mode().Perm(), "expected mode 0755 on directory")
}
assert.Equal(t, archiveRefTime(t).UTC(), stat.ModTime().UTC(), "unexpected modtime of %q", path)
assert.Equal(t, archivetest.ArchiveRefTime(t).UTC(), stat.ModTime().UTC(), "unexpected modtime of %q", path)
case "/test/hello.txt":
stat, err := os.Stat(path)
assert.NoError(t, err, "failed to stat path %q", path)
@@ -168,84 +164,3 @@ func assertExtractedFiles(t *testing.T, dir string, checkModePerm bool) {
return nil
})
}
func assertSampleTarFile(t *testing.T, tarBytes []byte) {
t.Helper()
tr := tar.NewReader(bytes.NewReader(tarBytes))
for {
hdr, err := tr.Next()
if err != nil {
if err == io.EOF {
return
}
require.NoError(t, err)
}
// Note: ignoring timezones here.
require.Equal(t, archiveRefTime(t).UTC(), hdr.ModTime.UTC())
switch hdr.Name {
case "test/":
require.Equal(t, hdr.Typeflag, byte(tar.TypeDir))
case "test/hello.txt":
require.Equal(t, hdr.Typeflag, byte(tar.TypeReg))
bs, err := io.ReadAll(tr)
if err != nil && !xerrors.Is(err, io.EOF) {
require.NoError(t, err)
}
require.Equal(t, "hello", string(bs))
case "test/dir/":
require.Equal(t, hdr.Typeflag, byte(tar.TypeDir))
case "test/dir/world.txt":
require.Equal(t, hdr.Typeflag, byte(tar.TypeReg))
bs, err := io.ReadAll(tr)
if err != nil && !xerrors.Is(err, io.EOF) {
require.NoError(t, err)
}
require.Equal(t, "world", string(bs))
default:
require.Failf(t, "unexpected file in tar", hdr.Name)
}
}
}
func assertSampleZipFile(t *testing.T, zipBytes []byte) {
t.Helper()
zr, err := zip.NewReader(bytes.NewReader(zipBytes), int64(len(zipBytes)))
require.NoError(t, err)
for _, f := range zr.File {
// Note: ignoring timezones here.
require.Equal(t, archiveRefTime(t).UTC(), f.Modified.UTC())
switch f.Name {
case "test/", "test/dir/":
// directory
case "test/hello.txt":
rc, err := f.Open()
require.NoError(t, err)
bs, err := io.ReadAll(rc)
_ = rc.Close()
require.NoError(t, err)
require.Equal(t, "hello", string(bs))
case "test/dir/world.txt":
rc, err := f.Open()
require.NoError(t, err)
bs, err := io.ReadAll(rc)
_ = rc.Close()
require.NoError(t, err)
require.Equal(t, "world", string(bs))
default:
require.Failf(t, "unexpected file in zip", f.Name)
}
}
}
// archiveRefTime is the Go reference time. The contents of the sample tar and zip files
// in testdata/ all have their modtimes set to the below in some timezone.
func archiveRefTime(t *testing.T) time.Time {
locMST, err := time.LoadLocation("MST")
require.NoError(t, err, "failed to load MST timezone")
return time.Date(2006, 1, 2, 3, 4, 5, 0, locMST)
}
+113
View File
@@ -0,0 +1,113 @@
package archivetest
import (
"archive/tar"
"archive/zip"
"bytes"
_ "embed"
"io"
"testing"
"time"
"github.com/stretchr/testify/require"
"golang.org/x/xerrors"
)
//go:embed testdata/test.tar
var testTarFileBytes []byte
//go:embed testdata/test.zip
var testZipFileBytes []byte
// TestTarFileBytes returns the content of testdata/test.tar
func TestTarFileBytes() []byte {
return append([]byte{}, testTarFileBytes...)
}
// TestZipFileBytes returns the content of testdata/test.zip
func TestZipFileBytes() []byte {
return append([]byte{}, testZipFileBytes...)
}
// AssertSampleTarfile compares the content of tarBytes against testdata/test.tar.
func AssertSampleTarFile(t *testing.T, tarBytes []byte) {
t.Helper()
tr := tar.NewReader(bytes.NewReader(tarBytes))
for {
hdr, err := tr.Next()
if err != nil {
if err == io.EOF {
return
}
require.NoError(t, err)
}
// Note: ignoring timezones here.
require.Equal(t, ArchiveRefTime(t).UTC(), hdr.ModTime.UTC())
switch hdr.Name {
case "test/":
require.Equal(t, hdr.Typeflag, byte(tar.TypeDir))
case "test/hello.txt":
require.Equal(t, hdr.Typeflag, byte(tar.TypeReg))
bs, err := io.ReadAll(tr)
if err != nil && !xerrors.Is(err, io.EOF) {
require.NoError(t, err)
}
require.Equal(t, "hello", string(bs))
case "test/dir/":
require.Equal(t, hdr.Typeflag, byte(tar.TypeDir))
case "test/dir/world.txt":
require.Equal(t, hdr.Typeflag, byte(tar.TypeReg))
bs, err := io.ReadAll(tr)
if err != nil && !xerrors.Is(err, io.EOF) {
require.NoError(t, err)
}
require.Equal(t, "world", string(bs))
default:
require.Failf(t, "unexpected file in tar", hdr.Name)
}
}
}
// AssertSampleZipFile compares the content of zipBytes against testdata/test.zip.
func AssertSampleZipFile(t *testing.T, zipBytes []byte) {
t.Helper()
zr, err := zip.NewReader(bytes.NewReader(zipBytes), int64(len(zipBytes)))
require.NoError(t, err)
for _, f := range zr.File {
// Note: ignoring timezones here.
require.Equal(t, ArchiveRefTime(t).UTC(), f.Modified.UTC())
switch f.Name {
case "test/", "test/dir/":
// directory
case "test/hello.txt":
rc, err := f.Open()
require.NoError(t, err)
bs, err := io.ReadAll(rc)
_ = rc.Close()
require.NoError(t, err)
require.Equal(t, "hello", string(bs))
case "test/dir/world.txt":
rc, err := f.Open()
require.NoError(t, err)
bs, err := io.ReadAll(rc)
_ = rc.Close()
require.NoError(t, err)
require.Equal(t, "world", string(bs))
default:
require.Failf(t, "unexpected file in zip", f.Name)
}
}
}
// archiveRefTime is the Go reference time. The contents of the sample tar and zip files
// in testdata/ all have their modtimes set to the below in some timezone.
func ArchiveRefTime(t *testing.T) time.Time {
locMST, err := time.LoadLocation("MST")
require.NoError(t, err, "failed to load MST timezone")
return time.Date(2006, 1, 2, 3, 4, 5, 0, locMST)
}
+8
View File
@@ -24,6 +24,9 @@ var (
// Updated by buildinfo_slim.go on start.
slim bool
// Updated by buildinfo_site.go on start.
site bool
// Injected with ldflags at build, see scripts/build_go.sh
tag string
agpl string // either "true" or "false", ldflags does not support bools
@@ -95,6 +98,11 @@ func IsSlim() bool {
return slim
}
// HasSite returns true if the frontend is embedded in the build.
func HasSite() bool {
return site
}
// IsAGPL returns true if this is an AGPL build.
func IsAGPL() bool {
return strings.Contains(agpl, "t")
+7
View File
@@ -0,0 +1,7 @@
//go:build embed
package buildinfo
func init() {
site = true
}
+36 -30
View File
@@ -12,7 +12,6 @@ import (
"runtime"
"strconv"
"strings"
"sync"
"time"
"cloud.google.com/go/compute/metadata"
@@ -27,8 +26,10 @@ import (
"cdr.dev/slog/sloggers/slogstackdriver"
"github.com/coder/coder/v2/agent"
"github.com/coder/coder/v2/agent/agentproc"
"github.com/coder/coder/v2/agent/agentssh"
"github.com/coder/coder/v2/agent/reaper"
"github.com/coder/coder/v2/buildinfo"
"github.com/coder/coder/v2/cli/clilog"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/serpent"
@@ -48,6 +49,9 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
slogHumanPath string
slogJSONPath string
slogStackdriverPath string
blockFileTransfer bool
agentHeaderCommand string
agentHeader []string
)
cmd := &serpent.Command{
Use: "agent",
@@ -106,7 +110,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
// Spawn a reaper so that we don't accumulate a ton
// of zombie processes.
if reaper.IsInitProcess() && !noReap && isLinux {
logWriter := &lumberjackWriteCloseFixer{w: &lumberjack.Logger{
logWriter := &clilog.LumberjackWriteCloseFixer{Writer: &lumberjack.Logger{
Filename: filepath.Join(logDir, "coder-agent-init.log"),
MaxSize: 5, // MB
// Without this, rotated logs will never be deleted.
@@ -149,7 +153,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
// reaper.
go DumpHandler(ctx, "agent")
logWriter := &lumberjackWriteCloseFixer{w: &lumberjack.Logger{
logWriter := &clilog.LumberjackWriteCloseFixer{Writer: &lumberjack.Logger{
Filename: filepath.Join(logDir, "coder-agent.log"),
MaxSize: 5, // MB
// Per customer incident on November 17th, 2023, its helpful
@@ -174,6 +178,14 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
// with large payloads can take a bit. e.g. startup scripts
// may take a while to insert.
client.SDK.HTTPClient.Timeout = 30 * time.Second
// Attach header transport so we process --agent-header and
// --agent-header-command flags
headerTransport, err := headerTransport(ctx, r.agentURL, agentHeader, agentHeaderCommand)
if err != nil {
return xerrors.Errorf("configure header transport: %w", err)
}
headerTransport.Transport = client.SDK.HTTPClient.Transport
client.SDK.HTTPClient.Transport = headerTransport
// Enable pprof handler
// This prevents the pprof import from being accidentally deleted.
@@ -314,6 +326,8 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
// Intentionally set this to nil. It's mainly used
// for testing.
ModifiedProcesses: nil,
BlockFileTransfer: blockFileTransfer,
})
promHandler := agent.PrometheusMetricsHandler(prometheusRegistry, logger)
@@ -357,6 +371,18 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
Value: serpent.StringOf(&pprofAddress),
Description: "The address to serve pprof.",
},
{
Flag: "agent-header-command",
Env: "CODER_AGENT_HEADER_COMMAND",
Value: serpent.StringOf(&agentHeaderCommand),
Description: "An external command that outputs additional HTTP headers added to all requests. The command must output each header as `key=value` on its own line.",
},
{
Flag: "agent-header",
Env: "CODER_AGENT_HEADER",
Value: serpent.StringArrayOf(&agentHeader),
Description: "Additional HTTP headers added to all requests. Provide as " + `key=value` + ". Can be specified multiple times.",
},
{
Flag: "no-reap",
@@ -417,6 +443,13 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
Default: "",
Value: serpent.StringOf(&slogStackdriverPath),
},
{
Flag: "block-file-transfer",
Default: "false",
Env: "CODER_AGENT_BLOCK_FILE_TRANSFER",
Description: fmt.Sprintf("Block file transfer using known applications: %s.", strings.Join(agentssh.BlockedFileTransferCommands, ",")),
Value: serpent.BoolOf(&blockFileTransfer),
},
}
return cmd
@@ -445,33 +478,6 @@ func ServeHandler(ctx context.Context, logger slog.Logger, handler http.Handler,
}
}
// 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 *lumberjackWriteCloseFixer) Close() error {
c.mu.Lock()
defer c.mu.Unlock()
c.closed = true
return c.w.Close()
}
func (c *lumberjackWriteCloseFixer) Write(p []byte) (int, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.closed {
return 0, io.ErrClosedPipe
}
return c.w.Write(p)
}
// extractPort handles different url strings.
// - localhost:6060
// - http://localhost:6060
+95 -5
View File
@@ -3,10 +3,12 @@ package cli_test
import (
"context"
"fmt"
"net/http"
"os"
"path/filepath"
"runtime"
"strings"
"sync/atomic"
"testing"
"github.com/google/uuid"
@@ -15,6 +17,7 @@ import (
"github.com/coder/coder/v2/agent"
"github.com/coder/coder/v2/cli/clitest"
"github.com/coder/coder/v2/coderd"
"github.com/coder/coder/v2/coderd/coderdtest"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/dbfake"
@@ -32,7 +35,7 @@ func TestWorkspaceAgent(t *testing.T) {
client, db := coderdtest.NewWithDatabase(t, nil)
user := coderdtest.CreateFirstUser(t, client)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
r := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{
OrganizationID: user.OrganizationID,
OwnerID: user.UserID,
}).
@@ -68,7 +71,7 @@ func TestWorkspaceAgent(t *testing.T) {
AzureCertificates: certificates,
})
user := coderdtest.CreateFirstUser(t, client)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
r := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{
OrganizationID: user.OrganizationID,
OwnerID: user.UserID,
}).WithAgent(func(agents []*proto.Agent) []*proto.Agent {
@@ -107,7 +110,7 @@ func TestWorkspaceAgent(t *testing.T) {
AWSCertificates: certificates,
})
user := coderdtest.CreateFirstUser(t, client)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
r := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{
OrganizationID: user.OrganizationID,
OwnerID: user.UserID,
}).WithAgent(func(agents []*proto.Agent) []*proto.Agent {
@@ -148,7 +151,7 @@ func TestWorkspaceAgent(t *testing.T) {
})
owner := coderdtest.CreateFirstUser(t, client)
member, memberUser := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
r := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{
OrganizationID: owner.OrganizationID,
OwnerID: memberUser.ID,
}).WithAgent(func(agents []*proto.Agent) []*proto.Agent {
@@ -202,7 +205,7 @@ func TestWorkspaceAgent(t *testing.T) {
client, db := coderdtest.NewWithDatabase(t, nil)
user := coderdtest.CreateFirstUser(t, client)
r := dbfake.WorkspaceBuild(t, db, database.Workspace{
r := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{
OrganizationID: user.OrganizationID,
OwnerID: user.UserID,
}).WithAgent().Do()
@@ -229,6 +232,93 @@ func TestWorkspaceAgent(t *testing.T) {
require.Equal(t, codersdk.AgentSubsystemEnvbox, resources[0].Agents[0].Subsystems[0])
require.Equal(t, codersdk.AgentSubsystemExectrace, resources[0].Agents[0].Subsystems[1])
})
t.Run("Headers&DERPHeaders", func(t *testing.T) {
t.Parallel()
// Create a coderd API instance the hard way since we need to change the
// handler to inject our custom /derp handler.
dv := coderdtest.DeploymentValues(t)
dv.DERP.Config.BlockDirect = true
setHandler, cancelFunc, serverURL, newOptions := coderdtest.NewOptions(t, &coderdtest.Options{
DeploymentValues: dv,
})
// We set the handler after server creation for the access URL.
coderAPI := coderd.New(newOptions)
setHandler(coderAPI.RootHandler)
provisionerCloser := coderdtest.NewProvisionerDaemon(t, coderAPI)
t.Cleanup(func() {
_ = provisionerCloser.Close()
})
client := codersdk.New(serverURL)
t.Cleanup(func() {
cancelFunc()
_ = provisionerCloser.Close()
_ = coderAPI.Close()
client.HTTPClient.CloseIdleConnections()
})
var (
admin = coderdtest.CreateFirstUser(t, client)
member, memberUser = coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
called int64
derpCalled int64
)
setHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Ignore client requests
if r.Header.Get("X-Testing") == "agent" {
assert.Equal(t, "Ethan was Here!", r.Header.Get("Cool-Header"))
assert.Equal(t, "very-wow-"+client.URL.String(), r.Header.Get("X-Process-Testing"))
assert.Equal(t, "more-wow", r.Header.Get("X-Process-Testing2"))
if strings.HasPrefix(r.URL.Path, "/derp") {
atomic.AddInt64(&derpCalled, 1)
} else {
atomic.AddInt64(&called, 1)
}
}
coderAPI.RootHandler.ServeHTTP(w, r)
}))
r := dbfake.WorkspaceBuild(t, coderAPI.Database, database.WorkspaceTable{
OrganizationID: memberUser.OrganizationIDs[0],
OwnerID: memberUser.ID,
}).WithAgent().Do()
coderURLEnv := "$CODER_URL"
if runtime.GOOS == "windows" {
coderURLEnv = "%CODER_URL%"
}
logDir := t.TempDir()
agentInv, _ := clitest.New(t,
"agent",
"--auth", "token",
"--agent-token", r.AgentToken,
"--agent-url", client.URL.String(),
"--log-dir", logDir,
"--agent-header", "X-Testing=agent",
"--agent-header", "Cool-Header=Ethan was Here!",
"--agent-header-command", "printf X-Process-Testing=very-wow-"+coderURLEnv+"'\\r\\n'X-Process-Testing2=more-wow",
)
clitest.Start(t, agentInv)
coderdtest.NewWorkspaceAgentWaiter(t, client, r.Workspace.ID).
MatchResources(matchAgentWithVersion).Wait()
ctx := testutil.Context(t, testutil.WaitLong)
clientInv, root := clitest.New(t,
"-v",
"--no-feature-warning",
"--no-version-warning",
"ping", r.Workspace.Name,
"-n", "1",
)
clitest.SetupConfig(t, member, root)
err := clientInv.WithContext(ctx).Run()
require.NoError(t, err)
require.Greater(t, atomic.LoadInt64(&called), int64(0), "expected coderd to be reached with custom headers")
require.Greater(t, atomic.LoadInt64(&derpCalled), int64(0), "expected /derp to be called with custom headers")
})
}
func matchAgentWithVersion(rs []codersdk.WorkspaceResource) bool {
+1 -1
View File
@@ -24,7 +24,7 @@ func TestAutoUpdate(t *testing.T) {
version := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID, nil)
coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
template := coderdtest.CreateTemplate(t, client, owner.OrganizationID, version.ID)
workspace := coderdtest.CreateWorkspace(t, member, owner.OrganizationID, template.ID)
workspace := coderdtest.CreateWorkspace(t, member, template.ID)
coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID)
require.Equal(t, codersdk.AutomaticUpdatesNever, workspace.AutomaticUpdates)
+37 -8
View File
@@ -4,11 +4,12 @@ import (
"context"
"fmt"
"io"
"os"
"regexp"
"strings"
"sync"
"golang.org/x/xerrors"
"gopkg.in/natefinch/lumberjack.v2"
"cdr.dev/slog"
"cdr.dev/slog/sloggers/sloghuman"
@@ -104,7 +105,6 @@ func (b *Builder) Build(inv *serpent.Invocation) (log slog.Logger, closeLog func
addSinkIfProvided := func(sinkFn func(io.Writer) slog.Sink, loc string) error {
switch loc {
case "":
case "/dev/stdout":
sinks = append(sinks, sinkFn(inv.Stdout))
@@ -112,12 +112,14 @@ func (b *Builder) Build(inv *serpent.Invocation) (log slog.Logger, closeLog func
sinks = append(sinks, sinkFn(inv.Stderr))
default:
fi, err := os.OpenFile(loc, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0o644)
if err != nil {
return xerrors.Errorf("open log file %q: %w", loc, err)
}
closers = append(closers, fi.Close)
sinks = append(sinks, sinkFn(fi))
logWriter := &LumberjackWriteCloseFixer{Writer: &lumberjack.Logger{
Filename: loc,
MaxSize: 5, // MB
// Without this, rotated logs will never be deleted.
MaxBackups: 1,
}}
closers = append(closers, logWriter.Close)
sinks = append(sinks, sinkFn(logWriter))
}
return nil
}
@@ -209,3 +211,30 @@ func (f *debugFilterSink) Sync() {
sink.Sync()
}
}
// 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 {
Writer io.WriteCloser
mu sync.Mutex // Protects following.
closed bool
}
func (c *LumberjackWriteCloseFixer) Close() error {
c.mu.Lock()
defer c.mu.Unlock()
c.closed = true
return c.Writer.Close()
}
func (c *LumberjackWriteCloseFixer) Write(p []byte) (int, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.closed {
return 0, io.ErrClosedPipe
}
return c.Writer.Write(p)
}
-25
View File
@@ -2,7 +2,6 @@ package clilog_test
import (
"encoding/json"
"io/fs"
"os"
"path/filepath"
"strings"
@@ -145,30 +144,6 @@ func TestBuilder(t *testing.T) {
assertLogsJSON(t, tempJSON, info, infoLog, warn, warnLog)
})
})
t.Run("NotFound", func(t *testing.T) {
t.Parallel()
tempFile := filepath.Join(t.TempDir(), "doesnotexist", "test.log")
cmd := &serpent.Command{
Use: "test",
Handler: func(inv *serpent.Invocation) error {
logger, closeLog, err := clilog.New(
clilog.WithFilter("foo", "baz"),
clilog.WithHuman(tempFile),
clilog.WithVerbose(),
).Build(inv)
if err != nil {
return err
}
defer closeLog()
logger.Error(inv.Context(), "you will never see this")
return nil
},
}
err := cmd.Invoke().Run()
require.ErrorIs(t, err, fs.ErrNotExist)
})
}
var (
+12
View File
@@ -12,6 +12,7 @@ import (
const (
procMounts = "/proc/mounts"
procOneCgroup = "/proc/1/cgroup"
sysCgroupType = "/sys/fs/cgroup/cgroup.type"
kubernetesDefaultServiceAccountToken = "/var/run/secrets/kubernetes.io/serviceaccount/token" //nolint:gosec
)
@@ -65,6 +66,17 @@ func IsContainerized(fs afero.Fs) (ok bool, err error) {
}
}
// Adapted from https://github.com/systemd/systemd/blob/88bbf187a9b2ebe0732caa1e886616ae5f8186da/src/basic/virt.c#L603-L605
// The file `/sys/fs/cgroup/cgroup.type` does not exist on the root cgroup.
// If this file exists we can be sure we're in a container.
cgTypeExists, err := afero.Exists(fs, sysCgroupType)
if err != nil {
return false, xerrors.Errorf("check file exists %s: %w", sysCgroupType, err)
}
if cgTypeExists {
return true, nil
}
// If we get here, we are _probably_ not running in a container.
return false, nil
}
+12
View File
@@ -309,6 +309,12 @@ func TestIsContainerized(t *testing.T) {
Expected: true,
Error: "",
},
{
Name: "Docker (Cgroupns=private)",
FS: fsContainerCgroupV2PrivateCgroupns,
Expected: true,
Error: "",
},
} {
tt := tt
t.Run(tt.Name, func(t *testing.T) {
@@ -374,6 +380,12 @@ proc /proc/sys proc ro,nosuid,nodev,noexec,relatime 0 0`,
cgroupV2MemoryUsageBytes: "536870912",
cgroupV2MemoryStat: "inactive_file 268435456",
}
fsContainerCgroupV2PrivateCgroupns = map[string]string{
procOneCgroup: "0::/",
procMounts: `overlay / overlay rw,relatime,lowerdir=/some/path:/some/path,upperdir=/some/path:/some/path,workdir=/some/path:/some/path 0 0
proc /proc/sys proc ro,nosuid,nodev,noexec,relatime 0 0`,
sysCgroupType: "domain",
}
fsContainerCgroupV1 = map[string]string{
procOneCgroup: "0::/docker/aa86ac98959eeedeae0ecb6e0c9ddd8ae8b97a9d0fdccccf7ea7a474f4e0bb1f",
procMounts: `overlay / overlay rw,relatime,lowerdir=/some/path:/some/path,upperdir=/some/path:/some/path,workdir=/some/path:/some/path 0 0
+7 -6
View File
@@ -11,6 +11,7 @@ import (
"strings"
"testing"
"github.com/google/uuid"
"github.com/stretchr/testify/require"
"github.com/coder/coder/v2/cli/config"
@@ -183,11 +184,11 @@ func prepareTestData(t *testing.T) (*codersdk.Client, map[string]string) {
IncludeProvisionerDaemon: true,
})
firstUser := coderdtest.CreateFirstUser(t, rootClient)
secondUser, err := rootClient.CreateUser(ctx, codersdk.CreateUserRequest{
Email: "testuser2@coder.com",
Username: "testuser2",
Password: coderdtest.FirstUserParams.Password,
OrganizationID: firstUser.OrganizationID,
secondUser, err := rootClient.CreateUserWithOrgs(ctx, codersdk.CreateUserRequestWithOrgs{
Email: "testuser2@coder.com",
Username: "testuser2",
Password: coderdtest.FirstUserParams.Password,
OrganizationIDs: []uuid.UUID{firstUser.OrganizationID},
})
require.NoError(t, err)
version := coderdtest.CreateTemplateVersion(t, rootClient, firstUser.OrganizationID, nil)
@@ -195,7 +196,7 @@ func prepareTestData(t *testing.T) (*codersdk.Client, map[string]string) {
template := coderdtest.CreateTemplate(t, rootClient, firstUser.OrganizationID, version.ID, func(req *codersdk.CreateTemplateRequest) {
req.Name = "test-template"
})
workspace := coderdtest.CreateWorkspace(t, rootClient, firstUser.OrganizationID, template.ID, func(req *codersdk.CreateWorkspaceRequest) {
workspace := coderdtest.CreateWorkspace(t, rootClient, template.ID, func(req *codersdk.CreateWorkspaceRequest) {
req.Name = "test-workspace"
})
workspaceBuild := coderdtest.AwaitWorkspaceBuildJobCompleted(t, rootClient, workspace.LatestBuild.ID)
+132 -7
View File
@@ -10,8 +10,11 @@ import (
"github.com/google/uuid"
"golang.org/x/xerrors"
"tailscale.com/tailcfg"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/healthsdk"
"github.com/coder/coder/v2/codersdk/workspacesdk"
"github.com/coder/coder/v2/tailnet"
)
@@ -22,6 +25,7 @@ type AgentOptions struct {
Fetch func(ctx context.Context, agentID uuid.UUID) (codersdk.WorkspaceAgent, error)
FetchLogs func(ctx context.Context, agentID uuid.UUID, after int64, follow bool) (<-chan []codersdk.WorkspaceAgentLog, io.Closer, error)
Wait bool // If true, wait for the agent to be ready (startup script).
DocsURL string
}
// Agent displays a spinning indicator that waits for a workspace agent to connect.
@@ -116,7 +120,7 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO
if agent.Status == codersdk.WorkspaceAgentTimeout {
now := time.Now()
sw.Log(now, codersdk.LogLevelInfo, "The workspace agent is having trouble connecting, wait for it to connect or restart your workspace.")
sw.Log(now, codersdk.LogLevelInfo, troubleshootingMessage(agent, "https://coder.com/docs/v2/latest/templates#agent-connection-issues"))
sw.Log(now, codersdk.LogLevelInfo, troubleshootingMessage(agent, fmt.Sprintf("%s/templates#agent-connection-issues", opts.DocsURL)))
for agent.Status == codersdk.WorkspaceAgentTimeout {
if agent, err = fetch(); err != nil {
return xerrors.Errorf("fetch: %w", err)
@@ -132,11 +136,14 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO
}
stage := "Running workspace agent startup scripts"
follow := opts.Wait
follow := opts.Wait && agent.LifecycleState.Starting()
if !follow {
stage += " (non-blocking)"
}
sw.Start(stage)
if follow {
sw.Log(time.Time{}, codersdk.LogLevelInfo, "==> ︎ To connect immediately, reconnect with --wait=no or CODER_SSH_WAIT=no, see --help for more information.")
}
err = func() error { // Use func because of defer in for loop.
logStream, logsCloser, err := opts.FetchLogs(ctx, agent.ID, 0, follow)
@@ -206,19 +213,25 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO
case codersdk.WorkspaceAgentLifecycleReady:
sw.Complete(stage, safeDuration(sw, agent.ReadyAt, agent.StartedAt))
case codersdk.WorkspaceAgentLifecycleStartTimeout:
sw.Fail(stage, 0)
// Backwards compatibility: Avoid printing warning if
// coderd is old and doesn't set ReadyAt for timeouts.
if agent.ReadyAt == nil {
sw.Fail(stage, 0)
} else {
sw.Fail(stage, safeDuration(sw, agent.ReadyAt, agent.StartedAt))
}
sw.Log(time.Time{}, codersdk.LogLevelWarn, "Warning: A startup script timed out and your workspace may be incomplete.")
case codersdk.WorkspaceAgentLifecycleStartError:
sw.Fail(stage, safeDuration(sw, agent.ReadyAt, agent.StartedAt))
// Use zero time (omitted) to separate these from the startup logs.
sw.Log(time.Time{}, codersdk.LogLevelWarn, "Warning: A startup script exited with an error and your workspace may be incomplete.")
sw.Log(time.Time{}, codersdk.LogLevelWarn, troubleshootingMessage(agent, "https://coder.com/docs/v2/latest/templates/troubleshooting#startup-script-exited-with-an-error"))
sw.Log(time.Time{}, codersdk.LogLevelWarn, troubleshootingMessage(agent, fmt.Sprintf("%s/templates#startup-script-exited-with-an-error", opts.DocsURL)))
default:
switch {
case agent.LifecycleState.Starting():
// Use zero time (omitted) to separate these from the startup logs.
sw.Log(time.Time{}, codersdk.LogLevelWarn, "Notice: The startup scripts are still running and your workspace may be incomplete.")
sw.Log(time.Time{}, codersdk.LogLevelWarn, troubleshootingMessage(agent, "https://coder.com/docs/v2/latest/templates/troubleshooting#your-workspace-may-be-incomplete"))
sw.Log(time.Time{}, codersdk.LogLevelWarn, troubleshootingMessage(agent, fmt.Sprintf("%s/templates#your-workspace-may-be-incomplete", opts.DocsURL)))
// Note: We don't complete or fail the stage here, it's
// intentionally left open to indicate this stage didn't
// complete.
@@ -240,7 +253,7 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO
stage := "The workspace agent lost connection"
sw.Start(stage)
sw.Log(time.Now(), codersdk.LogLevelWarn, "Wait for it to reconnect or restart your workspace.")
sw.Log(time.Now(), codersdk.LogLevelWarn, troubleshootingMessage(agent, "https://coder.com/docs/v2/latest/templates/troubleshooting#agent-connection-issues"))
sw.Log(time.Now(), codersdk.LogLevelWarn, troubleshootingMessage(agent, fmt.Sprintf("%s/templates#agent-connection-issues", opts.DocsURL)))
disconnectedAt := agent.DisconnectedAt
for agent.Status == codersdk.WorkspaceAgentDisconnected {
@@ -297,7 +310,7 @@ func PeerDiagnostics(w io.Writer, d tailnet.PeerDiagnostics) {
_, _ = fmt.Fprint(w, "✘ not connected to DERP\n")
}
if d.SentNode {
_, _ = fmt.Fprint(w, "✔ sent local data to Coder networking coodinator\n")
_, _ = fmt.Fprint(w, "✔ sent local data to Coder networking coordinator\n")
} else {
_, _ = fmt.Fprint(w, "✘ have not sent local data to Coder networking coordinator\n")
}
@@ -337,3 +350,115 @@ func PeerDiagnostics(w io.Writer, d tailnet.PeerDiagnostics) {
_, _ = fmt.Fprint(w, "✘ Wireguard is not connected\n")
}
}
type ConnDiags struct {
ConnInfo workspacesdk.AgentConnectionInfo
PingP2P bool
DisableDirect bool
LocalNetInfo *tailcfg.NetInfo
LocalInterfaces *healthsdk.InterfacesReport
AgentNetcheck *healthsdk.AgentNetcheckReport
ClientIPIsAWS bool
AgentIPIsAWS bool
Verbose bool
TroubleshootingURL string
}
func (d ConnDiags) Write(w io.Writer) {
_, _ = fmt.Fprintln(w, "")
general, client, agent := d.splitDiagnostics()
for _, msg := range general {
_, _ = fmt.Fprintln(w, msg)
}
if len(general) > 0 {
_, _ = fmt.Fprintln(w, "")
}
if len(client) > 0 {
_, _ = fmt.Fprint(w, "Possible client-side issues with direct connection:\n\n")
for _, msg := range client {
_, _ = fmt.Fprintf(w, " - %s\n\n", msg)
}
}
if len(agent) > 0 {
_, _ = fmt.Fprint(w, "Possible agent-side issues with direct connections:\n\n")
for _, msg := range agent {
_, _ = fmt.Fprintf(w, " - %s\n\n", msg)
}
}
}
func (d ConnDiags) splitDiagnostics() (general, client, agent []string) {
if d.AgentNetcheck != nil {
for _, msg := range d.AgentNetcheck.Interfaces.Warnings {
agent = append(agent, msg.Message)
}
if len(d.AgentNetcheck.Interfaces.Warnings) > 0 {
agent[len(agent)-1] += fmt.Sprintf("\n%s#low-mtu", d.TroubleshootingURL)
}
}
if d.LocalInterfaces != nil {
for _, msg := range d.LocalInterfaces.Warnings {
client = append(client, msg.Message)
}
if len(d.LocalInterfaces.Warnings) > 0 {
client[len(client)-1] += fmt.Sprintf("\n%s#low-mtu", d.TroubleshootingURL)
}
}
if d.PingP2P && !d.Verbose {
return general, client, agent
}
if d.DisableDirect {
general = append(general, "❗ Direct connections are disabled locally, by `--disable-direct-connections` or `CODER_DISABLE_DIRECT_CONNECTIONS`.\n"+
" They may still be established over a private network.")
if !d.Verbose {
return general, client, agent
}
}
if d.ConnInfo.DisableDirectConnections {
general = append(general,
fmt.Sprintf("❗ Your Coder administrator has blocked direct connections\n %s#disabled-deployment-wide", d.TroubleshootingURL))
if !d.Verbose {
return general, client, agent
}
}
if !d.ConnInfo.DERPMap.HasSTUN() {
general = append(general,
fmt.Sprintf("❗ The DERP map is not configured to use STUN\n %s#no-stun-servers", d.TroubleshootingURL))
} else if d.LocalNetInfo != nil && !d.LocalNetInfo.UDP {
client = append(client,
fmt.Sprintf("Client could not connect to STUN over UDP\n %s#udp-blocked", d.TroubleshootingURL))
}
if d.LocalNetInfo != nil && d.LocalNetInfo.MappingVariesByDestIP.EqualBool(true) {
client = append(client,
fmt.Sprintf("Client is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers\n %s#endpoint-dependent-nat-hard-nat", d.TroubleshootingURL))
}
if d.AgentNetcheck != nil && d.AgentNetcheck.NetInfo != nil {
if d.AgentNetcheck.NetInfo.MappingVariesByDestIP.EqualBool(true) {
agent = append(agent,
fmt.Sprintf("Agent is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers\n %s#endpoint-dependent-nat-hard-nat", d.TroubleshootingURL))
}
if !d.AgentNetcheck.NetInfo.UDP {
agent = append(agent,
fmt.Sprintf("Agent could not connect to STUN over UDP\n %s#udp-blocked", d.TroubleshootingURL))
}
}
if d.ClientIPIsAWS {
client = append(client,
fmt.Sprintf("Client IP address is within an AWS range (AWS uses hard NAT)\n %s#endpoint-dependent-nat-hard-nat", d.TroubleshootingURL))
}
if d.AgentIPIsAWS {
agent = append(agent,
fmt.Sprintf("Agent IP address is within an AWS range (AWS uses hard NAT)\n %s#endpoint-dependent-nat-hard-nat", d.TroubleshootingURL))
}
return general, client, agent
}
+205 -3
View File
@@ -20,8 +20,11 @@ import (
"github.com/coder/coder/v2/cli/clitest"
"github.com/coder/coder/v2/cli/cliui"
"github.com/coder/coder/v2/coderd/healthcheck/health"
"github.com/coder/coder/v2/coderd/util/ptr"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/healthsdk"
"github.com/coder/coder/v2/codersdk/workspacesdk"
"github.com/coder/coder/v2/tailnet"
"github.com/coder/coder/v2/testutil"
"github.com/coder/serpent"
@@ -95,6 +98,8 @@ func TestAgent(t *testing.T) {
iter: []func(context.Context, *testing.T, *codersdk.WorkspaceAgent, <-chan string, chan []codersdk.WorkspaceAgentLog) error{
func(_ context.Context, _ *testing.T, agent *codersdk.WorkspaceAgent, _ <-chan string, _ chan []codersdk.WorkspaceAgentLog) error {
agent.Status = codersdk.WorkspaceAgentConnecting
agent.LifecycleState = codersdk.WorkspaceAgentLifecycleStarting
agent.StartedAt = ptr.Ref(time.Now())
return nil
},
func(_ context.Context, t *testing.T, agent *codersdk.WorkspaceAgent, output <-chan string, _ chan []codersdk.WorkspaceAgentLog) error {
@@ -104,6 +109,7 @@ func TestAgent(t *testing.T) {
agent.Status = codersdk.WorkspaceAgentConnected
agent.LifecycleState = codersdk.WorkspaceAgentLifecycleStartTimeout
agent.FirstConnectedAt = ptr.Ref(time.Now())
agent.ReadyAt = ptr.Ref(time.Now())
return nil
},
},
@@ -226,6 +232,7 @@ func TestAgent(t *testing.T) {
},
want: []string{
"⧗ Running workspace agent startup scripts",
"︎ To connect immediately, reconnect with --wait=no or CODER_SSH_WAIT=no, see --help for more information.",
"testing: Hello world",
"Bye now",
"✔ Running workspace agent startup scripts",
@@ -254,9 +261,9 @@ func TestAgent(t *testing.T) {
},
},
want: []string{
"⧗ Running workspace agent startup scripts",
"⧗ Running workspace agent startup scripts (non-blocking)",
"Hello world",
"✘ Running workspace agent startup scripts",
"✘ Running workspace agent startup scripts (non-blocking)",
"Warning: A startup script exited with an error and your workspace may be incomplete.",
"For more information and troubleshooting, see",
},
@@ -306,6 +313,7 @@ func TestAgent(t *testing.T) {
},
want: []string{
"⧗ Running workspace agent startup scripts",
"︎ To connect immediately, reconnect with --wait=no or CODER_SSH_WAIT=no, see --help for more information.",
"Hello world",
"✔ Running workspace agent startup scripts",
},
@@ -525,7 +533,7 @@ func TestPeerDiagnostics(t *testing.T) {
LastWireguardHandshake: time.Time{},
},
want: []*regexp.Regexp{
regexp.MustCompile(`^✔ sent local data to Coder networking coodinator$`),
regexp.MustCompile(`^✔ sent local data to Coder networking coordinator$`),
},
},
{
@@ -667,3 +675,197 @@ func TestPeerDiagnostics(t *testing.T) {
})
}
}
func TestConnDiagnostics(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
diags cliui.ConnDiags
want []string
}{
{
name: "DirectBlocked",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{},
DisableDirectConnections: true,
},
},
want: []string{
`❗ Your Coder administrator has blocked direct connections`,
},
},
{
name: "NoStun",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{},
},
LocalNetInfo: &tailcfg.NetInfo{},
},
want: []string{
`The DERP map is not configured to use STUN`,
},
},
{
name: "ClientHasStunNoUDP",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{
Regions: map[int]*tailcfg.DERPRegion{
999: {
Nodes: []*tailcfg.DERPNode{
{
STUNPort: 1337,
},
},
},
},
},
},
LocalNetInfo: &tailcfg.NetInfo{
UDP: false,
},
},
want: []string{
`Client could not connect to STUN over UDP`,
},
},
{
name: "AgentHasStunNoUDP",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{
Regions: map[int]*tailcfg.DERPRegion{
999: {
Nodes: []*tailcfg.DERPNode{
{
STUNPort: 1337,
},
},
},
},
},
},
AgentNetcheck: &healthsdk.AgentNetcheckReport{
NetInfo: &tailcfg.NetInfo{
UDP: false,
},
},
},
want: []string{
`Agent could not connect to STUN over UDP`,
},
},
{
name: "ClientHardNat",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{},
},
LocalNetInfo: &tailcfg.NetInfo{
MappingVariesByDestIP: "true",
},
},
want: []string{
`Client is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers`,
},
},
{
name: "AgentHardNat",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{},
},
LocalNetInfo: &tailcfg.NetInfo{},
AgentNetcheck: &healthsdk.AgentNetcheckReport{
NetInfo: &tailcfg.NetInfo{MappingVariesByDestIP: "true"},
},
},
want: []string{
`Agent is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers`,
},
},
{
name: "AgentInterfaceWarnings",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{},
},
AgentNetcheck: &healthsdk.AgentNetcheckReport{
Interfaces: healthsdk.InterfacesReport{
BaseReport: healthsdk.BaseReport{
Warnings: []health.Message{
health.Messagef(health.CodeInterfaceSmallMTU, "Network interface eth0 has MTU 1280, (less than 1378), which may degrade the quality of direct connections"),
},
},
},
},
},
want: []string{
`Network interface eth0 has MTU 1280, (less than 1378), which may degrade the quality of direct connections`,
},
},
{
name: "LocalInterfaceWarnings",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{},
},
LocalInterfaces: &healthsdk.InterfacesReport{
BaseReport: healthsdk.BaseReport{
Warnings: []health.Message{
health.Messagef(health.CodeInterfaceSmallMTU, "Network interface eth1 has MTU 1310, (less than 1378), which may degrade the quality of direct connections"),
},
},
},
},
want: []string{
`Network interface eth1 has MTU 1310, (less than 1378), which may degrade the quality of direct connections`,
},
},
{
name: "ClientAWSIP",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{},
},
ClientIPIsAWS: true,
AgentIPIsAWS: false,
},
want: []string{
`Client IP address is within an AWS range (AWS uses hard NAT)`,
},
},
{
name: "AgentAWSIP",
diags: cliui.ConnDiags{
ConnInfo: workspacesdk.AgentConnectionInfo{
DERPMap: &tailcfg.DERPMap{},
},
ClientIPIsAWS: false,
AgentIPIsAWS: true,
},
want: []string{
`Agent IP address is within an AWS range (AWS uses hard NAT)`,
},
},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
r, w := io.Pipe()
go func() {
defer w.Close()
tc.diags.Write(w)
}()
bytes, err := io.ReadAll(r)
require.NoError(t, err)
output := string(bytes)
for _, want := range tc.want {
require.Contains(t, output, want)
}
})
}
}
+34 -22
View File
@@ -22,6 +22,7 @@ type Styles struct {
DateTimeStamp,
Error,
Field,
Hyperlink,
Keyword,
Placeholder,
Prompt,
@@ -37,17 +38,21 @@ var (
)
var (
Green = Color("#04B575")
Red = Color("#ED567A")
Fuchsia = Color("#EE6FF8")
Yellow = Color("#ECFD65")
Blue = Color("#5000ff")
// ANSI color codes
red = Color("1")
green = Color("2")
yellow = Color("3")
magenta = Color("5")
white = Color("7")
brightBlue = Color("12")
brightMagenta = Color("13")
)
// Color returns a color for the given string.
func Color(s string) termenv.Color {
colorOnce.Do(func() {
color = termenv.NewOutput(os.Stdout).ColorProfile()
color = termenv.NewOutput(os.Stdout).EnvColorProfile()
if flag.Lookup("test.v") != nil {
// Use a consistent colorless profile in tests so that results
// are deterministic.
@@ -123,42 +128,49 @@ func init() {
DefaultStyles = Styles{
Code: pretty.Style{
ifTerm(pretty.XPad(1, 1)),
pretty.FgColor(Red),
pretty.BgColor(color.Color("#2c2c2c")),
pretty.FgColor(Color("#ED567A")),
pretty.BgColor(Color("#2C2C2C")),
},
DateTimeStamp: pretty.Style{
pretty.FgColor(color.Color("#7571F9")),
pretty.FgColor(brightBlue),
},
Error: pretty.Style{
pretty.FgColor(Red),
pretty.FgColor(red),
},
Field: pretty.Style{
pretty.XPad(1, 1),
pretty.FgColor(color.Color("#FFFFFF")),
pretty.BgColor(color.Color("#2b2a2a")),
pretty.FgColor(Color("#FFFFFF")),
pretty.BgColor(Color("#2B2A2A")),
},
Fuchsia: pretty.Style{
pretty.FgColor(brightMagenta),
},
FocusedPrompt: pretty.Style{
pretty.FgColor(white),
pretty.Wrap("> ", ""),
pretty.FgColor(brightBlue),
},
Hyperlink: pretty.Style{
pretty.FgColor(magenta),
pretty.Underline(),
},
Keyword: pretty.Style{
pretty.FgColor(Green),
pretty.FgColor(green),
},
Placeholder: pretty.Style{
pretty.FgColor(color.Color("#4d46b3")),
pretty.FgColor(magenta),
},
Prompt: pretty.Style{
pretty.FgColor(color.Color("#5C5C5C")),
pretty.Wrap("> ", ""),
pretty.FgColor(white),
pretty.Wrap(" ", ""),
},
Warn: pretty.Style{
pretty.FgColor(Yellow),
pretty.FgColor(yellow),
},
Wrap: pretty.Style{
pretty.LineWrap(80),
},
}
DefaultStyles.FocusedPrompt = append(
DefaultStyles.Prompt,
pretty.FgColor(Blue),
)
}
// ValidateNotEmpty is a helper function to disallow empty inputs!
+10 -5
View File
@@ -7,6 +7,7 @@ import (
"reflect"
"strings"
"github.com/jedib0t/go-pretty/v6/table"
"golang.org/x/xerrors"
"github.com/coder/serpent"
@@ -64,8 +65,8 @@ func (f *OutputFormatter) AttachOptions(opts *serpent.OptionSet) {
Flag: "output",
FlagShorthand: "o",
Default: f.formats[0].ID(),
Value: serpent.StringOf(&f.formatID),
Description: "Output format. Available formats: " + strings.Join(formatNames, ", ") + ".",
Value: serpent.EnumOf(&f.formatID, formatNames...),
Description: "Output format.",
},
)
}
@@ -135,15 +136,19 @@ func (f *tableFormat) AttachOptions(opts *serpent.OptionSet) {
Flag: "column",
FlagShorthand: "c",
Default: strings.Join(f.defaultColumns, ","),
Value: serpent.StringArrayOf(&f.columns),
Description: "Columns to display in table output. Available columns: " + strings.Join(f.allColumns, ", ") + ".",
Value: serpent.EnumArrayOf(&f.columns, f.allColumns...),
Description: "Columns to display in table output.",
},
)
}
// Format implements OutputFormat.
func (f *tableFormat) Format(_ context.Context, data any) (string, error) {
return DisplayTable(data, f.sort, f.columns)
headers := make(table.Row, len(f.allColumns))
for i, header := range f.allColumns {
headers[i] = header
}
return renderTable(data, f.sort, headers, f.columns)
}
type jsonFormat struct{}
+8 -9
View File
@@ -106,11 +106,11 @@ func Test_OutputFormatter(t *testing.T) {
fs := cmd.Options.FlagSet()
selected, err := fs.GetString("output")
require.NoError(t, err)
require.Equal(t, "json", selected)
selected := cmd.Options.ByFlag("output")
require.NotNil(t, selected)
require.Equal(t, "json", selected.Value.String())
usage := fs.FlagUsages()
require.Contains(t, usage, "Available formats: json, foo")
require.Contains(t, usage, "Output format.")
require.Contains(t, usage, "foo flag 1234")
ctx := context.Background()
@@ -129,11 +129,10 @@ func Test_OutputFormatter(t *testing.T) {
require.Equal(t, "foo", out)
require.EqualValues(t, 1, atomic.LoadInt64(&called))
require.NoError(t, fs.Set("output", "bar"))
require.Error(t, fs.Set("output", "bar"))
out, err = f.Format(ctx, data)
require.Error(t, err)
require.ErrorContains(t, err, "bar")
require.Equal(t, "", out)
require.EqualValues(t, 1, atomic.LoadInt64(&called))
require.NoError(t, err)
require.Equal(t, "foo", out)
require.EqualValues(t, 2, atomic.LoadInt64(&called))
})
}
+4 -1
View File
@@ -43,7 +43,10 @@ func RichParameter(inv *serpent.Invocation, templateVersionParameter codersdk.Te
return "", err
}
values, err := MultiSelect(inv, options)
values, err := MultiSelect(inv, MultiSelectOptions{
Options: options,
Defaults: options,
})
if err == nil {
v, err := json.Marshal(&values)
if err != nil {
+31 -6
View File
@@ -1,10 +1,10 @@
package cliui
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"os"
"os/signal"
"strings"
@@ -96,14 +96,13 @@ func Prompt(inv *serpent.Invocation, opts PromptOptions) (string, error) {
signal.Notify(interrupt, os.Interrupt)
defer signal.Stop(interrupt)
reader := bufio.NewReader(inv.Stdin)
line, err = reader.ReadString('\n')
line, err = readUntil(inv.Stdin, '\n')
// Check if the first line beings with JSON object or array chars.
// This enables multiline JSON to be pasted into an input, and have
// it parse properly.
if err == nil && (strings.HasPrefix(line, "{") || strings.HasPrefix(line, "[")) {
line, err = promptJSON(reader, line)
line, err = promptJSON(inv.Stdin, line)
}
}
if err != nil {
@@ -144,7 +143,7 @@ func Prompt(inv *serpent.Invocation, opts PromptOptions) (string, error) {
}
}
func promptJSON(reader *bufio.Reader, line string) (string, error) {
func promptJSON(reader io.Reader, line string) (string, error) {
var data bytes.Buffer
for {
_, _ = data.WriteString(line)
@@ -162,7 +161,7 @@ func promptJSON(reader *bufio.Reader, line string) (string, error) {
// Read line-by-line. We can't use a JSON decoder
// here because it doesn't work by newline, so
// reads will block.
line, err = reader.ReadString('\n')
line, err = readUntil(reader, '\n')
if err != nil {
break
}
@@ -179,3 +178,29 @@ func promptJSON(reader *bufio.Reader, line string) (string, error) {
}
return line, nil
}
// readUntil the first occurrence of delim in the input, returning a string containing the data up
// to and including the delimiter. Unlike `bufio`, it only reads until the delimiter and no further
// bytes. If readUntil encounters an error before finding a delimiter, it returns the data read
// before the error and the error itself (often io.EOF). readUntil returns err != nil if and only if
// the returned data does not end in delim.
func readUntil(r io.Reader, delim byte) (string, error) {
var (
have []byte
b = make([]byte, 1)
)
for {
n, err := r.Read(b)
if n > 0 {
have = append(have, b[0])
if b[0] == delim {
// match `bufio` in that we only return non-nil if we didn't find the delimiter,
// regardless of whether we also erred.
return string(have), nil
}
}
if err != nil {
return string(have), err
}
}
}
+53 -15
View File
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/xerrors"
"github.com/coder/coder/v2/cli/cliui"
"github.com/coder/coder/v2/pty"
@@ -22,10 +23,11 @@ func TestPrompt(t *testing.T) {
t.Parallel()
t.Run("Success", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
ptty := ptytest.New(t)
msgChan := make(chan string)
go func() {
resp, err := newPrompt(ptty, cliui.PromptOptions{
resp, err := newPrompt(ctx, ptty, cliui.PromptOptions{
Text: "Example",
}, nil)
assert.NoError(t, err)
@@ -33,15 +35,17 @@ func TestPrompt(t *testing.T) {
}()
ptty.ExpectMatch("Example")
ptty.WriteLine("hello")
require.Equal(t, "hello", <-msgChan)
resp := testutil.RequireRecvCtx(ctx, t, msgChan)
require.Equal(t, "hello", resp)
})
t.Run("Confirm", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
ptty := ptytest.New(t)
doneChan := make(chan string)
go func() {
resp, err := newPrompt(ptty, cliui.PromptOptions{
resp, err := newPrompt(ctx, ptty, cliui.PromptOptions{
Text: "Example",
IsConfirm: true,
}, nil)
@@ -50,18 +54,20 @@ func TestPrompt(t *testing.T) {
}()
ptty.ExpectMatch("Example")
ptty.WriteLine("yes")
require.Equal(t, "yes", <-doneChan)
resp := testutil.RequireRecvCtx(ctx, t, doneChan)
require.Equal(t, "yes", resp)
})
t.Run("Skip", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
ptty := ptytest.New(t)
var buf bytes.Buffer
// Copy all data written out to a buffer. When we close the ptty, we can
// no longer read from the ptty.Output(), but we can read what was
// written to the buffer.
dataRead, doneReading := context.WithTimeout(context.Background(), testutil.WaitShort)
dataRead, doneReading := context.WithCancel(ctx)
go func() {
// This will throw an error sometimes. The underlying ptty
// has its own cleanup routines in t.Cleanup. Instead of
@@ -74,7 +80,7 @@ func TestPrompt(t *testing.T) {
doneChan := make(chan string)
go func() {
resp, err := newPrompt(ptty, cliui.PromptOptions{
resp, err := newPrompt(ctx, ptty, cliui.PromptOptions{
Text: "ShouldNotSeeThis",
IsConfirm: true,
}, func(inv *serpent.Invocation) {
@@ -85,7 +91,8 @@ func TestPrompt(t *testing.T) {
doneChan <- resp
}()
require.Equal(t, "yes", <-doneChan)
resp := testutil.RequireRecvCtx(ctx, t, doneChan)
require.Equal(t, "yes", resp)
// Close the reader to end the io.Copy
require.NoError(t, ptty.Close(), "close eof reader")
// Wait for the IO copy to finish
@@ -96,10 +103,11 @@ func TestPrompt(t *testing.T) {
})
t.Run("JSON", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
ptty := ptytest.New(t)
doneChan := make(chan string)
go func() {
resp, err := newPrompt(ptty, cliui.PromptOptions{
resp, err := newPrompt(ctx, ptty, cliui.PromptOptions{
Text: "Example",
}, nil)
assert.NoError(t, err)
@@ -107,15 +115,17 @@ func TestPrompt(t *testing.T) {
}()
ptty.ExpectMatch("Example")
ptty.WriteLine("{}")
require.Equal(t, "{}", <-doneChan)
resp := testutil.RequireRecvCtx(ctx, t, doneChan)
require.Equal(t, "{}", resp)
})
t.Run("BadJSON", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
ptty := ptytest.New(t)
doneChan := make(chan string)
go func() {
resp, err := newPrompt(ptty, cliui.PromptOptions{
resp, err := newPrompt(ctx, ptty, cliui.PromptOptions{
Text: "Example",
}, nil)
assert.NoError(t, err)
@@ -123,15 +133,17 @@ func TestPrompt(t *testing.T) {
}()
ptty.ExpectMatch("Example")
ptty.WriteLine("{a")
require.Equal(t, "{a", <-doneChan)
resp := testutil.RequireRecvCtx(ctx, t, doneChan)
require.Equal(t, "{a", resp)
})
t.Run("MultilineJSON", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
ptty := ptytest.New(t)
doneChan := make(chan string)
go func() {
resp, err := newPrompt(ptty, cliui.PromptOptions{
resp, err := newPrompt(ctx, ptty, cliui.PromptOptions{
Text: "Example",
}, nil)
assert.NoError(t, err)
@@ -141,11 +153,37 @@ func TestPrompt(t *testing.T) {
ptty.WriteLine(`{
"test": "wow"
}`)
require.Equal(t, `{"test":"wow"}`, <-doneChan)
resp := testutil.RequireRecvCtx(ctx, t, doneChan)
require.Equal(t, `{"test":"wow"}`, resp)
})
t.Run("InvalidValid", func(t *testing.T) {
t.Parallel()
ctx := testutil.Context(t, testutil.WaitShort)
ptty := ptytest.New(t)
doneChan := make(chan string)
go func() {
resp, err := newPrompt(ctx, ptty, cliui.PromptOptions{
Text: "Example",
Validate: func(s string) error {
t.Logf("validate: %q", s)
if s != "valid" {
return xerrors.New("invalid")
}
return nil
},
}, nil)
assert.NoError(t, err)
doneChan <- resp
}()
ptty.ExpectMatch("Example")
ptty.WriteLine("foo\nbar\nbaz\n\n\nvalid\n")
resp := testutil.RequireRecvCtx(ctx, t, doneChan)
require.Equal(t, "valid", resp)
})
}
func newPrompt(ptty *ptytest.PTY, opts cliui.PromptOptions, invOpt func(inv *serpent.Invocation)) (string, error) {
func newPrompt(ctx context.Context, ptty *ptytest.PTY, opts cliui.PromptOptions, invOpt func(inv *serpent.Invocation)) (string, error) {
value := ""
cmd := &serpent.Command{
Handler: func(inv *serpent.Invocation) error {
@@ -163,7 +201,7 @@ func newPrompt(ptty *ptytest.PTY, opts cliui.PromptOptions, invOpt func(inv *ser
inv.Stdout = ptty.Output()
inv.Stderr = ptty.Output()
inv.Stdin = ptty.Input()
return value, inv.WithContext(context.Background()).Run()
return value, inv.WithContext(ctx).Run()
}
func TestPasswordTerminalState(t *testing.T) {
+546 -83
View File
@@ -1,61 +1,59 @@
package cliui
import (
"errors"
"flag"
"io"
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/terminal"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"golang.org/x/xerrors"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/pretty"
"github.com/coder/serpent"
)
func init() {
survey.SelectQuestionTemplate = `
{{- define "option"}}
{{- " " }}{{- if eq .SelectedIndex .CurrentIndex }}{{color "green" }}{{ .Config.Icons.SelectFocus.Text }} {{else}}{{color "default"}} {{end}}
{{- .CurrentOpt.Value}}
{{- color "reset"}}
{{end}}
const defaultSelectModelHeight = 7
{{- if not .ShowAnswer }}
{{- if .Config.Icons.Help.Text }}
{{- if .FilterMessage }}{{ "Search:" }}{{ .FilterMessage }}
{{- else }}
{{- color "black+h"}}{{- "Type to search" }}{{color "reset"}}
{{- end }}
{{- "\n" }}
{{- end }}
{{- "\n" }}
{{- range $ix, $option := .PageEntries}}
{{- template "option" $.IterateOption $ix $option}}
{{- end}}
{{- end }}`
type terminateMsg struct{}
survey.MultiSelectQuestionTemplate = `
{{- define "option"}}
{{- if eq .SelectedIndex .CurrentIndex }}{{color .Config.Icons.SelectFocus.Format }}{{ .Config.Icons.SelectFocus.Text }}{{color "reset"}}{{else}} {{end}}
{{- if index .Checked .CurrentOpt.Index }}{{color .Config.Icons.MarkedOption.Format }} {{ .Config.Icons.MarkedOption.Text }} {{else}}{{color .Config.Icons.UnmarkedOption.Format }} {{ .Config.Icons.UnmarkedOption.Text }} {{end}}
{{- color "reset"}}
{{- " "}}{{- .CurrentOpt.Value}}
{{end}}
{{- if .ShowHelp }}{{- color .Config.Icons.Help.Format }}{{ .Config.Icons.Help.Text }} {{ .Help }}{{color "reset"}}{{"\n"}}{{end}}
{{- if not .ShowAnswer }}
{{- "\n"}}
{{- range $ix, $option := .PageEntries}}
{{- template "option" $.IterateOption $ix $option}}
{{- end}}
{{- end}}`
func installSignalHandler(p *tea.Program) func() {
ch := make(chan struct{})
go func() {
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, syscall.SIGTERM)
defer func() {
signal.Stop(sig)
close(ch)
}()
for {
select {
case <-ch:
return
case <-sig:
p.Send(terminateMsg{})
}
}
}()
return func() {
ch <- struct{}{}
}
}
type SelectOptions struct {
Options []string
// Default will be highlighted first if it's a valid option.
Default string
Message string
Size int
HideSearch bool
}
@@ -112,66 +110,531 @@ func Select(inv *serpent.Invocation, opts SelectOptions) (string, error) {
return opts.Options[0], nil
}
var defaultOption interface{}
if opts.Default != "" {
defaultOption = opts.Default
initialModel := selectModel{
search: textinput.New(),
hideSearch: opts.HideSearch,
options: opts.Options,
height: opts.Size,
message: opts.Message,
}
var value string
err := survey.AskOne(&survey.Select{
Options: opts.Options,
Default: defaultOption,
PageSize: opts.Size,
}, &value, survey.WithIcons(func(is *survey.IconSet) {
is.Help.Text = "Type to search"
if opts.HideSearch {
is.Help.Text = ""
}
}), survey.WithStdio(fileReadWriter{
Reader: inv.Stdin,
}, fileReadWriter{
Writer: inv.Stdout,
}, inv.Stdout))
if errors.Is(err, terminal.InterruptErr) {
return value, Canceled
if initialModel.height == 0 {
initialModel.height = defaultSelectModelHeight
}
return value, err
initialModel.search.Prompt = ""
initialModel.search.Focus()
p := tea.NewProgram(
initialModel,
tea.WithoutSignalHandler(),
tea.WithContext(inv.Context()),
tea.WithInput(inv.Stdin),
tea.WithOutput(inv.Stdout),
)
closeSignalHandler := installSignalHandler(p)
defer closeSignalHandler()
m, err := p.Run()
if err != nil {
return "", err
}
model, ok := m.(selectModel)
if !ok {
return "", xerrors.New(fmt.Sprintf("unknown model found %T (%+v)", m, m))
}
if model.canceled {
return "", Canceled
}
return model.selected, nil
}
func MultiSelect(inv *serpent.Invocation, items []string) ([]string, error) {
type selectModel struct {
search textinput.Model
options []string
cursor int
height int
message string
selected string
canceled bool
hideSearch bool
}
func (selectModel) Init() tea.Cmd {
return nil
}
//nolint:revive // The linter complains about modifying 'm' but this is typical practice for bubbletea
func (m selectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
switch msg := msg.(type) {
case terminateMsg:
m.canceled = true
return m, tea.Quit
case tea.KeyMsg:
switch msg.Type {
case tea.KeyCtrlC:
m.canceled = true
return m, tea.Quit
case tea.KeyEnter:
options := m.filteredOptions()
if len(options) != 0 {
m.selected = options[m.cursor]
return m, tea.Quit
}
case tea.KeyUp:
options := m.filteredOptions()
if m.cursor > 0 {
m.cursor--
} else {
m.cursor = len(options) - 1
}
case tea.KeyDown:
options := m.filteredOptions()
if m.cursor < len(options)-1 {
m.cursor++
} else {
m.cursor = 0
}
}
}
if !m.hideSearch {
oldSearch := m.search.Value()
m.search, cmd = m.search.Update(msg)
// If the search query has changed then we need to ensure
// the cursor is still pointing at a valid option.
if m.search.Value() != oldSearch {
options := m.filteredOptions()
if m.cursor > len(options)-1 {
m.cursor = max(0, len(options)-1)
}
}
}
return m, cmd
}
func (m selectModel) View() string {
var s strings.Builder
msg := pretty.Sprintf(pretty.Bold(), "? %s", m.message)
if m.selected != "" {
selected := pretty.Sprint(DefaultStyles.Keyword, m.selected)
_, _ = s.WriteString(fmt.Sprintf("%s %s\n", msg, selected))
return s.String()
}
if m.hideSearch {
_, _ = s.WriteString(fmt.Sprintf("%s [Use arrows to move]\n", msg))
} else {
_, _ = s.WriteString(fmt.Sprintf(
"%s %s[Use arrows to move, type to filter]\n",
msg,
m.search.View(),
))
}
options, start := m.viewableOptions()
for i, option := range options {
// Is this the currently selected option?
style := pretty.Wrap(" ", "")
if m.cursor == start+i {
style = pretty.Style{
pretty.Wrap("> ", ""),
DefaultStyles.Keyword,
}
}
_, _ = s.WriteString(pretty.Sprint(style, option))
_, _ = s.WriteString("\n")
}
return s.String()
}
func (m selectModel) viewableOptions() ([]string, int) {
options := m.filteredOptions()
halfHeight := m.height / 2
bottom := 0
top := len(options)
switch {
case m.cursor <= halfHeight:
top = min(top, m.height)
case m.cursor < top-halfHeight:
bottom = max(0, m.cursor-halfHeight)
top = min(top, m.cursor+halfHeight+1)
default:
bottom = max(0, top-m.height)
}
return options[bottom:top], bottom
}
func (m selectModel) filteredOptions() []string {
options := []string{}
for _, o := range m.options {
filter := strings.ToLower(m.search.Value())
option := strings.ToLower(o)
if strings.Contains(option, filter) {
options = append(options, o)
}
}
return options
}
type MultiSelectOptions struct {
Message string
Options []string
Defaults []string
EnableCustomInput bool
}
func MultiSelect(inv *serpent.Invocation, opts MultiSelectOptions) ([]string, error) {
// Similar hack is applied to Select()
if flag.Lookup("test.v") != nil {
return items, nil
return opts.Defaults, nil
}
prompt := &survey.MultiSelect{
Options: items,
Default: items,
options := make([]*multiSelectOption, len(opts.Options))
for i, option := range opts.Options {
chosen := false
for _, d := range opts.Defaults {
if option == d {
chosen = true
break
}
}
options[i] = &multiSelectOption{
option: option,
chosen: chosen,
}
}
var values []string
err := survey.AskOne(prompt, &values, survey.WithStdio(fileReadWriter{
Reader: inv.Stdin,
}, fileReadWriter{
Writer: inv.Stdout,
}, inv.Stdout))
if errors.Is(err, terminal.InterruptErr) {
initialModel := multiSelectModel{
search: textinput.New(),
options: options,
message: opts.Message,
enableCustomInput: opts.EnableCustomInput,
}
initialModel.search.Prompt = ""
initialModel.search.Focus()
p := tea.NewProgram(
initialModel,
tea.WithoutSignalHandler(),
tea.WithContext(inv.Context()),
tea.WithInput(inv.Stdin),
tea.WithOutput(inv.Stdout),
)
closeSignalHandler := installSignalHandler(p)
defer closeSignalHandler()
m, err := p.Run()
if err != nil {
return nil, err
}
model, ok := m.(multiSelectModel)
if !ok {
return nil, xerrors.New(fmt.Sprintf("unknown model found %T (%+v)", m, m))
}
if model.canceled {
return nil, Canceled
}
return values, err
return model.selectedOptions(), nil
}
type fileReadWriter struct {
io.Reader
io.Writer
type multiSelectOption struct {
option string
chosen bool
}
func (f fileReadWriter) Fd() uintptr {
if file, ok := f.Reader.(*os.File); ok {
return file.Fd()
}
if file, ok := f.Writer.(*os.File); ok {
return file.Fd()
}
return 0
type multiSelectModel struct {
search textinput.Model
options []*multiSelectOption
cursor int
message string
canceled bool
selected bool
isCustomInputMode bool // track if we're adding a custom option
customInput string // store custom input
enableCustomInput bool // control whether custom input is allowed
}
func (multiSelectModel) Init() tea.Cmd {
return nil
}
//nolint:revive // For same reason as previous Update definition
func (m multiSelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
if m.isCustomInputMode {
return m.handleCustomInputMode(msg)
}
switch msg := msg.(type) {
case terminateMsg:
m.canceled = true
return m, tea.Quit
case tea.KeyMsg:
switch msg.Type {
case tea.KeyCtrlC:
m.canceled = true
return m, tea.Quit
case tea.KeyEnter:
// Switch to custom input mode if we're on the "+ Add custom value:" option
if m.enableCustomInput && m.cursor == len(m.filteredOptions()) {
m.isCustomInputMode = true
return m, nil
}
if len(m.options) != 0 {
m.selected = true
return m, tea.Quit
}
case tea.KeySpace:
options := m.filteredOptions()
if len(options) != 0 {
options[m.cursor].chosen = !options[m.cursor].chosen
}
// We back out early here otherwise a space will be inserted
// into the search field.
return m, nil
case tea.KeyUp:
maxIndex := m.getMaxIndex()
if m.cursor > 0 {
m.cursor--
} else {
m.cursor = maxIndex
}
case tea.KeyDown:
maxIndex := m.getMaxIndex()
if m.cursor < maxIndex {
m.cursor++
} else {
m.cursor = 0
}
case tea.KeyRight:
options := m.filteredOptions()
for _, option := range options {
option.chosen = true
}
case tea.KeyLeft:
options := m.filteredOptions()
for _, option := range options {
option.chosen = false
}
}
}
oldSearch := m.search.Value()
m.search, cmd = m.search.Update(msg)
// If the search query has changed then we need to ensure
// the cursor is still pointing at a valid option.
if m.search.Value() != oldSearch {
options := m.filteredOptions()
if m.cursor > len(options)-1 {
m.cursor = max(0, len(options)-1)
}
}
return m, cmd
}
func (m multiSelectModel) getMaxIndex() int {
options := m.filteredOptions()
if m.enableCustomInput {
// Include the "+ Add custom value" entry
return len(options)
}
// Includes only the actual options
return len(options) - 1
}
// handleCustomInputMode manages keyboard interactions when in custom input mode
func (m *multiSelectModel) handleCustomInputMode(msg tea.Msg) (tea.Model, tea.Cmd) {
keyMsg, ok := msg.(tea.KeyMsg)
if !ok {
return m, nil
}
switch keyMsg.Type {
case tea.KeyEnter:
return m.handleCustomInputSubmission()
case tea.KeyCtrlC:
m.canceled = true
return m, tea.Quit
case tea.KeyBackspace:
return m.handleCustomInputBackspace()
default:
m.customInput += keyMsg.String()
return m, nil
}
}
// handleCustomInputSubmission processes the submission of custom input
func (m *multiSelectModel) handleCustomInputSubmission() (tea.Model, tea.Cmd) {
if m.customInput == "" {
m.isCustomInputMode = false
return m, nil
}
// Clear search to ensure option is visible and cursor points to the new option
m.search.SetValue("")
// Check for duplicates
for i, opt := range m.options {
if opt.option == m.customInput {
// If the option exists but isn't chosen, select it
if !opt.chosen {
opt.chosen = true
}
// Point cursor to the new option
m.cursor = i
// Reset custom input mode to disabled
m.isCustomInputMode = false
m.customInput = ""
return m, nil
}
}
// Add new unique option
m.options = append(m.options, &multiSelectOption{
option: m.customInput,
chosen: true,
})
// Point cursor to the newly added option
m.cursor = len(m.options) - 1
// Reset custom input mode to disabled
m.customInput = ""
m.isCustomInputMode = false
return m, nil
}
// handleCustomInputBackspace handles backspace in custom input mode
func (m *multiSelectModel) handleCustomInputBackspace() (tea.Model, tea.Cmd) {
if len(m.customInput) > 0 {
m.customInput = m.customInput[:len(m.customInput)-1]
}
return m, nil
}
func (m multiSelectModel) View() string {
var s strings.Builder
msg := pretty.Sprintf(pretty.Bold(), "? %s", m.message)
if m.selected {
selected := pretty.Sprint(DefaultStyles.Keyword, strings.Join(m.selectedOptions(), ", "))
_, _ = s.WriteString(fmt.Sprintf("%s %s\n", msg, selected))
return s.String()
}
if m.isCustomInputMode {
_, _ = s.WriteString(fmt.Sprintf("%s\nEnter custom value: %s\n", msg, m.customInput))
return s.String()
}
_, _ = s.WriteString(fmt.Sprintf(
"%s %s[Use arrows to move, space to select, <right> to all, <left> to none, type to filter]\n",
msg,
m.search.View(),
))
options := m.filteredOptions()
for i, option := range options {
cursor := " "
chosen := "[ ]"
o := option.option
if m.cursor == i {
cursor = pretty.Sprint(DefaultStyles.Keyword, "> ")
chosen = pretty.Sprint(DefaultStyles.Keyword, "[ ]")
o = pretty.Sprint(DefaultStyles.Keyword, o)
}
if option.chosen {
chosen = pretty.Sprint(DefaultStyles.Keyword, "[x]")
}
_, _ = s.WriteString(fmt.Sprintf(
"%s%s %s\n",
cursor,
chosen,
o,
))
}
if m.enableCustomInput {
// Add the "+ Add custom value" option at the bottom
cursor := " "
text := " + Add custom value"
if m.cursor == len(options) {
cursor = pretty.Sprint(DefaultStyles.Keyword, "> ")
text = pretty.Sprint(DefaultStyles.Keyword, text)
}
_, _ = s.WriteString(fmt.Sprintf("%s%s\n", cursor, text))
}
return s.String()
}
func (m multiSelectModel) filteredOptions() []*multiSelectOption {
options := []*multiSelectOption{}
for _, o := range m.options {
filter := strings.ToLower(m.search.Value())
option := strings.ToLower(o.option)
if strings.Contains(option, filter) {
options = append(options, o)
}
}
return options
}
func (m multiSelectModel) selectedOptions() []string {
selected := []string{}
for _, o := range m.options {
if o.chosen {
selected = append(selected, o.option)
}
}
return selected
}
+38 -2
View File
@@ -101,13 +101,49 @@ func TestMultiSelect(t *testing.T) {
}()
require.Equal(t, items, <-msgChan)
})
t.Run("MultiSelectWithCustomInput", func(t *testing.T) {
t.Parallel()
items := []string{"Code", "Chairs", "Whale", "Diamond", "Carrot"}
ptty := ptytest.New(t)
msgChan := make(chan []string)
go func() {
resp, err := newMultiSelectWithCustomInput(ptty, items)
assert.NoError(t, err)
msgChan <- resp
}()
require.Equal(t, items, <-msgChan)
})
}
func newMultiSelect(ptty *ptytest.PTY, items []string) ([]string, error) {
func newMultiSelectWithCustomInput(ptty *ptytest.PTY, items []string) ([]string, error) {
var values []string
cmd := &serpent.Command{
Handler: func(inv *serpent.Invocation) error {
selectedItems, err := cliui.MultiSelect(inv, items)
selectedItems, err := cliui.MultiSelect(inv, cliui.MultiSelectOptions{
Options: items,
Defaults: items,
EnableCustomInput: true,
})
if err == nil {
values = selectedItems
}
return err
},
}
inv := cmd.Invoke()
ptty.Attach(inv)
return values, inv.Run()
}
func newMultiSelect(ptty *ptytest.PTY, items []string) ([]string, error) {
var values []string
cmd := &serpent.Command{
Handler: func(inv *serpent.Invocation) error {
selectedItems, err := cliui.MultiSelect(inv, cliui.MultiSelectOptions{
Options: items,
Defaults: items,
})
if err == nil {
values = selectedItems
}
+78 -18
View File
@@ -22,6 +22,13 @@ func Table() table.Writer {
return tableWriter
}
// This type can be supplied as part of a slice to DisplayTable
// or to a `TableFormat` `Format` call to render a separator.
// Leading separators are not supported and trailing separators
// are ignored by the table formatter.
// e.g. `[]any{someRow, TableSeparator, someRow}`
type TableSeparator struct{}
// filterTableColumns returns configurations to hide columns
// that are not provided in the array. If the array is empty,
// no filtering will occur!
@@ -47,8 +54,12 @@ func filterTableColumns(header table.Row, columns []string) []table.ColumnConfig
return columnConfigs
}
// DisplayTable renders a table as a string. The input argument must be a slice
// of structs. At least one field in the struct must have a `table:""` tag
// DisplayTable renders a table as a string. The input argument can be:
// - a struct slice.
// - an interface slice, where the first element is a struct,
// and all other elements are of the same type, or a TableSeparator.
//
// At least one field in the struct must have a `table:""` tag
// containing the name of the column in the outputted table.
//
// If `sort` is not specified, the field with the `table:"$NAME,default_sort"`
@@ -66,11 +77,20 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
v := reflect.Indirect(reflect.ValueOf(out))
if v.Kind() != reflect.Slice {
return "", xerrors.Errorf("DisplayTable called with a non-slice type")
return "", xerrors.New("DisplayTable called with a non-slice type")
}
var tableType reflect.Type
if v.Type().Elem().Kind() == reflect.Interface {
if v.Len() == 0 {
return "", xerrors.New("DisplayTable called with empty interface slice")
}
tableType = reflect.Indirect(reflect.ValueOf(v.Index(0).Interface())).Type()
} else {
tableType = v.Type().Elem()
}
// Get the list of table column headers.
headersRaw, defaultSort, err := typeToTableHeaders(v.Type().Elem(), true)
headersRaw, defaultSort, err := typeToTableHeaders(tableType, true)
if err != nil {
return "", xerrors.Errorf("get table headers recursively for type %q: %w", v.Type().Elem().String(), err)
}
@@ -82,9 +102,8 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
}
headers := make(table.Row, len(headersRaw))
for i, header := range headersRaw {
headers[i] = header
headers[i] = strings.ReplaceAll(header, "_", " ")
}
// Verify that the given sort column and filter columns are valid.
if sort != "" || len(filterColumns) != 0 {
headersMap := make(map[string]string, len(headersRaw))
@@ -130,6 +149,11 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
return "", xerrors.Errorf("specified sort column %q not found in table headers, available columns are %q", sort, strings.Join(headersRaw, `", "`))
}
}
return renderTable(out, sort, headers, filterColumns)
}
func renderTable(out any, sort string, headers table.Row, filterColumns []string) (string, error) {
v := reflect.Indirect(reflect.ValueOf(out))
// Setup the table formatter.
tw := Table()
@@ -143,15 +167,22 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
// Write each struct to the table.
for i := 0; i < v.Len(); i++ {
cur := v.Index(i).Interface()
_, ok := cur.(TableSeparator)
if ok {
tw.AppendSeparator()
continue
}
// Format the row as a slice.
rowMap, err := valueToTableMap(v.Index(i))
// ValueToTableMap does what `reflect.Indirect` does
rowMap, err := valueToTableMap(reflect.ValueOf(cur))
if err != nil {
return "", xerrors.Errorf("get table row map %v: %w", i, err)
}
rowSlice := make([]any, len(headers))
for i, h := range headersRaw {
v, ok := rowMap[h]
for i, h := range headers {
v, ok := rowMap[h.(string)]
if !ok {
v = nil
}
@@ -168,12 +199,34 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
if val != nil {
v = *val
}
case *time.Duration:
if val != nil {
v = val.String()
}
case fmt.Stringer:
if val != nil {
v = val.String()
}
}
// Guard against nil dereferences
if v != nil {
rt := reflect.TypeOf(v)
switch rt.Kind() {
case reflect.Slice:
// By default, the behavior is '%v', which just returns a string like
// '[a b c]'. This will add commas in between each value.
strs := make([]string, 0)
vt := reflect.ValueOf(v)
for i := 0; i < vt.Len(); i++ {
strs = append(strs, fmt.Sprintf("%v", vt.Index(i).Interface()))
}
v = "[" + strings.Join(strs, ", ") + "]"
default:
// Leave it as it is
}
}
rowSlice[i] = v
}
@@ -188,25 +241,28 @@ func DisplayTable(out any, sort string, filterColumns []string) (string, error)
// returned. If the table tag is malformed, an error is returned.
//
// The returned name is transformed from "snake_case" to "normal text".
func parseTableStructTag(field reflect.StructField) (name string, defaultSort, recursive bool, skipParentName bool, err error) {
func parseTableStructTag(field reflect.StructField) (name string, defaultSort, noSortOpt, recursive, skipParentName bool, err error) {
tags, err := structtag.Parse(string(field.Tag))
if err != nil {
return "", false, false, false, xerrors.Errorf("parse struct field tag %q: %w", string(field.Tag), err)
return "", false, false, false, false, xerrors.Errorf("parse struct field tag %q: %w", string(field.Tag), err)
}
tag, err := tags.Get("table")
if err != nil || tag.Name == "-" {
// tags.Get only returns an error if the tag is not found.
return "", false, false, false, nil
return "", false, false, false, false, nil
}
defaultSortOpt := false
noSortOpt = false
recursiveOpt := false
skipParentNameOpt := false
for _, opt := range tag.Options {
switch opt {
case "default_sort":
defaultSortOpt = true
case "nosort":
noSortOpt = true
case "recursive":
recursiveOpt = true
case "recursive_inline":
@@ -216,11 +272,11 @@ func parseTableStructTag(field reflect.StructField) (name string, defaultSort, r
recursiveOpt = true
skipParentNameOpt = true
default:
return "", false, false, false, xerrors.Errorf("unknown option %q in struct field tag", opt)
return "", false, false, false, false, xerrors.Errorf("unknown option %q in struct field tag", opt)
}
}
return strings.ReplaceAll(tag.Name, "_", " "), defaultSortOpt, recursiveOpt, skipParentNameOpt, nil
return strings.ReplaceAll(tag.Name, "_", " "), defaultSortOpt, noSortOpt, recursiveOpt, skipParentNameOpt, nil
}
func isStructOrStructPointer(t reflect.Type) bool {
@@ -244,12 +300,16 @@ func typeToTableHeaders(t reflect.Type, requireDefault bool) ([]string, string,
headers := []string{}
defaultSortName := ""
noSortOpt := false
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
name, defaultSort, recursive, skip, err := parseTableStructTag(field)
name, defaultSort, noSort, recursive, skip, err := parseTableStructTag(field)
if err != nil {
return nil, "", xerrors.Errorf("parse struct tags for field %q in type %q: %w", field.Name, t.String(), err)
}
if requireDefault && noSort {
noSortOpt = true
}
if name == "" && (recursive && skip) {
return nil, "", xerrors.Errorf("a name is required for the field %q. "+
@@ -292,8 +352,8 @@ func typeToTableHeaders(t reflect.Type, requireDefault bool) ([]string, string,
headers = append(headers, name)
}
if defaultSortName == "" && requireDefault {
return nil, "", xerrors.Errorf("no field marked as default_sort in type %q", t.String())
if defaultSortName == "" && requireDefault && !noSortOpt {
return nil, "", xerrors.Errorf("no field marked as default_sort or nosort in type %q", t.String())
}
return headers, defaultSortName, nil
@@ -320,7 +380,7 @@ func valueToTableMap(val reflect.Value) (map[string]any, error) {
for i := 0; i < val.NumField(); i++ {
field := val.Type().Field(i)
fieldVal := val.Field(i)
name, _, recursive, skip, err := parseTableStructTag(field)
name, _, _, recursive, skip, err := parseTableStructTag(field)
if err != nil {
return nil, xerrors.Errorf("parse struct tags for field %q in type %T: %w", field.Name, val, err)
}
+44 -16
View File
@@ -138,10 +138,10 @@ func Test_DisplayTable(t *testing.T) {
t.Parallel()
expected := `
NAME AGE ROLES SUB 1 NAME SUB 1 AGE SUB 2 NAME SUB 2 AGE SUB 3 INNER NAME SUB 3 INNER AGE SUB 4 TIME TIME PTR
bar 20 [a] bar1 21 <nil> <nil> bar3 23 {bar4 24 } 2022-08-02T15:49:10Z <nil>
baz 30 [] baz1 31 <nil> <nil> baz3 33 {baz4 34 } 2022-08-02T15:49:10Z <nil>
foo 10 [a b c] foo1 11 foo2 12 foo3 13 {foo4 14 } 2022-08-02T15:49:10Z 2022-08-02T15:49:10Z
NAME AGE ROLES SUB 1 NAME SUB 1 AGE SUB 2 NAME SUB 2 AGE SUB 3 INNER NAME SUB 3 INNER AGE SUB 4 TIME TIME PTR
bar 20 [a] bar1 21 <nil> <nil> bar3 23 {bar4 24 } 2022-08-02T15:49:10Z <nil>
baz 30 [] baz1 31 <nil> <nil> baz3 33 {baz4 34 } 2022-08-02T15:49:10Z <nil>
foo 10 [a, b, c] foo1 11 foo2 12 foo3 13 {foo4 14 } 2022-08-02T15:49:10Z 2022-08-02T15:49:10Z
`
// Test with non-pointer values.
@@ -165,10 +165,10 @@ foo 10 [a b c] foo1 11 foo2 12 foo3
t.Parallel()
expected := `
NAME AGE ROLES SUB 1 NAME SUB 1 AGE SUB 2 NAME SUB 2 AGE SUB 3 INNER NAME SUB 3 INNER AGE SUB 4 TIME TIME PTR
foo 10 [a b c] foo1 11 foo2 12 foo3 13 {foo4 14 } 2022-08-02T15:49:10Z 2022-08-02T15:49:10Z
bar 20 [a] bar1 21 <nil> <nil> bar3 23 {bar4 24 } 2022-08-02T15:49:10Z <nil>
baz 30 [] baz1 31 <nil> <nil> baz3 33 {baz4 34 } 2022-08-02T15:49:10Z <nil>
NAME AGE ROLES SUB 1 NAME SUB 1 AGE SUB 2 NAME SUB 2 AGE SUB 3 INNER NAME SUB 3 INNER AGE SUB 4 TIME TIME PTR
foo 10 [a, b, c] foo1 11 foo2 12 foo3 13 {foo4 14 } 2022-08-02T15:49:10Z 2022-08-02T15:49:10Z
bar 20 [a] bar1 21 <nil> <nil> bar3 23 {bar4 24 } 2022-08-02T15:49:10Z <nil>
baz 30 [] baz1 31 <nil> <nil> baz3 33 {baz4 34 } 2022-08-02T15:49:10Z <nil>
`
out, err := cliui.DisplayTable(in, "age", nil)
@@ -218,6 +218,42 @@ Alice 25
compareTables(t, expected, out)
})
// This test ensures we can display dynamically typed slices
t.Run("Interfaces", func(t *testing.T) {
t.Parallel()
in := []any{tableTest1{}}
out, err := cliui.DisplayTable(in, "", nil)
t.Log("rendered table:\n" + out)
require.NoError(t, err)
other := []tableTest1{{}}
expected, err := cliui.DisplayTable(other, "", nil)
require.NoError(t, err)
compareTables(t, expected, out)
})
t.Run("WithSeparator", func(t *testing.T) {
t.Parallel()
expected := `
NAME AGE ROLES SUB 1 NAME SUB 1 AGE SUB 2 NAME SUB 2 AGE SUB 3 INNER NAME SUB 3 INNER AGE SUB 4 TIME TIME PTR
bar 20 [a] bar1 21 <nil> <nil> bar3 23 {bar4 24 } 2022-08-02T15:49:10Z <nil>
---------------------------------------------------------------------------------------------------------------------------------------------------------------
baz 30 [] baz1 31 <nil> <nil> baz3 33 {baz4 34 } 2022-08-02T15:49:10Z <nil>
---------------------------------------------------------------------------------------------------------------------------------------------------------------
foo 10 [a, b, c] foo1 11 foo2 12 foo3 13 {foo4 14 } 2022-08-02T15:49:10Z 2022-08-02T15:49:10Z
`
var inlineIn []any
for _, v := range in {
inlineIn = append(inlineIn, v)
inlineIn = append(inlineIn, cliui.TableSeparator{})
}
out, err := cliui.DisplayTable(inlineIn, "", nil)
t.Log("rendered table:\n" + out)
require.NoError(t, err)
compareTables(t, expected, out)
})
// This test ensures that safeties against invalid use of `table` tags
// causes errors (even without data).
t.Run("Errors", func(t *testing.T) {
@@ -255,14 +291,6 @@ Alice 25
_, err := cliui.DisplayTable(in, "", nil)
require.Error(t, err)
})
t.Run("WithData", func(t *testing.T) {
t.Parallel()
in := []any{tableTest1{}}
_, err := cliui.DisplayTable(in, "", nil)
require.Error(t, err)
})
})
t.Run("NotStruct", func(t *testing.T) {
+114
View File
@@ -0,0 +1,114 @@
package cliutil
import (
"context"
"encoding/json"
"io"
"net/http"
"net/netip"
"time"
"golang.org/x/xerrors"
)
const AWSIPRangesURL = "https://ip-ranges.amazonaws.com/ip-ranges.json"
type awsIPv4Prefix struct {
Prefix string `json:"ip_prefix"`
Region string `json:"region"`
Service string `json:"service"`
NetworkBorderGroup string `json:"network_border_group"`
}
type awsIPv6Prefix struct {
Prefix string `json:"ipv6_prefix"`
Region string `json:"region"`
Service string `json:"service"`
NetworkBorderGroup string `json:"network_border_group"`
}
type AWSIPRanges struct {
V4 []netip.Prefix
V6 []netip.Prefix
}
type awsIPRangesResponse struct {
SyncToken string `json:"syncToken"`
CreateDate string `json:"createDate"`
IPV4Prefixes []awsIPv4Prefix `json:"prefixes"`
IPV6Prefixes []awsIPv6Prefix `json:"ipv6_prefixes"`
}
func FetchAWSIPRanges(ctx context.Context, url string) (*AWSIPRanges, error) {
client := &http.Client{}
reqCtx, reqCancel := context.WithTimeout(ctx, 5*time.Second)
defer reqCancel()
req, _ := http.NewRequestWithContext(reqCtx, http.MethodGet, url, nil)
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
b, _ := io.ReadAll(resp.Body)
return nil, xerrors.Errorf("unexpected status code %d: %s", resp.StatusCode, b)
}
var body awsIPRangesResponse
err = json.NewDecoder(resp.Body).Decode(&body)
if err != nil {
return nil, xerrors.Errorf("json decode: %w", err)
}
out := &AWSIPRanges{
V4: make([]netip.Prefix, 0, len(body.IPV4Prefixes)),
V6: make([]netip.Prefix, 0, len(body.IPV6Prefixes)),
}
for _, p := range body.IPV4Prefixes {
prefix, err := netip.ParsePrefix(p.Prefix)
if err != nil {
return nil, xerrors.Errorf("parse ip prefix: %w", err)
}
if prefix.Addr().Is6() {
return nil, xerrors.Errorf("ipv4 prefix contains ipv6 address: %s", p.Prefix)
}
out.V4 = append(out.V4, prefix)
}
for _, p := range body.IPV6Prefixes {
prefix, err := netip.ParsePrefix(p.Prefix)
if err != nil {
return nil, xerrors.Errorf("parse ip prefix: %w", err)
}
if prefix.Addr().Is4() {
return nil, xerrors.Errorf("ipv6 prefix contains ipv4 address: %s", p.Prefix)
}
out.V6 = append(out.V6, prefix)
}
return out, nil
}
// CheckIP checks if the given IP address is an AWS IP.
func (r *AWSIPRanges) CheckIP(ip netip.Addr) bool {
if ip.IsLoopback() || ip.IsLinkLocalMulticast() || ip.IsLinkLocalUnicast() || ip.IsPrivate() {
return false
}
if ip.Is4() {
for _, p := range r.V4 {
if p.Contains(ip) {
return true
}
}
} else {
for _, p := range r.V6 {
if p.Contains(ip) {
return true
}
}
}
return false
}

Some files were not shown because too many files have changed in this diff Show More