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

Commitb568016

Browse files
committed
Merge branch 'main' into manualfix
2 parentsae47dda +d11d83c commitb568016

File tree

213 files changed

+4905
-2943
lines changed

Some content is hidden

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

213 files changed

+4905
-2943
lines changed

‎.github/workflows/coder.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ jobs:
489489
go mod download
490490
491491
version="$(./scripts/version.sh)"
492+
make gen/mark-fresh
492493
make -j \
493494
build/coder_"$version"_windows_amd64.zip \
494495
build/coder_"$version"_linux_amd64.{tar.gz,deb}

‎.github/workflows/dogfood.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
-name:Get branch name
2121
id:branch-name
22-
uses:tj-actions/branch-names@v5.4
22+
uses:tj-actions/branch-names@v6.1
2323

2424
-name:"Branch name to Docker tag name"
2525
id:docker-tag-name

‎.github/workflows/stale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
# v5.1.0 has a weird bug that makes stalebot add then remove its own label
1515
# https://github.com/actions/stale/pull/775
16-
-uses:actions/stale@v5.0.0
16+
-uses:actions/stale@v6.0.0
1717
with:
1818
stale-issue-label:stale
1919
stale-pr-label:stale

‎.github/workflows/welcome.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
jobs:
66
test:
77
runs-on:ubuntu-latest
8+
permissions:
9+
pull-requests:write
810
steps:
911
-uses:wow-actions/welcome@v1
1012
with:

‎.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ site/**/*.typegen.ts
3131
site/build-storybook.log
3232

3333
# Build
34-
build/
35-
dist/
34+
/build/
35+
/dist/
3636
site/out/
3737

3838
*.tfstate

‎Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ COPY --chown=coder:coder --chmod=700 empty-dir /home/coder
2525

2626
USER coder:coder
2727
ENV HOME=/home/coder
28+
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt
2829
WORKDIR /home/coder
2930

3031
ENTRYPOINT ["/opt/coder","server" ]

‎Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ build/coder_helm_$(VERSION).tgz:
329329
site/out/index.html:$(shell find ./site -not -path './site/node_modules/*' -type f -name '*.tsx')$(shell find ./site -not -path './site/node_modules/*' -type f -name '*.ts') site/package.json
330330
./scripts/yarn_install.sh
331331
cd site
332-
yarn typegen
333332
yarn build
334333

335334
install: build/coder_$(VERSION)_$(GOOS)_$(GOARCH)$(GOOS_BIN_EXT)

‎agent/agent.go

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333

3434
"cdr.dev/slog"
3535
"github.com/coder/coder/agent/usershell"
36+
"github.com/coder/coder/codersdk"
3637
"github.com/coder/coder/pty"
3738
"github.com/coder/coder/tailnet"
3839
"github.com/coder/retry"
@@ -49,55 +50,41 @@ const (
4950
MagicSessionErrorCode=229
5051
)
5152

52-
var (
53-
// tailnetIP is a static IPv6 address with the Tailscale prefix that is used to route
54-
// connections from clients to this node. A dynamic address is not required because a Tailnet
55-
// client only dials a single agent at a time.
56-
tailnetIP=netip.MustParseAddr("fd7a:115c:a1e0:49d6:b259:b7ac:b1b2:48f4")
57-
tailnetSSHPort=1
58-
tailnetReconnectingPTYPort=2
59-
tailnetSpeedtestPort=3
60-
)
61-
6253
typeOptionsstruct {
63-
CoordinatorDialerCoordinatorDialer
64-
FetchMetadataFetchMetadata
65-
66-
StatsReporterStatsReporter
67-
ReconnectingPTYTimeout time.Duration
68-
EnvironmentVariablesmap[string]string
69-
Logger slog.Logger
70-
}
71-
72-
typeMetadatastruct {
73-
DERPMap*tailcfg.DERPMap`json:"derpmap"`
74-
EnvironmentVariablesmap[string]string`json:"environment_variables"`
75-
StartupScriptstring`json:"startup_script"`
76-
Directorystring`json:"directory"`
54+
CoordinatorDialerCoordinatorDialer
55+
FetchMetadataFetchMetadata
56+
StatsReporterStatsReporter
57+
WorkspaceAgentAppsWorkspaceAgentApps
58+
PostWorkspaceAgentAppHealthPostWorkspaceAgentAppHealth
59+
ReconnectingPTYTimeout time.Duration
60+
EnvironmentVariablesmap[string]string
61+
Logger slog.Logger
7762
}
7863

7964
// CoordinatorDialer is a function that constructs a new broker.
8065
// A dialer must be passed in to allow for reconnects.
81-
typeCoordinatorDialerfunc(ctxcontext.Context) (net.Conn,error)
66+
typeCoordinatorDialerfunc(context.Context) (net.Conn,error)
8267

8368
// FetchMetadata is a function to obtain metadata for the agent.
84-
typeFetchMetadatafunc(ctxcontext.Context) (Metadata,error)
69+
typeFetchMetadatafunc(context.Context) (codersdk.WorkspaceAgentMetadata,error)
8570

8671
funcNew(optionsOptions) io.Closer {
8772
ifoptions.ReconnectingPTYTimeout==0 {
8873
options.ReconnectingPTYTimeout=5*time.Minute
8974
}
9075
ctx,cancelFunc:=context.WithCancel(context.Background())
9176
server:=&agent{
92-
reconnectingPTYTimeout:options.ReconnectingPTYTimeout,
93-
logger:options.Logger,
94-
closeCancel:cancelFunc,
95-
closed:make(chanstruct{}),
96-
envVars:options.EnvironmentVariables,
97-
coordinatorDialer:options.CoordinatorDialer,
98-
fetchMetadata:options.FetchMetadata,
99-
stats:&Stats{},
100-
statsReporter:options.StatsReporter,
77+
reconnectingPTYTimeout:options.ReconnectingPTYTimeout,
78+
logger:options.Logger,
79+
closeCancel:cancelFunc,
80+
closed:make(chanstruct{}),
81+
envVars:options.EnvironmentVariables,
82+
coordinatorDialer:options.CoordinatorDialer,
83+
fetchMetadata:options.FetchMetadata,
84+
stats:&Stats{},
85+
statsReporter:options.StatsReporter,
86+
workspaceAgentApps:options.WorkspaceAgentApps,
87+
postWorkspaceAgentAppHealth:options.PostWorkspaceAgentAppHealth,
10188
}
10289
server.init(ctx)
10390
returnserver
@@ -120,14 +107,16 @@ type agent struct {
120107
fetchMetadataFetchMetadata
121108
sshServer*ssh.Server
122109

123-
network*tailnet.Conn
124-
coordinatorDialerCoordinatorDialer
125-
stats*Stats
126-
statsReporterStatsReporter
110+
network*tailnet.Conn
111+
coordinatorDialerCoordinatorDialer
112+
stats*Stats
113+
statsReporterStatsReporter
114+
workspaceAgentAppsWorkspaceAgentApps
115+
postWorkspaceAgentAppHealthPostWorkspaceAgentAppHealth
127116
}
128117

129118
func (a*agent)run(ctx context.Context) {
130-
varmetadataMetadata
119+
varmetadatacodersdk.WorkspaceAgentMetadata
131120
varerrerror
132121
// An exponential back-off occurs when the connection is failing to dial.
133122
// This is to prevent server spam in case of a coderd outage.
@@ -168,6 +157,10 @@ func (a *agent) run(ctx context.Context) {
168157
ifmetadata.DERPMap!=nil {
169158
goa.runTailnet(ctx,metadata.DERPMap)
170159
}
160+
161+
ifa.workspaceAgentApps!=nil&&a.postWorkspaceAgentAppHealth!=nil {
162+
goNewWorkspaceAppHealthReporter(a.logger,a.workspaceAgentApps,a.postWorkspaceAgentAppHealth)(ctx)
163+
}
171164
}
172165

173166
func (a*agent)runTailnet(ctx context.Context,derpMap*tailcfg.DERPMap) {
@@ -182,7 +175,7 @@ func (a *agent) runTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) {
182175
}
183176
varerrerror
184177
a.network,err=tailnet.NewConn(&tailnet.Options{
185-
Addresses: []netip.Prefix{netip.PrefixFrom(tailnetIP,128)},
178+
Addresses: []netip.Prefix{netip.PrefixFrom(codersdk.TailnetIP,128)},
186179
DERPMap:derpMap,
187180
Logger:a.logger.Named("tailnet"),
188181
})
@@ -199,7 +192,7 @@ func (a *agent) runTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) {
199192
})
200193
goa.runCoordinator(ctx)
201194

202-
sshListener,err:=a.network.Listen("tcp",":"+strconv.Itoa(tailnetSSHPort))
195+
sshListener,err:=a.network.Listen("tcp",":"+strconv.Itoa(codersdk.TailnetSSHPort))
203196
iferr!=nil {
204197
a.logger.Critical(ctx,"listen for ssh",slog.Error(err))
205198
return
@@ -213,7 +206,7 @@ func (a *agent) runTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) {
213206
goa.sshServer.HandleConn(a.stats.wrapConn(conn))
214207
}
215208
}()
216-
reconnectingPTYListener,err:=a.network.Listen("tcp",":"+strconv.Itoa(tailnetReconnectingPTYPort))
209+
reconnectingPTYListener,err:=a.network.Listen("tcp",":"+strconv.Itoa(codersdk.TailnetReconnectingPTYPort))
217210
iferr!=nil {
218211
a.logger.Critical(ctx,"listen for reconnecting pty",slog.Error(err))
219212
return
@@ -239,15 +232,15 @@ func (a *agent) runTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) {
239232
iferr!=nil {
240233
continue
241234
}
242-
varmsgreconnectingPTYInit
235+
varmsgcodersdk.ReconnectingPTYInit
243236
err=json.Unmarshal(data,&msg)
244237
iferr!=nil {
245238
continue
246239
}
247240
goa.handleReconnectingPTY(ctx,msg,conn)
248241
}
249242
}()
250-
speedtestListener,err:=a.network.Listen("tcp",":"+strconv.Itoa(tailnetSpeedtestPort))
243+
speedtestListener,err:=a.network.Listen("tcp",":"+strconv.Itoa(codersdk.TailnetSpeedtestPort))
251244
iferr!=nil {
252245
a.logger.Critical(ctx,"listen for speedtest",slog.Error(err))
253246
return
@@ -443,7 +436,7 @@ func (a *agent) init(ctx context.Context) {
443436

444437
goa.run(ctx)
445438
ifa.statsReporter!=nil {
446-
cl,err:=a.statsReporter(ctx,a.logger,func()*Stats {
439+
cl,err:=a.statsReporter(ctx,a.logger,func()*codersdk.AgentStats {
447440
returna.stats.Copy()
448441
})
449442
iferr!=nil {
@@ -478,7 +471,7 @@ func (a *agent) createCommand(ctx context.Context, rawCommand string, env []stri
478471
ifrawMetadata==nil {
479472
returnnil,xerrors.Errorf("no metadata was provided: %w",err)
480473
}
481-
metadata,valid:=rawMetadata.(Metadata)
474+
metadata,valid:=rawMetadata.(codersdk.WorkspaceAgentMetadata)
482475
if!valid {
483476
returnnil,xerrors.Errorf("metadata is the wrong type: %T",metadata)
484477
}
@@ -634,7 +627,7 @@ func (a *agent) handleSSHSession(session ssh.Session) (retErr error) {
634627
returncmd.Wait()
635628
}
636629

637-
func (a*agent)handleReconnectingPTY(ctx context.Context,msgreconnectingPTYInit,conn net.Conn) {
630+
func (a*agent)handleReconnectingPTY(ctx context.Context,msgcodersdk.ReconnectingPTYInit,conn net.Conn) {
638631
deferconn.Close()
639632

640633
varrpty*reconnectingPTY
@@ -775,7 +768,7 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, msg reconnectingPTYIn
775768
rpty.activeConnsMutex.Unlock()
776769
}()
777770
decoder:=json.NewDecoder(conn)
778-
varreqReconnectingPTYRequest
771+
varreqcodersdk.ReconnectingPTYRequest
779772
for {
780773
err=decoder.Decode(&req)
781774
ifxerrors.Is(err,io.EOF) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp