Skip to content

Commit 9521f25

Browse files
committed
Merge branch 'main' into mes/beta-badges
2 parents 5a7bbd3 + 37885e2 commit 9521f25

File tree

146 files changed

+5680
-387
lines changed

Some content is hidden

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

146 files changed

+5680
-387
lines changed

cli/cliui/agent.go

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type AgentOptions struct {
2525
Fetch func(ctx context.Context, agentID uuid.UUID) (codersdk.WorkspaceAgent, error)
2626
FetchLogs func(ctx context.Context, agentID uuid.UUID, after int64, follow bool) (<-chan []codersdk.WorkspaceAgentLog, io.Closer, error)
2727
Wait bool // If true, wait for the agent to be ready (startup script).
28+
DocsURL string
2829
}
2930

3031
// Agent displays a spinning indicator that waits for a workspace agent to connect.
@@ -119,7 +120,7 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO
119120
if agent.Status == codersdk.WorkspaceAgentTimeout {
120121
now := time.Now()
121122
sw.Log(now, codersdk.LogLevelInfo, "The workspace agent is having trouble connecting, wait for it to connect or restart your workspace.")
122-
sw.Log(now, codersdk.LogLevelInfo, troubleshootingMessage(agent, "https://coder.com/docs/templates#agent-connection-issues"))
123+
sw.Log(now, codersdk.LogLevelInfo, troubleshootingMessage(agent, fmt.Sprintf("%s/templates#agent-connection-issues", opts.DocsURL)))
123124
for agent.Status == codersdk.WorkspaceAgentTimeout {
124125
if agent, err = fetch(); err != nil {
125126
return xerrors.Errorf("fetch: %w", err)
@@ -224,13 +225,13 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO
224225
sw.Fail(stage, safeDuration(sw, agent.ReadyAt, agent.StartedAt))
225226
// Use zero time (omitted) to separate these from the startup logs.
226227
sw.Log(time.Time{}, codersdk.LogLevelWarn, "Warning: A startup script exited with an error and your workspace may be incomplete.")
227-
sw.Log(time.Time{}, codersdk.LogLevelWarn, troubleshootingMessage(agent, "https://coder.com/docs/templates/troubleshooting#startup-script-exited-with-an-error"))
228+
sw.Log(time.Time{}, codersdk.LogLevelWarn, troubleshootingMessage(agent, fmt.Sprintf("%s/templates#startup-script-exited-with-an-error", opts.DocsURL)))
228229
default:
229230
switch {
230231
case agent.LifecycleState.Starting():
231232
// Use zero time (omitted) to separate these from the startup logs.
232233
sw.Log(time.Time{}, codersdk.LogLevelWarn, "Notice: The startup scripts are still running and your workspace may be incomplete.")
233-
sw.Log(time.Time{}, codersdk.LogLevelWarn, troubleshootingMessage(agent, "https://coder.com/docs/templates/troubleshooting#your-workspace-may-be-incomplete"))
234+
sw.Log(time.Time{}, codersdk.LogLevelWarn, troubleshootingMessage(agent, fmt.Sprintf("%s/templates#your-workspace-may-be-incomplete", opts.DocsURL)))
234235
// Note: We don't complete or fail the stage here, it's
235236
// intentionally left open to indicate this stage didn't
236237
// complete.
@@ -252,7 +253,7 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO
252253
stage := "The workspace agent lost connection"
253254
sw.Start(stage)
254255
sw.Log(time.Now(), codersdk.LogLevelWarn, "Wait for it to reconnect or restart your workspace.")
255-
sw.Log(time.Now(), codersdk.LogLevelWarn, troubleshootingMessage(agent, "https://coder.com/docs/templates/troubleshooting#agent-connection-issues"))
256+
sw.Log(time.Now(), codersdk.LogLevelWarn, troubleshootingMessage(agent, fmt.Sprintf("%s/templates#agent-connection-issues", opts.DocsURL)))
256257

257258
disconnectedAt := agent.DisconnectedAt
258259
for agent.Status == codersdk.WorkspaceAgentDisconnected {
@@ -351,16 +352,16 @@ func PeerDiagnostics(w io.Writer, d tailnet.PeerDiagnostics) {
351352
}
352353

353354
type ConnDiags struct {
354-
ConnInfo workspacesdk.AgentConnectionInfo
355-
PingP2P bool
356-
DisableDirect bool
357-
LocalNetInfo *tailcfg.NetInfo
358-
LocalInterfaces *healthsdk.InterfacesReport
359-
AgentNetcheck *healthsdk.AgentNetcheckReport
360-
ClientIPIsAWS bool
361-
AgentIPIsAWS bool
362-
Verbose bool
363-
// TODO: More diagnostics
355+
ConnInfo workspacesdk.AgentConnectionInfo
356+
PingP2P bool
357+
DisableDirect bool
358+
LocalNetInfo *tailcfg.NetInfo
359+
LocalInterfaces *healthsdk.InterfacesReport
360+
AgentNetcheck *healthsdk.AgentNetcheckReport
361+
ClientIPIsAWS bool
362+
AgentIPIsAWS bool
363+
Verbose bool
364+
TroubleshootingURL string
364365
}
365366

366367
func (d ConnDiags) Write(w io.Writer) {
@@ -395,7 +396,7 @@ func (d ConnDiags) splitDiagnostics() (general, client, agent []string) {
395396
agent = append(agent, msg.Message)
396397
}
397398
if len(d.AgentNetcheck.Interfaces.Warnings) > 0 {
398-
agent[len(agent)-1] += "\nhttps://coder.com/docs/networking/troubleshooting#low-mtu"
399+
agent[len(agent)-1] += fmt.Sprintf("\n%s#low-mtu", d.TroubleshootingURL)
399400
}
400401
}
401402

@@ -404,7 +405,7 @@ func (d ConnDiags) splitDiagnostics() (general, client, agent []string) {
404405
client = append(client, msg.Message)
405406
}
406407
if len(d.LocalInterfaces.Warnings) > 0 {
407-
client[len(client)-1] += "\nhttps://coder.com/docs/networking/troubleshooting#low-mtu"
408+
client[len(client)-1] += fmt.Sprintf("\n%s#low-mtu", d.TroubleshootingURL)
408409
}
409410
}
410411

@@ -420,45 +421,45 @@ func (d ConnDiags) splitDiagnostics() (general, client, agent []string) {
420421
}
421422

422423
if d.ConnInfo.DisableDirectConnections {
423-
general = append(general, "❗ Your Coder administrator has blocked direct connections\n"+
424-
" https://coder.com/docs/networking/troubleshooting#disabled-deployment-wide")
424+
general = append(general,
425+
fmt.Sprintf("❗ Your Coder administrator has blocked direct connections\n %s#disabled-deployment-wide", d.TroubleshootingURL))
425426
if !d.Verbose {
426427
return general, client, agent
427428
}
428429
}
429430

430431
if !d.ConnInfo.DERPMap.HasSTUN() {
431-
general = append(general, "❗ The DERP map is not configured to use STUN\n"+
432-
" https://coder.com/docs/networking/troubleshooting#no-stun-servers")
432+
general = append(general,
433+
fmt.Sprintf("❗ The DERP map is not configured to use STUN\n %s#no-stun-servers", d.TroubleshootingURL))
433434
} else if d.LocalNetInfo != nil && !d.LocalNetInfo.UDP {
434-
client = append(client, "Client could not connect to STUN over UDP\n"+
435-
" https://coder.com/docs/networking/troubleshooting#udp-blocked")
435+
client = append(client,
436+
fmt.Sprintf("Client could not connect to STUN over UDP\n %s#udp-blocked", d.TroubleshootingURL))
436437
}
437438

438439
if d.LocalNetInfo != nil && d.LocalNetInfo.MappingVariesByDestIP.EqualBool(true) {
439-
client = append(client, "Client is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers\n"+
440-
" https://coder.com/docs/networking/troubleshooting#Endpoint-Dependent-Nat-Hard-NAT")
440+
client = append(client,
441+
fmt.Sprintf("Client is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers\n %s#endpoint-dependent-nat-hard-nat", d.TroubleshootingURL))
441442
}
442443

443444
if d.AgentNetcheck != nil && d.AgentNetcheck.NetInfo != nil {
444445
if d.AgentNetcheck.NetInfo.MappingVariesByDestIP.EqualBool(true) {
445-
agent = append(agent, "Agent is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers\n"+
446-
" https://coder.com/docs/networking/troubleshooting#Endpoint-Dependent-Nat-Hard-NAT")
446+
agent = append(agent,
447+
fmt.Sprintf("Agent is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers\n %s#endpoint-dependent-nat-hard-nat", d.TroubleshootingURL))
447448
}
448449
if !d.AgentNetcheck.NetInfo.UDP {
449-
agent = append(agent, "Agent could not connect to STUN over UDP\n"+
450-
" https://coder.com/docs/networking/troubleshooting#udp-blocked")
450+
agent = append(agent,
451+
fmt.Sprintf("Agent could not connect to STUN over UDP\n %s#udp-blocked", d.TroubleshootingURL))
451452
}
452453
}
453454

454455
if d.ClientIPIsAWS {
455-
client = append(client, "Client IP address is within an AWS range (AWS uses hard NAT)\n"+
456-
" https://coder.com/docs/networking/troubleshooting#Endpoint-Dependent-Nat-Hard-NAT")
456+
client = append(client,
457+
fmt.Sprintf("Client IP address is within an AWS range (AWS uses hard NAT)\n %s#endpoint-dependent-nat-hard-nat", d.TroubleshootingURL))
457458
}
458459

459460
if d.AgentIPIsAWS {
460-
agent = append(agent, "Agent IP address is within an AWS range (AWS uses hard NAT)\n"+
461-
" https://coder.com/docs/networking/troubleshooting#Endpoint-Dependent-Nat-Hard-NAT")
461+
agent = append(agent,
462+
fmt.Sprintf("Agent IP address is within an AWS range (AWS uses hard NAT)\n %s#endpoint-dependent-nat-hard-nat", d.TroubleshootingURL))
462463
}
463464
return general, client, agent
464465
}

cli/dotfiles.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (r *RootCmd) dotfiles() *serpent.Command {
203203
}
204204

205205
if fi.Mode()&0o111 == 0 {
206-
return xerrors.Errorf("script %q is not executable. See https://coder.com/docs/dotfiles for information on how to resolve the issue.", script)
206+
return xerrors.Errorf("script %q does not have execute permissions", script)
207207
}
208208

209209
// it is safe to use a variable command here because it's from

cli/open.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ const vscodeDesktopName = "VS Code Desktop"
3535

3636
func (r *RootCmd) openVSCode() *serpent.Command {
3737
var (
38-
generateToken bool
39-
testOpenError bool
38+
generateToken bool
39+
testOpenError bool
40+
appearanceConfig codersdk.AppearanceConfig
4041
)
4142

4243
client := new(codersdk.Client)
@@ -47,6 +48,7 @@ func (r *RootCmd) openVSCode() *serpent.Command {
4748
Middleware: serpent.Chain(
4849
serpent.RequireRangeArgs(1, 2),
4950
r.InitClient(client),
51+
initAppearance(client, &appearanceConfig),
5052
),
5153
Handler: func(inv *serpent.Invocation) error {
5254
ctx, cancel := context.WithCancel(inv.Context())
@@ -79,6 +81,7 @@ func (r *RootCmd) openVSCode() *serpent.Command {
7981
Fetch: client.WorkspaceAgent,
8082
FetchLogs: nil,
8183
Wait: false,
84+
DocsURL: appearanceConfig.DocsURL,
8285
})
8386
if err != nil {
8487
if xerrors.Is(err, context.Canceled) {

cli/organization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ func (r *RootCmd) organizations() *serpent.Command {
1818
Use: "organizations [subcommand]",
1919
Short: "Organization related commands",
2020
Aliases: []string{"organization", "org", "orgs"},
21-
Hidden: true, // Hidden until these commands are complete.
2221
Handler: func(inv *serpent.Invocation) error {
2322
return inv.Command.HelpHandler(inv)
2423
},
@@ -27,6 +26,7 @@ func (r *RootCmd) organizations() *serpent.Command {
2726
r.createOrganization(),
2827
r.organizationMembers(orgContext),
2928
r.organizationRoles(orgContext),
29+
r.organizationSettings(orgContext),
3030
},
3131
}
3232

cli/organizationmanage.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ func (r *RootCmd) createOrganization() *serpent.Command {
1818
cmd := &serpent.Command{
1919
Use: "create <organization name>",
2020
Short: "Create a new organization.",
21-
// This action is currently irreversible, so it's hidden until we have a way to delete organizations.
22-
Hidden: true,
2321
Middleware: serpent.Chain(
2422
r.InitClient(client),
2523
serpent.RequireNArgs(1),

cli/organizationroles.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ func (r *RootCmd) organizationRoles(orgContext *OrganizationContext) *serpent.Co
2424
Handler: func(inv *serpent.Invocation) error {
2525
return inv.Command.HelpHandler(inv)
2626
},
27-
Hidden: true,
2827
Children: []*serpent.Command{
2928
r.showOrganizationRoles(orgContext),
3029
r.editOrganizationRole(orgContext),

0 commit comments

Comments
 (0)