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

Commitc6180e9

Browse files
committed
Merge remote-tracking branch 'origin/main' into quotas-v3
2 parents75bd7b0 +fefacc5 commitc6180e9

File tree

18 files changed

+396
-124
lines changed

18 files changed

+396
-124
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name:Bug Report
2+
description:Report a bug encountered while using Coder.
3+
labels:bug
4+
body:
5+
-type:textarea
6+
id:problem
7+
attributes:
8+
label:What happened?
9+
description:|
10+
Please provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner.
11+
If this matter is security related, please disclose it privately via https://coder.com/security
12+
validations:
13+
required:true
14+
15+
-type:textarea
16+
id:expected
17+
attributes:
18+
label:What did you expect to happen?
19+
validations:
20+
required:true
21+
22+
# - type: textarea
23+
# id: repro
24+
# attributes:
25+
# label: How can we reproduce it (as minimally and precisely as possible)?
26+
#
27+
# - type: textarea
28+
# id: additional
29+
# attributes:
30+
# label: Anything else we need to know?
31+
#
32+
# - type: textarea
33+
# id: coderVersion
34+
# attributes:
35+
# label: Coder version
36+
# value: |
37+
# ```console
38+
# $ coder version
39+
# # paste output here
40+
# ```

‎.github/ISSUE_TEMPLATE/config.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled:true
2+
contact_links:
3+
-name:Contact Sales
4+
url:https://coder.com/demo
5+
about:Request a demo of Coder Enterprise.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name:Enhancement
2+
description:Provide supporting details to request development of a feature.
3+
labels:enhancement
4+
body:
5+
-type:textarea
6+
id:feature
7+
attributes:
8+
label:What would you like to be added?
9+
validations:
10+
required:true
11+
12+
-type:textarea
13+
id:rationale
14+
attributes:
15+
label:Why is this needed?

‎.github/ISSUE_TEMPLATE/external_bug_report.md‎

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name:Feedback
2+
description:Share your experience with us.
3+
labels:feedback
4+
body:
5+
-type:textarea
6+
id:feature
7+
attributes:
8+
label:What would you like share?
9+
validations:
10+
required:true

‎.github/workflows/packages.yaml‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name:Submit Packages
2+
on:
3+
release:
4+
types:[published]
5+
6+
env:
7+
CODER_VERSION:"${{ github.event.release.tag_name }}"
8+
9+
jobs:
10+
winget:
11+
runs-on:windows-latest
12+
steps:
13+
-name:Install wingetcreate
14+
run:|
15+
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
16+
17+
# the package version is the same as the release tag without the leading
18+
# "v", and with a trailing ".0" (e.g. "v1.2.3" -> "1.2.3.0")
19+
-name:Calculate package version
20+
id:version
21+
run:|
22+
$version = $env:CODER_VERSION -replace "^v", ""
23+
$version += ".0"
24+
echo "::set-output name=version::$version"
25+
26+
-name:Submit updated manifest to winget-pkgs
27+
run:|
28+
$release_assets = gh release view --repo coder/coder "$env:CODER_VERSION" --json assets | `
29+
ConvertFrom-Json
30+
31+
$installer_url = $release_assets.assets | `
32+
Where-Object name -Match ".*_windows_amd64_installer.exe$" | `
33+
Select -ExpandProperty url
34+
35+
echo "Installer URL: $installer_url"
36+
37+
# version should be extracted from the installer
38+
wingetcreate update Coder.Coder `
39+
--submit `
40+
--version "${{ steps.version.outputs.version }}" `
41+
--urls "$installer_url" `
42+
--token "${{ secrets.CDRCI_GITHUB_TOKEN }}"
43+
44+
-name:Comment on PR
45+
run:|
46+
# find the PR that wingetcreate just made
47+
$pr_list = gh pr list --repo microsoft/winget-pkgs --search "author:cdrci Coder.Coder version ${{ steps.version.outputs.version }}" --limit 1 --json number | `
48+
ConvertFrom-Json`
49+
$pr_number = $pr_list[0].number
50+
51+
gh pr comment --repo microsoft/winget-pkgs "$pr_number" --body "🤖 cc: @deansheather"

‎agent/agent.go‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func (a *agent) run(ctx context.Context) error {
174174
iferr!=nil {
175175
returnxerrors.Errorf("fetch metadata: %w",err)
176176
}
177-
a.logger.Info(context.Background(),"fetched metadata")
177+
a.logger.Info(ctx,"fetched metadata")
178178
oldMetadata:=a.metadata.Swap(metadata)
179179

180180
// The startup script should only execute on the first run!
@@ -208,7 +208,7 @@ func (a *agent) run(ctx context.Context) error {
208208
a.closeMutex.Lock()
209209
network:=a.network
210210
a.closeMutex.Unlock()
211-
ifa.network==nil {
211+
ifnetwork==nil {
212212
a.logger.Debug(ctx,"creating tailnet")
213213
network,err=a.createTailnet(ctx,metadata.DERPMap)
214214
iferr!=nil {
@@ -365,7 +365,7 @@ func (a *agent) runCoordinator(ctx context.Context, network *tailnet.Conn) error
365365
returnerr
366366
}
367367
defercoordinator.Close()
368-
a.logger.Info(context.Background(),"connected to coordination server")
368+
a.logger.Info(ctx,"connected to coordination server")
369369
sendNodes,errChan:=tailnet.ServeCoordinator(coordinator,network.UpdateNodes)
370370
network.SetNodeCallback(sendNodes)
371371
select {
@@ -561,25 +561,26 @@ func (a *agent) createCommand(ctx context.Context, rawCommand string, env []stri
561561
returnnil,xerrors.Errorf("metadata is the wrong type: %T",metadata)
562562
}
563563

564+
// OpenSSH executes all commands with the users current shell.
565+
// We replicate that behavior for IDE support.
566+
caller:="-c"
567+
ifruntime.GOOS=="windows" {
568+
caller="/c"
569+
}
570+
args:= []string{caller,rawCommand}
571+
564572
// gliderlabs/ssh returns a command slice of zero
565573
// when a shell is requested.
566-
command:=rawCommand
567-
iflen(command)==0 {
568-
command=shell
574+
iflen(rawCommand)==0 {
575+
args= []string{}
569576
ifruntime.GOOS!="windows" {
570577
// On Linux and macOS, we should start a login
571578
// shell to consume juicy environment variables!
572-
command+="-l"
579+
args=append(args,"-l")
573580
}
574581
}
575582

576-
// OpenSSH executes all commands with the users current shell.
577-
// We replicate that behavior for IDE support.
578-
caller:="-c"
579-
ifruntime.GOOS=="windows" {
580-
caller="/c"
581-
}
582-
cmd:=exec.CommandContext(ctx,shell,caller,command)
583+
cmd:=exec.CommandContext(ctx,shell,args...)
583584
cmd.Dir=metadata.Directory
584585
ifcmd.Dir=="" {
585586
// Default to $HOME if a directory is not set!

‎agent/usershell/usershell_windows.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import "os/exec"
44

55
// Get returns the command prompt binary name.
66
funcGet(usernamestring) (string,error) {
7-
_,err:=exec.LookPath("powershell.exe")
7+
_,err:=exec.LookPath("pwsh.exe")
8+
iferr==nil {
9+
return"pwsh.exe",nil
10+
}
11+
_,err=exec.LookPath("powershell.exe")
812
iferr==nil {
913
return"powershell.exe",nil
1014
}

‎cli/agent.go‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ func workspaceAgent() *cobra.Command {
3636
// This command isn't useful to manually execute.
3737
Hidden:true,
3838
RunE:func(cmd*cobra.Command,args []string)error {
39+
ctx,cancel:=context.WithCancel(cmd.Context())
40+
defercancel()
41+
3942
rawURL,err:=cmd.Flags().GetString(varAgentURL)
4043
iferr!=nil {
4144
returnxerrors.Errorf("CODER_AGENT_URL must be set: %w",err)
@@ -57,22 +60,22 @@ func workspaceAgent() *cobra.Command {
5760
// Spawn a reaper so that we don't accumulate a ton
5861
// of zombie processes.
5962
ifreaper.IsInitProcess()&&!noReap&&isLinux {
60-
logger.Info(cmd.Context(),"spawning reaper process")
63+
logger.Info(ctx,"spawning reaper process")
6164
// Do not start a reaper on the child process. It's important
6265
// to do this else we fork bomb ourselves.
6366
args:=append(os.Args,"--no-reap")
6467
err:=reaper.ForkReap(reaper.WithExecArgs(args...))
6568
iferr!=nil {
66-
logger.Error(cmd.Context(),"failed to reap",slog.Error(err))
69+
logger.Error(ctx,"failed to reap",slog.Error(err))
6770
returnxerrors.Errorf("fork reap: %w",err)
6871
}
6972

70-
logger.Info(cmd.Context(),"reaper process exiting")
73+
logger.Info(ctx,"reaper process exiting")
7174
returnnil
7275
}
7376

7477
version:=buildinfo.Version()
75-
logger.Info(cmd.Context(),"starting agent",
78+
logger.Info(ctx,"starting agent",
7679
slog.F("url",coderURL),
7780
slog.F("auth",auth),
7881
slog.F("version",version),
@@ -84,7 +87,7 @@ func workspaceAgent() *cobra.Command {
8487
// Enable pprof handler
8588
// This prevents the pprof import from being accidentally deleted.
8689
_=pprof.Handler
87-
pprofSrvClose:=serveHandler(cmd.Context(),logger,nil,pprofAddress,"pprof")
90+
pprofSrvClose:=serveHandler(ctx,logger,nil,pprofAddress,"pprof")
8891
deferpprofSrvClose()
8992

9093
// exchangeToken returns a session token.
@@ -102,7 +105,7 @@ func workspaceAgent() *cobra.Command {
102105
// This is *only* done for testing to mock client authentication.
103106
// This will never be set in a production scenario.
104107
vargcpClient*metadata.Client
105-
gcpClientRaw:=cmd.Context().Value("gcp-client")
108+
gcpClientRaw:=ctx.Value("gcp-client")
106109
ifgcpClientRaw!=nil {
107110
gcpClient,_=gcpClientRaw.(*metadata.Client)
108111
}
@@ -113,7 +116,7 @@ func workspaceAgent() *cobra.Command {
113116
// This is *only* done for testing to mock client authentication.
114117
// This will never be set in a production scenario.
115118
varawsClient*http.Client
116-
awsClientRaw:=cmd.Context().Value("aws-client")
119+
awsClientRaw:=ctx.Value("aws-client")
117120
ifawsClientRaw!=nil {
118121
awsClient,_=awsClientRaw.(*http.Client)
119122
ifawsClient!=nil {
@@ -127,7 +130,7 @@ func workspaceAgent() *cobra.Command {
127130
// This is *only* done for testing to mock client authentication.
128131
// This will never be set in a production scenario.
129132
varazureClient*http.Client
130-
azureClientRaw:=cmd.Context().Value("azure-client")
133+
azureClientRaw:=ctx.Value("azure-client")
131134
ifazureClientRaw!=nil {
132135
azureClient,_=azureClientRaw.(*http.Client)
133136
ifazureClient!=nil {
@@ -166,7 +169,7 @@ func workspaceAgent() *cobra.Command {
166169
"GIT_ASKPASS":executablePath,
167170
},
168171
})
169-
<-cmd.Context().Done()
172+
<-ctx.Done()
170173
returncloser.Close()
171174
},
172175
}

‎cli/cliui/table_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type tableTest3 struct {
5252
funcTest_DisplayTable(t*testing.T) {
5353
t.Parallel()
5454

55-
someTime:=time.Date(2022,8,2,15,49,10,0,time.Local)
55+
someTime:=time.Date(2022,8,2,15,49,10,0,time.UTC)
5656
in:= []tableTest1{
5757
{
5858
Name:"foo",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp