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

Commit01f9a9a

Browse files
authored
feat(cli): unhide support bundle cmd (#12745)
* chore(cli): add another test to ensure no secret leakage* feat(cli): unhide support bundle cmd
1 parent2332d81 commit01f9a9a

File tree

9 files changed

+134
-6
lines changed

9 files changed

+134
-6
lines changed

‎cli/support.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ func (r *RootCmd) support() *serpent.Command {
3030
Handler:func(inv*serpent.Invocation)error {
3131
returninv.Command.HelpHandler(inv)
3232
},
33-
Hidden:true,// TODO: un-hide once the must-haves from #12160 are completed.
3433
Children: []*serpent.Command{
3534
r.supportBundle(),
3635
},
@@ -40,7 +39,7 @@ func (r *RootCmd) support() *serpent.Command {
4039

4140
varsupportBundleBlurb=cliui.Bold("This will collect the following information:\n")+
4241
` - Coder deployment version
43-
- Coder deployment Configuration (sanitized), including enabled experiments
42+
- Coder deployment Configuration (sanitized), including enabled experiments
4443
- Coder deployment health snapshot
4544
- Coder deployment Network troubleshooting information
4645
- Workspace configuration, parameters, and build logs

‎cli/support_test.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@ func TestSupportBundle(t *testing.T) {
3939
t.Run("Workspace",func(t*testing.T) {
4040
t.Parallel()
4141
ctx:=testutil.Context(t,testutil.WaitShort)
42-
client,db:=coderdtest.NewWithDatabase(t,nil)
42+
vardc codersdk.DeploymentConfig
43+
secretValue:=uuid.NewString()
44+
seedSecretDeploymentOptions(t,&dc,secretValue)
45+
client,db:=coderdtest.NewWithDatabase(t,&coderdtest.Options{
46+
DeploymentValues:dc.Values,
47+
})
4348
owner:=coderdtest.CreateFirstUser(t,client)
44-
randSecretValue:=uuid.NewString()
4549
r:=dbfake.WorkspaceBuild(t,db, database.Workspace{
4650
OrganizationID:owner.OrganizationID,
4751
OwnerID:owner.UserID,
4852
}).WithAgent(func(agents []*proto.Agent) []*proto.Agent {
4953
// This should not show up in the bundle output
50-
agents[0].Env["SECRET_VALUE"]=randSecretValue
54+
agents[0].Env["SECRET_VALUE"]=secretValue
5155
returnagents
5256
}).Do()
5357
ws,err:=client.Workspace(ctx,r.Workspace.ID)
@@ -89,7 +93,7 @@ func TestSupportBundle(t *testing.T) {
8993
clitest.SetupConfig(t,client,root)
9094
err=inv.Run()
9195
require.NoError(t,err)
92-
assertBundleContents(t,path,randSecretValue)
96+
assertBundleContents(t,path,secretValue)
9397
})
9498

9599
t.Run("NoWorkspace",func(t*testing.T) {
@@ -263,3 +267,15 @@ func assertDoesNotContain(t *testing.T, f *zip.File, vals ...string) {
263267
}
264268
}
265269
}
270+
271+
funcseedSecretDeploymentOptions(t*testing.T,dc*codersdk.DeploymentConfig,secretValuestring) {
272+
t.Helper()
273+
ifdc==nil {
274+
dc=&codersdk.DeploymentConfig{}
275+
}
276+
for_,opt:=rangedc.Options {
277+
ifcodersdk.IsSecretDeploymentOption(opt) {
278+
opt.Value.Set(secretValue)
279+
}
280+
}
281+
}

‎cli/testdata/coder_--help.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ SUBCOMMANDS:
4646
stat Show resource usage for the current workspace.
4747
state Manually manage Terraform state to fix broken workspaces
4848
stop Stop a workspace
49+
support Commands for troubleshooting issues with a Coder
50+
deployment.
4951
templates Manage templates
5052
tokens Manage personal access tokens
5153
unfavorite Remove a workspace from your favorites
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
coder v0.0.0-devel
2+
3+
USAGE:
4+
coder support
5+
6+
Commands for troubleshooting issues with a Coder deployment.
7+
8+
SUBCOMMANDS:
9+
bundle Generate a support bundle to troubleshoot issues connecting to a
10+
workspace.
11+
12+
———
13+
Run `coder --help` for a list of global options.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
coder v0.0.0-devel
2+
3+
USAGE:
4+
coder support bundle [flags] <workspace> [<agent>]
5+
6+
Generate a support bundle to troubleshoot issues connecting to a workspace.
7+
8+
This command generates a file containing detailed troubleshooting information
9+
about the Coder deployment and workspace connections. You must specify a
10+
single workspace (and optionally an agent name).
11+
12+
OPTIONS:
13+
-O, --output-file string, $CODER_SUPPORT_BUNDLE_OUTPUT_FILE
14+
File path for writing the generated support bundle. Defaults to
15+
coder-support-$(date +%s).zip.
16+
17+
--url-override string, $CODER_SUPPORT_BUNDLE_URL_OVERRIDE
18+
Override the URL to your Coder deployment. This may be useful, for
19+
example, if you need to troubleshoot a specific Coder replica.
20+
21+
-y, --yes bool
22+
Bypass prompts.
23+
24+
———
25+
Run `coder --help` for a list of global options.

‎docs/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Coder — A tool for provisioning self-hosted development environments with Terr
5757
|[<code>stop</code>](./cli/stop.md)| Stop a workspace|
5858
|[<code>unfavorite</code>](./cli/unfavorite.md)| Remove a workspace from your favorites|
5959
|[<code>update</code>](./cli/update.md)| Will update and start a given workspace if it is out of date|
60+
|[<code>support</code>](./cli/support.md)| Commands for troubleshooting issues with a Coder deployment.|
6061
|[<code>server</code>](./cli/server.md)| Start a Coder server|
6162
|[<code>features</code>](./cli/features.md)| List Enterprise features|
6263
|[<code>licenses</code>](./cli/licenses.md)| Add, delete, and list licenses|

‎docs/cli/support.md

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎docs/cli/support_bundle.md

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎docs/manifest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,16 @@
900900
"description":"Stop a workspace",
901901
"path":"cli/stop.md"
902902
},
903+
{
904+
"title":"support",
905+
"description":"Commands for troubleshooting issues with a Coder deployment.",
906+
"path":"cli/support.md"
907+
},
908+
{
909+
"title":"support bundle",
910+
"description":"Generate a support bundle to troubleshoot issues connecting to a workspace.",
911+
"path":"cli/support_bundle.md"
912+
},
903913
{
904914
"title":"templates",
905915
"description":"Manage templates",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp