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

Commitba5f7c6

Browse files
committed
Merge branch 'main' of github.com:/coder/coder into dk/system-notifications-lib
2 parents337997d +e5268e4 commitba5f7c6

File tree

110 files changed

+2555
-3394
lines changed

Some content is hidden

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

110 files changed

+2555
-3394
lines changed

‎.github/workflows/release.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ jobs:
180180

181181
-name:Test migrations from current ref to main
182182
run:|
183-
make test-migrations
183+
POSTGRES_VERSION=13make test-migrations
184184
185185
# Setup GCloud for signing Windows binaries.
186186
-name:Authenticate to Google Cloud
@@ -297,7 +297,7 @@ jobs:
297297
298298
# build Docker images for each architecture
299299
version="$(./scripts/version.sh)"
300-
make-jbuild/coder_"$version"_linux_{amd64,arm64,armv7}.tag
300+
make build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
301301
302302
# we can't build multi-arch if the images aren't pushed, so quit now
303303
# if dry-running
@@ -308,7 +308,7 @@ jobs:
308308
309309
# build and push multi-arch manifest, this depends on the other images
310310
# being pushed so will automatically push them.
311-
make-jpush/build/coder_"$version"_linux.tag
311+
make push/build/coder_"$version"_linux.tag
312312
313313
# if the current version is equal to the highest (according to semver)
314314
# version in the repo, also create a multi-arch image as ":latest" and

‎Makefile‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ gen/mark-fresh:
518518
$(DB_GEN_FILES)\
519519
site/src/api/typesGenerated.ts\
520520
coderd/rbac/object_gen.go\
521+
codersdk/rbacresources_gen.go\
521522
docs/admin/prometheus.md\
522523
docs/cli.md\
523524
docs/admin/audit-logs.md\
@@ -616,10 +617,10 @@ site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/
616617
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go$(shell find ./examples/templates)
617618
go run ./scripts/examplegen/main.go> examples/examples.gen.json
618619

619-
coderd/rbac/object_gen.go: scripts/rbacgen/rbacobject.gotmpl scripts/rbacgen/main.go coderd/rbac/object.go
620+
coderd/rbac/object_gen.go: scripts/rbacgen/rbacobject.gotmpl scripts/rbacgen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
620621
go run scripts/rbacgen/main.go rbac> coderd/rbac/object_gen.go
621622

622-
codersdk/rbacresources_gen.go: scripts/rbacgen/codersdk.gotmpl scripts/rbacgen/main.go coderd/rbac/object.go
623+
codersdk/rbacresources_gen.go: scripts/rbacgen/codersdk.gotmpl scripts/rbacgen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
623624
go run scripts/rbacgen/main.go codersdk> codersdk/rbacresources_gen.go
624625

625626
docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics

‎agent/apphealth.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"golang.org/x/xerrors"
1111

1212
"cdr.dev/slog"
13-
"github.com/coder/coder/v2/clock"
1413
"github.com/coder/coder/v2/codersdk"
1514
"github.com/coder/coder/v2/codersdk/agentsdk"
15+
"github.com/coder/quartz"
1616
)
1717

1818
// PostWorkspaceAgentAppHealth updates the workspace app health.
@@ -23,7 +23,7 @@ type WorkspaceAppHealthReporter func(ctx context.Context)
2323

2424
// NewWorkspaceAppHealthReporter creates a WorkspaceAppHealthReporter that reports app health to coderd.
2525
funcNewWorkspaceAppHealthReporter(logger slog.Logger,apps []codersdk.WorkspaceApp,postWorkspaceAgentAppHealthPostWorkspaceAgentAppHealth)WorkspaceAppHealthReporter {
26-
returnNewAppHealthReporterWithClock(logger,apps,postWorkspaceAgentAppHealth,clock.NewReal())
26+
returnNewAppHealthReporterWithClock(logger,apps,postWorkspaceAgentAppHealth,quartz.NewReal())
2727
}
2828

2929
// NewAppHealthReporterWithClock is only called directly by test code. Product code should call
@@ -32,7 +32,7 @@ func NewAppHealthReporterWithClock(
3232
logger slog.Logger,
3333
apps []codersdk.WorkspaceApp,
3434
postWorkspaceAgentAppHealthPostWorkspaceAgentAppHealth,
35-
clkclock.Clock,
35+
clkquartz.Clock,
3636
)WorkspaceAppHealthReporter {
3737
logger=logger.Named("apphealth")
3838

‎agent/apphealth_test.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import (
1717
"github.com/coder/coder/v2/agent"
1818
"github.com/coder/coder/v2/agent/agenttest"
1919
"github.com/coder/coder/v2/agent/proto"
20-
"github.com/coder/coder/v2/clock"
2120
"github.com/coder/coder/v2/coderd/httpapi"
2221
"github.com/coder/coder/v2/codersdk"
2322
"github.com/coder/coder/v2/codersdk/agentsdk"
2423
"github.com/coder/coder/v2/testutil"
24+
"github.com/coder/quartz"
2525
)
2626

2727
funcTestAppHealth_Healthy(t*testing.T) {
@@ -69,7 +69,7 @@ func TestAppHealth_Healthy(t *testing.T) {
6969
httpapi.Write(r.Context(),w,http.StatusOK,nil)
7070
}),
7171
}
72-
mClock:=clock.NewMock(t)
72+
mClock:=quartz.NewMock(t)
7373
healthcheckTrap:=mClock.Trap().TickerFunc("healthcheck")
7474
deferhealthcheckTrap.Close()
7575
reportTrap:=mClock.Trap().TickerFunc("report")
@@ -137,7 +137,7 @@ func TestAppHealth_500(t *testing.T) {
137137
}),
138138
}
139139

140-
mClock:=clock.NewMock(t)
140+
mClock:=quartz.NewMock(t)
141141
healthcheckTrap:=mClock.Trap().TickerFunc("healthcheck")
142142
deferhealthcheckTrap.Close()
143143
reportTrap:=mClock.Trap().TickerFunc("report")
@@ -187,7 +187,7 @@ func TestAppHealth_Timeout(t *testing.T) {
187187
<-r.Context().Done()
188188
}),
189189
}
190-
mClock:=clock.NewMock(t)
190+
mClock:=quartz.NewMock(t)
191191
start:=mClock.Now()
192192

193193
// for this test, it's easier to think in the number of milliseconds elapsed
@@ -235,7 +235,7 @@ func setupAppReporter(
235235
ctx context.Context,t*testing.T,
236236
apps []codersdk.WorkspaceApp,
237237
handlers []http.Handler,
238-
clkclock.Clock,
238+
clkquartz.Clock,
239239
) (*agenttest.FakeAgentAPI,func()) {
240240
closers:= []func(){}
241241
for_,app:=rangeapps {

‎cli/list.go‎

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"strconv"
77
"time"
88

9+
"github.com/google/uuid"
910
"golang.org/x/xerrors"
1011

1112
"github.com/coder/coder/v2/cli/cliui"
@@ -22,19 +23,21 @@ type workspaceListRow struct {
2223
codersdk.Workspace`table:"-"`
2324

2425
// For table format:
25-
Favoritebool`json:"-" table:"favorite"`
26-
WorkspaceNamestring`json:"-" table:"workspace,default_sort"`
27-
Templatestring`json:"-" table:"template"`
28-
Statusstring`json:"-" table:"status"`
29-
Healthystring`json:"-" table:"healthy"`
30-
LastBuiltstring`json:"-" table:"last built"`
31-
CurrentVersionstring`json:"-" table:"current version"`
32-
Outdatedbool`json:"-" table:"outdated"`
33-
StartsAtstring`json:"-" table:"starts at"`
34-
StartsNextstring`json:"-" table:"starts next"`
35-
StopsAfterstring`json:"-" table:"stops after"`
36-
StopsNextstring`json:"-" table:"stops next"`
37-
DailyCoststring`json:"-" table:"daily cost"`
26+
Favoritebool`json:"-" table:"favorite"`
27+
WorkspaceNamestring`json:"-" table:"workspace,default_sort"`
28+
OrganizationID uuid.UUID`json:"-" table:"organization id"`
29+
OrganizationNamestring`json:"-" table:"organization name"`
30+
Templatestring`json:"-" table:"template"`
31+
Statusstring`json:"-" table:"status"`
32+
Healthystring`json:"-" table:"healthy"`
33+
LastBuiltstring`json:"-" table:"last built"`
34+
CurrentVersionstring`json:"-" table:"current version"`
35+
Outdatedbool`json:"-" table:"outdated"`
36+
StartsAtstring`json:"-" table:"starts at"`
37+
StartsNextstring`json:"-" table:"starts next"`
38+
StopsAfterstring`json:"-" table:"stops after"`
39+
StopsNextstring`json:"-" table:"stops next"`
40+
DailyCoststring`json:"-" table:"daily cost"`
3841
}
3942

4043
funcworkspaceListRowFromWorkspace(now time.Time,workspace codersdk.Workspace)workspaceListRow {
@@ -53,20 +56,22 @@ func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace)
5356
}
5457
workspaceName:=favIco+" "+workspace.OwnerName+"/"+workspace.Name
5558
returnworkspaceListRow{
56-
Favorite:workspace.Favorite,
57-
Workspace:workspace,
58-
WorkspaceName:workspaceName,
59-
Template:workspace.TemplateName,
60-
Status:status,
61-
Healthy:healthy,
62-
LastBuilt:durationDisplay(lastBuilt),
63-
CurrentVersion:workspace.LatestBuild.TemplateVersionName,
64-
Outdated:workspace.Outdated,
65-
StartsAt:schedRow.StartsAt,
66-
StartsNext:schedRow.StartsNext,
67-
StopsAfter:schedRow.StopsAfter,
68-
StopsNext:schedRow.StopsNext,
69-
DailyCost:strconv.Itoa(int(workspace.LatestBuild.DailyCost)),
59+
Favorite:workspace.Favorite,
60+
Workspace:workspace,
61+
WorkspaceName:workspaceName,
62+
OrganizationID:workspace.OrganizationID,
63+
OrganizationName:workspace.OrganizationName,
64+
Template:workspace.TemplateName,
65+
Status:status,
66+
Healthy:healthy,
67+
LastBuilt:durationDisplay(lastBuilt),
68+
CurrentVersion:workspace.LatestBuild.TemplateVersionName,
69+
Outdated:workspace.Outdated,
70+
StartsAt:schedRow.StartsAt,
71+
StartsNext:schedRow.StartsNext,
72+
StopsAfter:schedRow.StopsAfter,
73+
StopsNext:schedRow.StopsNext,
74+
DailyCost:strconv.Itoa(int(workspace.LatestBuild.DailyCost)),
7075
}
7176
}
7277

‎cli/ping.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ func (r *RootCmd) ping() *serpent.Command {
5858
_,_=fmt.Fprintln(inv.Stderr,"Direct connections disabled.")
5959
opts.BlockEndpoints=true
6060
}
61+
if!r.disableNetworkTelemetry {
62+
opts.EnableTelemetry=true
63+
}
6164
conn,err:=workspacesdk.New(client).DialAgent(ctx,workspaceAgent.ID,opts)
6265
iferr!=nil {
6366
returnerr

‎cli/portforward.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ func (r *RootCmd) portForward() *serpent.Command {
106106
_,_=fmt.Fprintln(inv.Stderr,"Direct connections disabled.")
107107
opts.BlockEndpoints=true
108108
}
109+
if!r.disableNetworkTelemetry {
110+
opts.EnableTelemetry=true
111+
}
109112
conn,err:=workspacesdk.New(client).DialAgent(ctx,workspaceAgent.ID,opts)
110113
iferr!=nil {
111114
returnerr

‎cli/root.go‎

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,20 @@ var (
5252
)
5353

5454
const (
55-
varURL="url"
56-
varToken="token"
57-
varAgentToken="agent-token"
58-
varAgentTokenFile="agent-token-file"
59-
varAgentURL="agent-url"
60-
varHeader="header"
61-
varHeaderCommand="header-command"
62-
varNoOpen="no-open"
63-
varNoVersionCheck="no-version-warning"
64-
varNoFeatureWarning="no-feature-warning"
65-
varForceTty="force-tty"
66-
varVerbose="verbose"
67-
varDisableDirect="disable-direct-connections"
55+
varURL="url"
56+
varToken="token"
57+
varAgentToken="agent-token"
58+
varAgentTokenFile="agent-token-file"
59+
varAgentURL="agent-url"
60+
varHeader="header"
61+
varHeaderCommand="header-command"
62+
varNoOpen="no-open"
63+
varNoVersionCheck="no-version-warning"
64+
varNoFeatureWarning="no-feature-warning"
65+
varForceTty="force-tty"
66+
varVerbose="verbose"
67+
varDisableDirect="disable-direct-connections"
68+
varDisableNetworkTelemetry="disable-network-telemetry"
6869

6970
notLoggedInMessage="You are not logged in. Try logging in using 'coder login <url>'."
7071

@@ -435,6 +436,13 @@ func (r *RootCmd) Command(subcommands []*serpent.Command) (*serpent.Command, err
435436
Value:serpent.BoolOf(&r.disableDirect),
436437
Group:globalGroup,
437438
},
439+
{
440+
Flag:varDisableNetworkTelemetry,
441+
Env:"CODER_DISABLE_NETWORK_TELEMETRY",
442+
Description:"Disable network telemetry. Network telemetry is collected when connecting to workspaces using the CLI, and is forwarded to the server. If telemetry is also enabled on the server, it may be sent to Coder. Network telemetry is used to measure network quality and detect regressions.",
443+
Value:serpent.BoolOf(&r.disableNetworkTelemetry),
444+
Group:globalGroup,
445+
},
438446
{
439447
Flag:"debug-http",
440448
Description:"Debug codersdk HTTP requests.",
@@ -481,8 +489,9 @@ type RootCmd struct {
481489
disableDirectbool
482490
debugHTTPbool
483491

484-
noVersionCheckbool
485-
noFeatureWarningbool
492+
disableNetworkTelemetrybool
493+
noVersionCheckbool
494+
noFeatureWarningbool
486495
}
487496

488497
// InitClient authenticates the client with files from disk

‎cli/speedtest.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ func (r *RootCmd) speedtest() *serpent.Command {
102102
_,_=fmt.Fprintln(inv.Stderr,"Direct connections disabled.")
103103
opts.BlockEndpoints=true
104104
}
105+
if!r.disableNetworkTelemetry {
106+
opts.EnableTelemetry=true
107+
}
105108
ifpcapFile!="" {
106109
s:=capture.New()
107110
opts.CaptureHook=s.LogPacket
@@ -183,6 +186,7 @@ func (r *RootCmd) speedtest() *serpent.Command {
183186
outputResult.Intervals[i]=interval
184187
}
185188
}
189+
conn.Conn.SendSpeedtestTelemetry(outputResult.Overall.ThroughputMbits)
186190
out,err:=formatter.Format(inv.Context(),outputResult)
187191
iferr!=nil {
188192
returnerr

‎cli/ssh.go‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ func (r *RootCmd) ssh() *serpent.Command {
243243
}
244244
conn,err:=workspacesdk.New(client).
245245
DialAgent(ctx,workspaceAgent.ID,&workspacesdk.DialAgentOptions{
246-
Logger:logger,
247-
BlockEndpoints:r.disableDirect,
246+
Logger:logger,
247+
BlockEndpoints:r.disableDirect,
248+
EnableTelemetry:!r.disableNetworkTelemetry,
248249
})
249250
iferr!=nil {
250251
returnxerrors.Errorf("dial agent: %w",err)
@@ -436,6 +437,7 @@ func (r *RootCmd) ssh() *serpent.Command {
436437
}
437438

438439
err=sshSession.Wait()
440+
conn.SendDisconnectedTelemetry("ssh")
439441
iferr!=nil {
440442
ifexitErr:= (&gossh.ExitError{});errors.As(err,&exitErr) {
441443
// Clear the error since it's not useful beyond

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp