Skip to content

Commit

Permalink
Print host in bundle validate when passed via profile or environmen…
Browse files Browse the repository at this point in the history
…t variables (#1378)

## Changes
Fixes to get host from the workspace client rather than only printing
the host when it's configured in the bundle config.

## Tests
Manually. When a profile was specified for auth.

Before:
```
➜  bundle-playground git:(master) ✗ cli bundle validate
Name: bundle-playground
Target: default
Workspace:
  Host: 
  User: shreyas.goenka@databricks.com
  Path: /Users/shreyas.goenka@databricks.com/.bundle/bundle-playground/default
```


After:
```
➜  bundle-playground git:(master) ✗ cli bundle validate
Name: bundle-playground
Target: default
Workspace:
  Host: https://e2-dogfood.staging.cloud.databricks.com
  User: shreyas.goenka@databricks.com
  Path: /Users/shreyas.goenka@databricks.com/.bundle/bundle-playground/default
```
  • Loading branch information
shreyas-goenka authored Apr 19, 2024
1 parent 6e59b13 commit 331313e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/bundle/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const warningTemplate = `{{ "Warning" | yellow }}: {{ .Summary }}
const summaryTemplate = `Name: {{ .Config.Bundle.Name | bold }}
Target: {{ .Config.Bundle.Target | bold }}
Workspace:
Host: {{ .Config.Workspace.Host | bold }}
Host: {{ .WorkspaceClient.Config.Host | bold }}
User: {{ .Config.Workspace.CurrentUser.UserName | bold }}
Path: {{ .Config.Workspace.RootPath | bold }}
Expand Down Expand Up @@ -107,8 +107,9 @@ func renderTextOutput(cmd *cobra.Command, b *bundle.Bundle, diags diag.Diagnosti
// Print validation summary.
t := template.Must(template.New("summary").Funcs(validateFuncMap).Parse(summaryTemplate))
err := t.Execute(cmd.OutOrStdout(), map[string]any{
"Config": b.Config,
"Trailer": buildTrailer(diags),
"Config": b.Config,
"Trailer": buildTrailer(diags),
"WorkspaceClient": b.WorkspaceClient(),
})
if err != nil {
return err
Expand Down

0 comments on commit 331313e

Please sign in to comment.