Skip to content

Commit d74457c

Browse files
committed
Merge branch 'main' into startuplogs
2 parents decde5c + de83723 commit d74457c

File tree

241 files changed

+9511
-4216
lines changed

Some content is hidden

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

241 files changed

+9511
-4216
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ jobs:
512512
- name: Install node_modules
513513
run: ./scripts/yarn_install.sh
514514

515-
- run: yarn test:ci
515+
- run: yarn test:ci --max-workers ${{ steps.cpu-cores.outputs.count }}
516516
working-directory: site
517517

518518
- uses: codecov/codecov-action@v3

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ site/test-results/*
2727
site/e2e/test-results/*
2828
site/e2e/states/*.json
2929
site/playwright-report/*
30+
site/.swc
3031

3132
# Make target for updating golden files.
3233
cli/testdata/.gen-golden
34+
helm/tests/testdata/.gen-golden
3335

3436
# Build
3537
/build/

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ site/test-results/*
3030
site/e2e/test-results/*
3131
site/e2e/states/*.json
3232
site/playwright-report/*
33+
site/.swc
3334

3435
# Make target for updating golden files.
3536
cli/testdata/.gen-golden
37+
helm/tests/testdata/.gen-golden
3638

3739
# Build
3840
/build/

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
"thead",
137137
"tios",
138138
"tmpdir",
139+
"tokenconfig",
139140
"tparallel",
140141
"trialer",
141142
"trimprefix",

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -516,13 +516,17 @@ coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS)
516516
./scripts/apidocgen/generate.sh
517517
yarn run --cwd=site format:write:only ../docs/api ../docs/manifest.json ../coderd/apidoc/swagger.json
518518

519-
update-golden-files: cli/testdata/.gen-golden
519+
update-golden-files: cli/testdata/.gen-golden helm/tests/testdata/.gen-golden
520520
.PHONY: update-golden-files
521521

522522
cli/testdata/.gen-golden: $(wildcard cli/testdata/*.golden) $(GO_SRC_FILES)
523523
go test ./cli -run=TestCommandHelp -update
524524
touch "$@"
525525

526+
helm/tests/testdata/.gen-golden: $(wildcard helm/tests/testdata/*.golden) $(GO_SRC_FILES)
527+
go test ./helm/tests -run=TestUpdateGoldenFiles -update
528+
touch "$@"
529+
526530
# Generate a prettierrc for the site package that uses relative paths for
527531
# overrides. This allows us to share the same prettier config between the
528532
# site and the root of the repo.

agent/agent.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ type Options struct {
7979
EnvironmentVariables map[string]string
8080
Logger slog.Logger
8181
AgentPorts map[int]string
82+
SSHMaxTimeout time.Duration
8283
}
8384

8485
type Client interface {
@@ -128,6 +129,7 @@ func New(options Options) io.Closer {
128129
lifecycleReported: make(chan codersdk.WorkspaceAgentLifecycle, 1),
129130
ignorePorts: options.AgentPorts,
130131
connStatsChan: make(chan *agentsdk.Stats, 1),
132+
sshMaxTimeout: options.SSHMaxTimeout,
131133
}
132134
a.init(ctx)
133135
return a
@@ -155,9 +157,10 @@ type agent struct {
155157

156158
envVars map[string]string
157159
// metadata is atomic because values can change after reconnection.
158-
metadata atomic.Value
159-
sessionToken atomic.Pointer[string]
160-
sshServer *ssh.Server
160+
metadata atomic.Value
161+
sessionToken atomic.Pointer[string]
162+
sshServer *ssh.Server
163+
sshMaxTimeout time.Duration
161164

162165
lifecycleUpdate chan struct{}
163166
lifecycleReported chan codersdk.WorkspaceAgentLifecycle
@@ -887,6 +890,7 @@ func (a *agent) init(ctx context.Context) {
887890
_ = session.Exit(1)
888891
},
889892
},
893+
MaxTimeout: a.sshMaxTimeout,
890894
}
891895

892896
go a.runLoop(ctx)

cli/agent.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ import (
3131

3232
func workspaceAgent() *cobra.Command {
3333
var (
34-
auth string
35-
logDir string
36-
pprofAddress string
37-
noReap bool
34+
auth string
35+
logDir string
36+
pprofAddress string
37+
noReap bool
38+
sshMaxTimeout time.Duration
3839
)
3940
cmd := &cobra.Command{
4041
Use: "agent",
@@ -211,7 +212,8 @@ func workspaceAgent() *cobra.Command {
211212
EnvironmentVariables: map[string]string{
212213
"GIT_ASKPASS": executablePath,
213214
},
214-
AgentPorts: agentPorts,
215+
AgentPorts: agentPorts,
216+
SSHMaxTimeout: sshMaxTimeout,
215217
})
216218
<-ctx.Done()
217219
return closer.Close()
@@ -222,6 +224,7 @@ func workspaceAgent() *cobra.Command {
222224
cliflag.StringVarP(cmd.Flags(), &logDir, "log-dir", "", "CODER_AGENT_LOG_DIR", os.TempDir(), "Specify the location for the agent log files")
223225
cliflag.StringVarP(cmd.Flags(), &pprofAddress, "pprof-address", "", "CODER_AGENT_PPROF_ADDRESS", "127.0.0.1:6060", "The address to serve pprof.")
224226
cliflag.BoolVarP(cmd.Flags(), &noReap, "no-reap", "", "", false, "Do not start a process reaper.")
227+
cliflag.DurationVarP(cmd.Flags(), &sshMaxTimeout, "ssh-max-timeout", "", "CODER_AGENT_SSH_MAX_TIMEOUT", time.Duration(0), "Specify the max timeout for a SSH connection")
225228
return cmd
226229
}
227230

cli/clibase/clibase.go

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// We will extend its usage to the rest of our application, completely replacing
66
// cobra/viper. It's also a candidate to be broken out into its own open-source
77
// library, so we avoid deep coupling with Coder concepts.
8+
//
9+
// The Command interface is loosely based on the chi middleware pattern and
10+
// http.Handler/HandlerFunc.
811
package clibase
912

1013
import (

0 commit comments

Comments
 (0)