Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6f89120

Browse files
committed
Merge branch 'main' ofhttps://github.com/coder/coder into bq/migrate-mui-icons-10
2 parentsb2247da +55be304 commit6f89120

File tree

76 files changed

+4553
-413
lines changed

Some content is hidden

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

76 files changed

+4553
-413
lines changed

‎.devcontainer/scripts/post_create.sh‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ install_devcontainer_cli() {
1010

1111
install_ssh_config() {
1212
echo"🔑 Installing SSH configuration..."
13-
rsync -a /mnt/home/coder/.ssh/~/.ssh/
14-
chmod 0700~/.ssh
13+
if [-d /mnt/home/coder/.ssh ];then
14+
rsync -a /mnt/home/coder/.ssh/~/.ssh/
15+
chmod 0700~/.ssh
16+
else
17+
echo"⚠️ SSH directory not found."
18+
fi
1519
}
1620

1721
install_git_config() {

‎agent/agent_test.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,11 +1807,12 @@ func TestAgent_ReconnectingPTY(t *testing.T) {
18071807

18081808
//nolint:dogsled
18091809
conn,agentClient,_,_,_:=setupAgent(t, agentsdk.Manifest{},0)
1810+
idConnectionReport:=uuid.New()
18101811
id:=uuid.New()
18111812

18121813
// Test that the connection is reported. This must be tested in the
18131814
// first connection because we care about verifying all of these.
1814-
netConn0,err:=conn.ReconnectingPTY(ctx,id,80,80,"bash --norc")
1815+
netConn0,err:=conn.ReconnectingPTY(ctx,idConnectionReport,80,80,"bash --norc")
18151816
require.NoError(t,err)
18161817
_=netConn0.Close()
18171818
assertConnectionReport(t,agentClient,proto.Connection_RECONNECTING_PTY,0,"")

‎agent/reconnectingpty/screen.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
// screenReconnectingPTY provides a reconnectable PTY via `screen`.
2727
typescreenReconnectingPTYstruct {
28+
logger slog.Logger
2829
execer agentexec.Execer
2930
command*pty.Cmd
3031

@@ -62,6 +63,7 @@ type screenReconnectingPTY struct {
6263
// own which causes it to spawn with the specified size.
6364
funcnewScreen(ctx context.Context,logger slog.Logger,execer agentexec.Execer,cmd*pty.Cmd,options*Options)*screenReconnectingPTY {
6465
rpty:=&screenReconnectingPTY{
66+
logger:logger,
6567
execer:execer,
6668
command:cmd,
6769
metrics:options.Metrics,
@@ -173,6 +175,7 @@ func (rpty *screenReconnectingPTY) Attach(ctx context.Context, _ string, conn ne
173175

174176
ptty,process,err:=rpty.doAttach(ctx,conn,height,width,logger)
175177
iferr!=nil {
178+
logger.Debug(ctx,"unable to attach to screen reconnecting pty",slog.Error(err))
176179
iferrors.Is(err,context.Canceled) {
177180
// Likely the process was too short-lived and canceled the version command.
178181
// TODO: Is it worth distinguishing between that and a cancel from the
@@ -182,6 +185,7 @@ func (rpty *screenReconnectingPTY) Attach(ctx context.Context, _ string, conn ne
182185
}
183186
returnerr
184187
}
188+
logger.Debug(ctx,"attached to screen reconnecting pty")
185189

186190
deferfunc() {
187191
// Log only for debugging since the process might have already exited on its
@@ -403,6 +407,7 @@ func (rpty *screenReconnectingPTY) Wait() {
403407
}
404408

405409
func (rpty*screenReconnectingPTY)Close(errerror) {
410+
rpty.logger.Debug(context.Background(),"closing screen reconnecting pty",slog.Error(err))
406411
// The closing state change will be handled by the lifecycle.
407412
rpty.state.setState(StateClosing,err)
408413
}

‎biome.jsonc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"@mui/material/Popover":"Use components/Popover/Popover instead.",
5252
"@mui/material/Typography":"Use native HTML elements instead. Eg: <span>, <p>, <h1>, etc.",
5353
"@mui/material/Box":"Use a <div> instead.",
54+
"@mui/material/Button":"Use a components/Button/Button instead.",
5455
"@mui/material/styles":"Import from @emotion/react instead.",
5556
"lodash":"Use lodash/<name> instead."
5657
}

‎cli/exp_scaletest.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func (r *RootCmd) scaletestCmd() *serpent.Command {
6060
Children: []*serpent.Command{
6161
r.scaletestCleanup(),
6262
r.scaletestDashboard(),
63+
r.scaletestDynamicParameters(),
6364
r.scaletestCreateWorkspaces(),
6465
r.scaletestWorkspaceUpdates(),
6566
r.scaletestWorkspaceTraffic(),
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
//go:build !slim
2+
3+
package cli
4+
5+
import (
6+
"fmt"
7+
8+
"github.com/prometheus/client_golang/prometheus"
9+
"golang.org/x/xerrors"
10+
11+
"cdr.dev/slog"
12+
"cdr.dev/slog/sloggers/sloghuman"
13+
14+
"github.com/coder/coder/v2/scaletest/dynamicparameters"
15+
"github.com/coder/coder/v2/scaletest/harness"
16+
"github.com/coder/serpent"
17+
)
18+
19+
const (
20+
dynamicParametersTestName="dynamic-parameters"
21+
)
22+
23+
func (r*RootCmd)scaletestDynamicParameters()*serpent.Command {
24+
vartemplateNamestring
25+
varnumEvalsint64
26+
orgContext:=NewOrganizationContext()
27+
output:=&scaletestOutputFlags{}
28+
29+
cmd:=&serpent.Command{
30+
Use:"dynamic-parameters",
31+
Short:"Generates load on the Coder server evaluating dynamic parameters",
32+
Long:`It is recommended that all rate limits are disabled on the server before running this scaletest. This test generates many login events which will be rate limited against the (most likely single) IP.`,
33+
Handler:func(inv*serpent.Invocation)error {
34+
ctx:=inv.Context()
35+
36+
outputs,err:=output.parse()
37+
iferr!=nil {
38+
returnxerrors.Errorf("could not parse --output flags")
39+
}
40+
41+
client,err:=r.InitClient(inv)
42+
iferr!=nil {
43+
returnerr
44+
}
45+
iftemplateName=="" {
46+
returnxerrors.Errorf("template cannot be empty")
47+
}
48+
49+
org,err:=orgContext.Selected(inv,client)
50+
iferr!=nil {
51+
returnerr
52+
}
53+
54+
logger:=slog.Make(sloghuman.Sink(inv.Stdout)).Leveled(slog.LevelDebug)
55+
partitions,err:=dynamicparameters.SetupPartitions(ctx,client,org.ID,templateName,numEvals,logger)
56+
iferr!=nil {
57+
returnxerrors.Errorf("setup dynamic parameters partitions: %w",err)
58+
}
59+
60+
th:=harness.NewTestHarness(harness.ConcurrentExecutionStrategy{}, harness.ConcurrentExecutionStrategy{})
61+
reg:=prometheus.NewRegistry()
62+
metrics:=dynamicparameters.NewMetrics(reg,"concurrent_evaluations")
63+
64+
fori,part:=rangepartitions {
65+
forj:=rangepart.ConcurrentEvaluations {
66+
cfg:= dynamicparameters.Config{
67+
TemplateVersion:part.TemplateVersion.ID,
68+
Metrics:metrics,
69+
MetricLabelValues: []string{fmt.Sprintf("%d",part.ConcurrentEvaluations)},
70+
}
71+
runner:=dynamicparameters.NewRunner(client,cfg)
72+
th.AddRun(dynamicParametersTestName,fmt.Sprintf("%d/%d",j,i),runner)
73+
}
74+
}
75+
76+
err=th.Run(ctx)
77+
iferr!=nil {
78+
returnxerrors.Errorf("run test harness: %w",err)
79+
}
80+
81+
res:=th.Results()
82+
for_,o:=rangeoutputs {
83+
err=o.write(res,inv.Stdout)
84+
iferr!=nil {
85+
returnxerrors.Errorf("write output %q to %q: %w",o.format,o.path,err)
86+
}
87+
}
88+
89+
returnnil
90+
},
91+
}
92+
93+
cmd.Options= serpent.OptionSet{
94+
{
95+
Flag:"template",
96+
Description:"Name of the template to use. If it does not exist, it will be created.",
97+
Default:"scaletest-dynamic-parameters",
98+
Value:serpent.StringOf(&templateName),
99+
},
100+
{
101+
Flag:"concurrent-evaluations",
102+
Description:"Number of concurrent dynamic parameter evaluations to perform.",
103+
Default:"100",
104+
Value:serpent.Int64Of(&numEvals),
105+
},
106+
}
107+
orgContext.AttachOptions(cmd)
108+
output.attach(&cmd.Options)
109+
returncmd
110+
}

‎cli/exp_task_create.go‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@ func (r *RootCmd) taskCreate() *serpent.Command {
2929
cmd:=&serpent.Command{
3030
Use:"create [input]",
3131
Short:"Create an experimental task",
32+
Long:FormatExamples(
33+
Example{
34+
Description:"Create a task with direct input",
35+
Command:"coder exp task create\"Add authentication to the user service\"",
36+
},
37+
Example{
38+
Description:"Create a task with stdin input",
39+
Command:"echo\"Add authentication to the user service\" | coder exp task create",
40+
},
41+
Example{
42+
Description:"Create a task with a specific name",
43+
Command:"coder exp task create --name task1\"Add authentication to the user service\"",
44+
},
45+
Example{
46+
Description:"Create a task from a specific template / preset",
47+
Command:"coder exp task create --template backend-dev --preset\"My Preset\"\"Add authentication to the user service\"",
48+
},
49+
Example{
50+
Description:"Create a task for another user (requires appropriate permissions)",
51+
Command:"coder exp task create --owner user@example.com\"Add authentication to the user service\"",
52+
},
53+
),
3254
Middleware:serpent.Chain(
3355
serpent.RequireRangeArgs(0,1),
3456
),

‎cli/exp_task_delete.go‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ func (r *RootCmd) taskDelete() *serpent.Command {
1919
cmd:=&serpent.Command{
2020
Use:"delete <task> [<task> ...]",
2121
Short:"Delete experimental tasks",
22+
Long:FormatExamples(
23+
Example{
24+
Description:"Delete a single task.",
25+
Command:"$ coder exp task delete task1",
26+
},
27+
Example{
28+
Description:"Delete multiple tasks.",
29+
Command:"$ coder exp task delete task1 task2 task3",
30+
},
31+
Example{
32+
Description:"Delete a task without confirmation.",
33+
Command:"$ coder exp task delete task4 --yes",
34+
},
35+
),
2236
Middleware:serpent.Chain(
2337
serpent.RequireRangeArgs(1,-1),
2438
),

‎cli/exp_task_list.go‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,30 @@ func (r *RootCmd) taskList() *serpent.Command {
6767
)
6868

6969
cmd:=&serpent.Command{
70-
Use:"list",
71-
Short:"List experimental tasks",
70+
Use:"list",
71+
Short:"List experimental tasks",
72+
Long:FormatExamples(
73+
Example{
74+
Description:"List tasks for the current user.",
75+
Command:"coder exp task list",
76+
},
77+
Example{
78+
Description:"List tasks for a specific user.",
79+
Command:"coder exp task list --user someone-else",
80+
},
81+
Example{
82+
Description:"List all tasks you can view.",
83+
Command:"coder exp task list --all",
84+
},
85+
Example{
86+
Description:"List all your running tasks.",
87+
Command:"coder exp task list --status running",
88+
},
89+
Example{
90+
Description:"As above, but only show IDs.",
91+
Command:"coder exp task list --status running --quiet",
92+
},
93+
),
7294
Aliases: []string{"ls"},
7395
Middleware:serpent.Chain(
7496
serpent.RequireNArgs(0),

‎cli/exp_task_logs.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ func (r *RootCmd) taskLogs() *serpent.Command {
2626
cmd:=&serpent.Command{
2727
Use:"logs <task>",
2828
Short:"Show a task's logs",
29+
Long:FormatExamples(
30+
Example{
31+
Description:"Show logs for a given task.",
32+
Command:"coder exp task logs task1",
33+
}),
2934
Middleware:serpent.Chain(
3035
serpent.RequireNArgs(1),
3136
),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp