Skip to content

Commit f079dcd

Browse files
committed
Merge branch 'main' of https://github.com/coder/coder into bq/use-new-avatar
2 parents 0a0b1cf + 63572d9 commit f079dcd

File tree

66 files changed

+814
-662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+814
-662
lines changed

cli/exp_scaletest.go

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"io"
1010
"math/rand"
1111
"net/http"
12+
"net/url"
1213
"os"
1314
"os/signal"
1415
"strconv"
@@ -860,13 +861,14 @@ func (r *RootCmd) scaletestCreateWorkspaces() *serpent.Command {
860861

861862
func (r *RootCmd) scaletestWorkspaceTraffic() *serpent.Command {
862863
var (
863-
tickInterval time.Duration
864-
bytesPerTick int64
865-
ssh bool
866-
useHostLogin bool
867-
app string
868-
template string
869-
targetWorkspaces string
864+
tickInterval time.Duration
865+
bytesPerTick int64
866+
ssh bool
867+
useHostLogin bool
868+
app string
869+
template string
870+
targetWorkspaces string
871+
workspaceProxyURL string
870872

871873
client = &codersdk.Client{}
872874
tracingFlags = &scaletestTracingFlags{}
@@ -1002,6 +1004,23 @@ func (r *RootCmd) scaletestWorkspaceTraffic() *serpent.Command {
10021004
return xerrors.Errorf("configure workspace app: %w", err)
10031005
}
10041006

1007+
var webClient *codersdk.Client
1008+
if workspaceProxyURL != "" {
1009+
u, err := url.Parse(workspaceProxyURL)
1010+
if err != nil {
1011+
return xerrors.Errorf("parse workspace proxy URL: %w", err)
1012+
}
1013+
1014+
webClient = codersdk.New(u)
1015+
webClient.HTTPClient = client.HTTPClient
1016+
webClient.SetSessionToken(client.SessionToken())
1017+
1018+
appConfig, err = createWorkspaceAppConfig(webClient, appHost.Host, app, ws, agent)
1019+
if err != nil {
1020+
return xerrors.Errorf("configure proxy workspace app: %w", err)
1021+
}
1022+
}
1023+
10051024
// Setup our workspace agent connection.
10061025
config := workspacetraffic.Config{
10071026
AgentID: agent.ID,
@@ -1015,6 +1034,10 @@ func (r *RootCmd) scaletestWorkspaceTraffic() *serpent.Command {
10151034
App: appConfig,
10161035
}
10171036

1037+
if webClient != nil {
1038+
config.WebClient = webClient
1039+
}
1040+
10181041
if err := config.Validate(); err != nil {
10191042
return xerrors.Errorf("validate config: %w", err)
10201043
}
@@ -1108,6 +1131,13 @@ func (r *RootCmd) scaletestWorkspaceTraffic() *serpent.Command {
11081131
Description: "Connect as the currently logged in user.",
11091132
Value: serpent.BoolOf(&useHostLogin),
11101133
},
1134+
{
1135+
Flag: "workspace-proxy-url",
1136+
Env: "CODER_SCALETEST_WORKSPACE_PROXY_URL",
1137+
Default: "",
1138+
Description: "URL for workspace proxy to send web traffic to.",
1139+
Value: serpent.StringOf(&workspaceProxyURL),
1140+
},
11111141
}
11121142

11131143
tracingFlags.attach(&cmd.Options)

coderd/healthcheck/websocket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
"time"
1111

1212
"golang.org/x/xerrors"
13-
"nhooyr.io/websocket"
1413

1514
"github.com/coder/coder/v2/coderd/healthcheck/health"
1615
"github.com/coder/coder/v2/codersdk/healthsdk"
16+
"github.com/coder/websocket"
1717
)
1818

1919
type WebsocketReport healthsdk.WebsocketReport

coderd/httpapi/httpapi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ const websocketCloseMaxLen = 123
268268
func WebsocketCloseSprintf(format string, vars ...any) string {
269269
msg := fmt.Sprintf(format, vars...)
270270

271-
// Cap msg length at 123 bytes. nhooyr/websocket only allows close messages
271+
// Cap msg length at 123 bytes. coder/websocket only allows close messages
272272
// of this length.
273273
if len(msg) > websocketCloseMaxLen {
274274
// Trim the string to 123 bytes. If we accidentally cut in the middle of

coderd/httpapi/websocket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"time"
77

88
"golang.org/x/xerrors"
9-
"nhooyr.io/websocket"
109

1110
"cdr.dev/slog"
11+
"github.com/coder/websocket"
1212
)
1313

1414
// Heartbeat loops to ping a WebSocket to keep it alive.

coderd/provisionerjobs.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ import (
1212

1313
"github.com/google/uuid"
1414
"golang.org/x/xerrors"
15-
"nhooyr.io/websocket"
1615

1716
"cdr.dev/slog"
18-
"github.com/coder/coder/v2/codersdk/wsjson"
19-
2017
"github.com/coder/coder/v2/coderd/database"
2118
"github.com/coder/coder/v2/coderd/database/db2sdk"
2219
"github.com/coder/coder/v2/coderd/database/dbauthz"
2320
"github.com/coder/coder/v2/coderd/database/pubsub"
2421
"github.com/coder/coder/v2/coderd/httpapi"
2522
"github.com/coder/coder/v2/codersdk"
23+
"github.com/coder/coder/v2/codersdk/wsjson"
2624
"github.com/coder/coder/v2/provisionersdk"
25+
"github.com/coder/websocket"
2726
)
2827

2928
// Returns provisioner logs based on query parameters.

coderd/provisionerjobs_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/stretchr/testify/assert"
1515
"github.com/stretchr/testify/require"
1616
"go.uber.org/mock/gomock"
17-
"nhooyr.io/websocket"
1817

1918
"github.com/coder/coder/v2/coderd/database"
2019
"github.com/coder/coder/v2/coderd/database/dbmock"
@@ -23,6 +22,7 @@ import (
2322
"github.com/coder/coder/v2/codersdk"
2423
"github.com/coder/coder/v2/provisionersdk"
2524
"github.com/coder/coder/v2/testutil"
25+
"github.com/coder/websocket"
2626
)
2727

2828
func TestConvertProvisionerJob_Unit(t *testing.T) {

coderd/workspaceagents.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"golang.org/x/exp/slices"
2121
"golang.org/x/sync/errgroup"
2222
"golang.org/x/xerrors"
23-
"nhooyr.io/websocket"
2423
"tailscale.com/tailcfg"
2524

2625
"cdr.dev/slog"
@@ -42,6 +41,7 @@ import (
4241
"github.com/coder/coder/v2/codersdk/wsjson"
4342
"github.com/coder/coder/v2/tailnet"
4443
"github.com/coder/coder/v2/tailnet/proto"
44+
"github.com/coder/websocket"
4545
)
4646

4747
// @Summary Get workspace agent by ID
@@ -378,7 +378,7 @@ func (api *API) workspaceAgentLogs(rw http.ResponseWriter, r *http.Request) {
378378

379379
// Allow client to request no compression. This is useful for buggy
380380
// clients or if there's a client/server incompatibility. This is
381-
// needed with e.g. nhooyr/websocket and Safari (confirmed in 16.5).
381+
// needed with e.g. coder/websocket and Safari (confirmed in 16.5).
382382
//
383383
// See:
384384
// * https://github.com/nhooyr/websocket/issues/218

coderd/workspaceagents_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"github.com/stretchr/testify/require"
2121
"golang.org/x/xerrors"
2222
"google.golang.org/protobuf/types/known/timestamppb"
23-
"nhooyr.io/websocket"
2423
"tailscale.com/tailcfg"
2524

2625
"cdr.dev/slog"
@@ -50,6 +49,7 @@ import (
5049
"github.com/coder/coder/v2/tailnet/tailnettest"
5150
"github.com/coder/coder/v2/testutil"
5251
"github.com/coder/quartz"
52+
"github.com/coder/websocket"
5353
)
5454

5555
func TestWorkspaceAgent(t *testing.T) {

coderd/workspaceagentsrpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/google/uuid"
1515
"github.com/hashicorp/yamux"
1616
"golang.org/x/xerrors"
17-
"nhooyr.io/websocket"
1817

1918
"cdr.dev/slog"
2019
"github.com/coder/coder/v2/agent/proto"
@@ -30,6 +29,7 @@ import (
3029
"github.com/coder/coder/v2/codersdk"
3130
"github.com/coder/coder/v2/tailnet"
3231
tailnetproto "github.com/coder/coder/v2/tailnet/proto"
32+
"github.com/coder/websocket"
3333
)
3434

3535
// @Summary Workspace agent RPC API

coderd/workspaceagentsrpc_internal_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/coder/coder/v2/coderd/util/ptr"
12-
"github.com/coder/coder/v2/coderd/wspubsub"
13-
1411
"github.com/google/uuid"
1512
"github.com/stretchr/testify/require"
1613
"go.uber.org/mock/gomock"
17-
"nhooyr.io/websocket"
1814

1915
"github.com/coder/coder/v2/coderd/database"
2016
"github.com/coder/coder/v2/coderd/database/dbmock"
2117
"github.com/coder/coder/v2/coderd/database/dbtime"
18+
"github.com/coder/coder/v2/coderd/util/ptr"
19+
"github.com/coder/coder/v2/coderd/wspubsub"
2220
"github.com/coder/coder/v2/testutil"
21+
"github.com/coder/websocket"
2322
)
2423

2524
func TestAgentConnectionMonitor_ContextCancel(t *testing.T) {

coderd/workspaceapps/proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/go-jose/go-jose/v4/jwt"
1818
"github.com/google/uuid"
1919
"go.opentelemetry.io/otel/trace"
20-
"nhooyr.io/websocket"
2120

2221
"cdr.dev/slog"
2322
"github.com/coder/coder/v2/agent/agentssh"
@@ -32,6 +31,7 @@ import (
3231
"github.com/coder/coder/v2/codersdk"
3332
"github.com/coder/coder/v2/codersdk/workspacesdk"
3433
"github.com/coder/coder/v2/site"
34+
"github.com/coder/websocket"
3535
)
3636

3737
const (

codersdk/agentsdk/agentsdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/google/uuid"
1616
"github.com/hashicorp/yamux"
1717
"golang.org/x/xerrors"
18-
"nhooyr.io/websocket"
1918
"storj.io/drpc"
2019
"tailscale.com/tailcfg"
2120

@@ -25,6 +24,7 @@ import (
2524
"github.com/coder/coder/v2/codersdk"
2625
drpcsdk "github.com/coder/coder/v2/codersdk/drpc"
2726
tailnetproto "github.com/coder/coder/v2/tailnet/proto"
27+
"github.com/coder/websocket"
2828
)
2929

3030
// ExternalLogSourceID is the statically-defined ID of a log-source that

codersdk/provisionerdaemons.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import (
1515
"golang.org/x/exp/maps"
1616
"golang.org/x/exp/slices"
1717
"golang.org/x/xerrors"
18-
"nhooyr.io/websocket"
1918

2019
"github.com/coder/coder/v2/buildinfo"
2120
"github.com/coder/coder/v2/codersdk/drpc"
2221
"github.com/coder/coder/v2/codersdk/wsjson"
2322
"github.com/coder/coder/v2/provisionerd/proto"
2423
"github.com/coder/coder/v2/provisionerd/runner"
24+
"github.com/coder/websocket"
2525
)
2626

2727
type LogSource string

codersdk/websocket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"net"
66

7-
"nhooyr.io/websocket"
7+
"github.com/coder/websocket"
88
)
99

1010
// wsNetConn wraps net.Conn created by websocket.NetConn(). Cancel func

codersdk/websocket_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88

99
"github.com/stretchr/testify/assert"
1010
"github.com/stretchr/testify/require"
11-
"nhooyr.io/websocket"
1211

1312
"github.com/coder/coder/v2/codersdk"
1413
"github.com/coder/coder/v2/testutil"
14+
"github.com/coder/websocket"
1515
)
1616

1717
// TestWebsocketNetConn_LargeWrites tests that we can write large amounts of data thru the netconn

codersdk/workspaceagents.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import (
1212

1313
"github.com/google/uuid"
1414
"golang.org/x/xerrors"
15-
"nhooyr.io/websocket"
1615

1716
"github.com/coder/coder/v2/coderd/tracing"
1817
"github.com/coder/coder/v2/codersdk/wsjson"
18+
"github.com/coder/websocket"
1919
)
2020

2121
type WorkspaceAgentStatus string

codersdk/workspacesdk/dialer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99
"slices"
1010

1111
"golang.org/x/xerrors"
12-
"nhooyr.io/websocket"
1312

1413
"cdr.dev/slog"
1514
"github.com/coder/coder/v2/buildinfo"
1615
"github.com/coder/coder/v2/codersdk"
1716
"github.com/coder/coder/v2/tailnet"
1817
"github.com/coder/coder/v2/tailnet/proto"
18+
"github.com/coder/websocket"
1919
)
2020

2121
var permanentErrorStatuses = []int{

codersdk/workspacesdk/dialer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/stretchr/testify/assert"
1414
"github.com/stretchr/testify/require"
1515
"go.uber.org/mock/gomock"
16-
"nhooyr.io/websocket"
1716
"tailscale.com/tailcfg"
1817

1918
"cdr.dev/slog"
@@ -26,6 +25,7 @@ import (
2625
tailnetproto "github.com/coder/coder/v2/tailnet/proto"
2726
"github.com/coder/coder/v2/tailnet/tailnettest"
2827
"github.com/coder/coder/v2/testutil"
28+
"github.com/coder/websocket"
2929
)
3030

3131
func TestWebsocketDialer_TokenController(t *testing.T) {

codersdk/workspacesdk/workspacesdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
"github.com/google/uuid"
1616
"golang.org/x/xerrors"
17-
"nhooyr.io/websocket"
1817
"tailscale.com/tailcfg"
1918
"tailscale.com/wgengine/capture"
2019

@@ -23,6 +22,7 @@ import (
2322
"github.com/coder/coder/v2/tailnet"
2423
"github.com/coder/coder/v2/tailnet/proto"
2524
"github.com/coder/quartz"
25+
"github.com/coder/websocket"
2626
)
2727

2828
var ErrSkipClose = xerrors.New("skip tailnet close")

codersdk/wsjson/decoder.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import (
55
"encoding/json"
66
"sync/atomic"
77

8-
"nhooyr.io/websocket"
9-
108
"cdr.dev/slog"
9+
"github.com/coder/websocket"
1110
)
1211

1312
type Decoder[T any] struct {

codersdk/wsjson/encoder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import (
55
"encoding/json"
66

77
"golang.org/x/xerrors"
8-
"nhooyr.io/websocket"
8+
9+
"github.com/coder/websocket"
910
)
1011

1112
type Encoder[T any] struct {

docs/admin/templates/extending-templates/variables.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ for providing values to variables using the Coder CLI:
7474

7575
1. _Manual input in CLI_: You can manually input values for Terraform variables
7676
directly in the CLI during the deployment process.
77-
2. _Command-line argument_: Utilize the `--var name=value` command-line argument
77+
1. _Web UI_: You can set or edit variable values under **Variables** in the
78+
template's settings.
79+
1. _Command-line argument_: Utilize the `--var name=value` command-line argument
7880
to specify variable values inline as key-value pairs.
79-
3. _Variables file selection_: Alternatively, you can use a variables file
81+
1. _Variables file selection_: Alternatively, you can use a variables file
8082
selected via the `--variables-file values.yml` command-line argument. This
8183
approach is particularly useful when dealing with multiple variables or to
8284
avoid manual input of numerous values. Variables files can be versioned for

0 commit comments

Comments
 (0)