Skip to content

[pull] main from coder:main #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ jobs:
# a separate repository to allow its use before actions/checkout.
- name: Setup RAM Disks
if: runner.os == 'Windows'
uses: coder/setup-ramdisk-action@a4b59caa8be2e88c348abeef042d7c1a33d8743e
uses: coder/setup-ramdisk-action@e1100847ab2d7bcd9d14bcda8f2d1b0f07b36f1b

- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down Expand Up @@ -436,7 +436,7 @@ jobs:
# a separate repository to allow its use before actions/checkout.
- name: Setup RAM Disks
if: runner.os == 'Windows'
uses: coder/setup-ramdisk-action@a4b59caa8be2e88c348abeef042d7c1a33d8743e
uses: coder/setup-ramdisk-action@e1100847ab2d7bcd9d14bcda8f2d1b0f07b36f1b

- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
12 changes: 6 additions & 6 deletions agent/agentcontainers/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func TestAPI(t *testing.T) {

// Make sure the ticker function has been registered
// before advancing the clock.
tickerTrap.MustWait(ctx).Release()
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()

// Initial request returns the initial data.
Expand Down Expand Up @@ -432,7 +432,7 @@ func TestAPI(t *testing.T) {

// Make sure the ticker function has been registered
// before advancing the clock.
tickerTrap.MustWait(ctx).Release()
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()

for i := range tt.wantStatus {
Expand Down Expand Up @@ -486,7 +486,7 @@ func TestAPI(t *testing.T) {
nowRecreateSuccessTrap.Close()
// The timestamp for the error will be stored, which gives
// us a good anchor point to know when to do our request.
nowRecreateErrorTrap.MustWait(ctx).Release()
nowRecreateErrorTrap.MustWait(ctx).MustRelease(ctx)
nowRecreateErrorTrap.Close()

// Advance the clock to run the devcontainer state update routine.
Expand All @@ -507,7 +507,7 @@ func TestAPI(t *testing.T) {
}

// Ensure the devcontainer ends up in success state.
nowRecreateSuccessTrap.MustWait(ctx).Release()
nowRecreateSuccessTrap.MustWait(ctx).MustRelease(ctx)
nowRecreateSuccessTrap.Close()

// Advance the clock to run the devcontainer state update routine.
Expand Down Expand Up @@ -911,7 +911,7 @@ func TestAPI(t *testing.T) {

// Make sure the ticker function has been registered
// before advancing any use of mClock.Advance.
tickerTrap.MustWait(ctx).Release()
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()

// Make sure the start loop has been called.
Expand Down Expand Up @@ -1007,7 +1007,7 @@ func TestAPI(t *testing.T) {

// Make sure the ticker function has been registered
// before advancing any use of mClock.Advance.
tickerTrap.MustWait(ctx).Release()
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()

// Call the list endpoint first to ensure config files are
Expand Down
18 changes: 9 additions & 9 deletions agent/apphealth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestAppHealth_Healthy(t *testing.T) {
healthchecksStarted := make([]string, 2)
for i := 0; i < 2; i++ {
c := healthcheckTrap.MustWait(ctx)
c.Release()
c.MustRelease(ctx)
healthchecksStarted[i] = c.Tags[1]
}
slices.Sort(healthchecksStarted)
Expand All @@ -87,7 +87,7 @@ func TestAppHealth_Healthy(t *testing.T) {
// 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()
reportTrap.MustWait(ctx).MustRelease(ctx)

mClock.Advance(999 * time.Millisecond).MustWait(ctx) // app2 is now healthy

Expand Down Expand Up @@ -143,11 +143,11 @@ func TestAppHealth_500(t *testing.T) {

fakeAPI, closeFn := setupAppReporter(ctx, t, slices.Clone(apps), handlers, mClock)
defer closeFn()
healthcheckTrap.MustWait(ctx).Release()
healthcheckTrap.MustWait(ctx).MustRelease(ctx)
// 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()
reportTrap.MustWait(ctx).MustRelease(ctx)

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
Expand Down Expand Up @@ -202,25 +202,25 @@ func TestAppHealth_Timeout(t *testing.T) {

fakeAPI, closeFn := setupAppReporter(ctx, t, apps, handlers, mClock)
defer closeFn()
healthcheckTrap.MustWait(ctx).Release()
healthcheckTrap.MustWait(ctx).MustRelease(ctx)
// 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()
reportTrap.MustWait(ctx).MustRelease(ctx)

w := mClock.Set(ms(1000)) // 1st check starts
timeoutTrap.MustWait(ctx).Release()
timeoutTrap.MustWait(ctx).MustRelease(ctx)
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()
timeoutTrap.MustWait(ctx).MustRelease(ctx)
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()
timeoutTrap.MustWait(ctx).MustRelease(ctx)
mClock.Set(ms(3001)).MustWait(ctx) // report tick, sends changes

update := testutil.TryReceive(ctx, t, fakeAPI.AppHealthCh())
Expand Down
2 changes: 1 addition & 1 deletion cli/ssh_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestCloserStack_Timeout(t *testing.T) {
defer close(closed)
uut.close(nil)
}()
trap.MustWait(ctx).Release()
trap.MustWait(ctx).MustRelease(ctx)
// top starts right away, but it hangs
testutil.TryReceive(ctx, t, ac[2].started)
// timer pops and we start the middle one
Expand Down
2 changes: 1 addition & 1 deletion coderd/autobuild/notify/notifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func TestNotifier(t *testing.T) {
n := notify.New(cond, testCase.PollInterval, testCase.Countdown, notify.WithTestClock(mClock))
defer n.Close()

trap.MustWait(ctx).Release() // ensure ticker started
trap.MustWait(ctx).MustRelease(ctx) // ensure ticker started
for i := 0; i < testCase.NTicks; i++ {
interval, w := mClock.AdvanceNext()
w.MustWait(ctx)
Expand Down
2 changes: 1 addition & 1 deletion coderd/cryptokeys/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func TestCryptoKeyCache(t *testing.T) {
require.Equal(t, 2, ff.called)
require.Equal(t, decodedSecret(t, newKey), key)

trapped.Release()
trapped.MustRelease(ctx)
wait.MustWait(ctx)
require.Equal(t, 2, ff.called)
trap.Close()
Expand Down
2 changes: 1 addition & 1 deletion coderd/cryptokeys/rotate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestRotator(t *testing.T) {
require.Len(t, dbkeys, initialKeyLen)
requireContainsAllFeatures(t, dbkeys)

trap.MustWait(ctx).Release()
trap.MustWait(ctx).MustRelease(ctx)
_, wait := clock.AdvanceNext()
wait.MustWait(ctx)

Expand Down
6 changes: 3 additions & 3 deletions coderd/database/dbpurge/dbpurge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,18 @@ func awaitDoTick(ctx context.Context, t *testing.T, clk *quartz.Mock) chan struc
defer trapStop.Close()
defer trapNow.Close()
// Wait for the initial tick signified by a call to Now().
trapNow.MustWait(ctx).Release()
trapNow.MustWait(ctx).MustRelease(ctx)
// doTick runs here. Wait for the next
// ticker reset event that signifies it's completed.
trapReset.MustWait(ctx).Release()
trapReset.MustWait(ctx).MustRelease(ctx)
// Ensure that the next tick happens in 10 minutes from start.
d, w := clk.AdvanceNext()
if !assert.Equal(t, 10*time.Minute, d) {
return
}
w.MustWait(ctx)
// Wait for the ticker stop event.
trapStop.MustWait(ctx).Release()
trapStop.MustWait(ctx).MustRelease(ctx)
}()

return ch
Expand Down
6 changes: 3 additions & 3 deletions coderd/database/pubsub/watchdog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestWatchdog_NoTimeout(t *testing.T) {
// right baseline time.
pc, err := pubTrap.Wait(ctx)
require.NoError(t, err)
pc.Release()
pc.MustRelease(ctx)
require.Equal(t, 15*time.Second, pc.Duration)

// we subscribe after starting the timer, so we know the timer also starts
Expand Down Expand Up @@ -66,7 +66,7 @@ func TestWatchdog_NoTimeout(t *testing.T) {
}()
sc, err := subTrap.Wait(ctx) // timer.Stop() called
require.NoError(t, err)
sc.Release()
sc.MustRelease(ctx)
err = testutil.TryReceive(ctx, t, errCh)
require.NoError(t, err)
}
Expand All @@ -88,7 +88,7 @@ func TestWatchdog_Timeout(t *testing.T) {
// right baseline time.
pc, err := pubTrap.Wait(ctx)
require.NoError(t, err)
pc.Release()
pc.MustRelease(ctx)
require.Equal(t, 15*time.Second, pc.Duration)

// we subscribe after starting the timer, so we know the timer also starts
Expand Down
4 changes: 2 additions & 2 deletions coderd/notifications/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ func TestPendingUpdatesMetric(t *testing.T) {
require.NoError(t, err)

mgr.Run(ctx)
trap.MustWait(ctx).Release() // ensures ticker has been set
fetchTrap.MustWait(ctx).Release()
trap.MustWait(ctx).MustRelease(ctx) // ensures ticker has been set
fetchTrap.MustWait(ctx).MustRelease(ctx)

// Advance to the first fetch
mClock.Advance(cfg.FetchInterval.Value()).MustWait(ctx)
Expand Down
4 changes: 2 additions & 2 deletions coderd/notifications/notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ func TestBackpressure(t *testing.T) {

// Start the notifier.
mgr.Run(ctx)
syncTrap.MustWait(ctx).Release()
fetchTrap.MustWait(ctx).Release()
syncTrap.MustWait(ctx).MustRelease(ctx)
fetchTrap.MustWait(ctx).MustRelease(ctx)

// THEN:

Expand Down
24 changes: 12 additions & 12 deletions docs/admin/templates/extending-templates/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,13 @@ parameters in one of two ways:

Or set the [environment variable](../../setup/index.md), `CODER_EXPERIMENTS=auto-fill-parameters`

## Dynamic Parameters
## Dynamic Parameters (Early Access)

Dynamic Parameters enhances Coder's existing parameter system with real-time validation,
conditional parameter behavior, and richer input types.
This feature allows template authors to create more interactive and responsive workspace creation experiences.

### Enable Dynamic Parameters (Early Access)
### Enable Dynamic Parameters

To use Dynamic Parameters, enable the experiment flag or set the environment variable.

Expand Down Expand Up @@ -488,7 +488,7 @@ The "Options" column in the table below indicates whether the form type requires

### Form Type Examples

<details><summary>`checkbox`: A single checkbox for boolean values</summary>
<details><summary>checkbox: A single checkbox for boolean values</summary>

```tf
data "coder_parameter" "enable_gpu" {
Expand All @@ -502,7 +502,7 @@ data "coder_parameter" "enable_gpu" {

</details>

<details><summary>`dropdown`: A searchable select menu for choosing a single option from a list</summary>
<details><summary>dropdown: A searchable select menu for choosing a single option from a list</summary>

```tf
data "coder_parameter" "region" {
Expand All @@ -525,7 +525,7 @@ data "coder_parameter" "region" {

</details>

<details><summary>`input`: A standard text input field</summary>
<details><summary>input: A standard text input field</summary>

```tf
data "coder_parameter" "custom_domain" {
Expand All @@ -539,7 +539,7 @@ data "coder_parameter" "custom_domain" {

</details>

<details><summary>`key-value`: Input for entering key-value pairs</summary>
<details><summary>key-value: Input for entering key-value pairs</summary>

```tf
data "coder_parameter" "environment_vars" {
Expand All @@ -553,7 +553,7 @@ data "coder_parameter" "environment_vars" {

</details>

<details><summary>`multi-select`: Checkboxes for selecting multiple options from a list</summary>
<details><summary>multi-select: Checkboxes for selecting multiple options from a list</summary>

```tf
data "coder_parameter" "tools" {
Expand All @@ -580,7 +580,7 @@ data "coder_parameter" "tools" {

</details>

<details><summary>`password`: A text input that masks sensitive information</summary>
<details><summary>password: A text input that masks sensitive information</summary>

```tf
data "coder_parameter" "api_key" {
Expand All @@ -594,7 +594,7 @@ data "coder_parameter" "api_key" {

</details>

<details><summary>`radio`: Radio buttons for selecting a single option with high visibility</summary>
<details><summary>radio: Radio buttons for selecting a single option with high visibility</summary>

```tf
data "coder_parameter" "environment" {
Expand All @@ -617,7 +617,7 @@ data "coder_parameter" "environment" {

</details>

<details><summary>`slider`: A slider for selecting numeric values within a range</summary>
<details><summary>slider: A slider for selecting numeric values within a range</summary>

```tf
data "coder_parameter" "cpu_cores" {
Expand All @@ -635,7 +635,7 @@ data "coder_parameter" "cpu_cores" {

</details>

<details><summary>`switch`: A toggle switch for boolean values</summary>
<details><summary>switch: A toggle switch for boolean values</summary>

```tf
data "coder_parameter" "advanced_mode" {
Expand All @@ -649,7 +649,7 @@ data "coder_parameter" "advanced_mode" {

</details>

<details><summary>`textarea`: A multi-line text input field for longer content</summary>
<details><summary>textarea: A multi-line text input field for longer content</summary>

```tf
data "coder_parameter" "init_script" {
Expand Down
2 changes: 1 addition & 1 deletion enterprise/coderd/prebuilds/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ func TestRunLoop(t *testing.T) {
trap := clock.Trap().NewTicker()
go reconciler.Run(ctx)
// wait until ticker is initialized
trap.MustWait(ctx).Release()
trap.MustWait(ctx).MustRelease(ctx)
// start 1st iteration of ReconciliationLoop
// NOTE: at this point MustWait waits that iteration is started (ReconcileAll is called), but it doesn't wait until it completes
clock.Advance(cfg.ReconciliationInterval.Value()).MustWait(ctx)
Expand Down
Loading
Loading