Skip to content

Commit

Permalink
improvement: update the get debug-info command
Browse files Browse the repository at this point in the history
* improvement: updated the get debug-info command

The old version of the command might include sensitive data in the output file.
This change introduces more explicit logging to show what's been extracted.
Changes the behaviour of the command when it comes to export data from the kubernetes cluster:
by default the command will only dump data from the garden-system and garden-system--metadata namespaces.
If the user uses the new flat --include-project, the command will dump the configuraition for the entire project as well

* fix: fixed copy for get debug-info command

* fix: improved (basic) debug info report

- added more logging in basic debug info flow
- updated glob to match debug-info-* folders
- systemInfo report format matches the one passed with --format
- added test for fixedExcludes

* fix: updated docs

* fix: improve exit on failed project config validation
  • Loading branch information
10ko authored and edvald committed Aug 5, 2019
1 parent 2a74068 commit 117efe3
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 69 deletions.
7 changes: 5 additions & 2 deletions docs/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,9 @@ Outputs the status of your environment for debug purposes.

Examples:

garden get debug-info # create a zip file at the root of the project with debug information
garden get debug-info --format yaml # output the provider info as yaml files (default as json)
garden get debug-info # create a zip file at the root of the project with debug information
garden get debug-info --format yaml # output provider info as YAML files (default is JSON)
garden get debug-info --include-project # include provider info for the project namespace (disabled by default)

##### Usage

Expand All @@ -360,6 +361,8 @@ garden get debug-info --format yaml # output the provider info as yaml files (d
| Argument | Alias | Type | Description |
| -------- | ----- | ---- | ----------- |
| `--format` | | `json` `yaml` | The output format for plugin-generated debug info.
| `--include-project` | | boolean | Include project-specific information from configured providers.
Note that this may include sensitive data, depending on the provider and your configuration.

### garden init

Expand Down
42 changes: 21 additions & 21 deletions garden-service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions garden-service/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ export class ActionHelper implements TypeGuard {
return { serviceStatuses, environmentStatuses }
}

async getDebugInfo({ log }: { log: LogEntry }): Promise<DebugInfoMap> {
async getDebugInfo({ log, includeProject }: { log: LogEntry, includeProject: boolean }): Promise<DebugInfoMap> {
const handlers = this.getActionHandlers("getDebugInfo")
return Bluebird.props(mapValues(handlers, async (h) => h({ ...await this.commonParams(h, log) })))
return Bluebird.props(mapValues(handlers, async (h) => h({ ...await this.commonParams(h, log), includeProject })))
}

//endregion
Expand Down
3 changes: 1 addition & 2 deletions garden-service/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,7 @@ export class GardenCli {
// Other exceptions are handled within the implementation of "get debug-info".
if (command.name === "debug-info") {
// Use default Garden dir name as fallback since Garden class hasn't been initialised
await generateBasicDebugInfoReport(root, join(root, DEFAULT_GARDEN_DIR_NAME), log)
return
await generateBasicDebugInfoReport(root, join(root, DEFAULT_GARDEN_DIR_NAME), log, parsedOpts.format)
}
throw err
}
Expand Down
Loading

0 comments on commit 117efe3

Please sign in to comment.