databricks-cli/cmd/root
shreyas-goenka 884b5f26ed
Set bundle auth configuration in command context (#2195)
## Changes

This change is required to enable tracking execution time telemetry for
bundle commands. In order to track execution time for the command
generally, we need to have the databricks auth configuration available
at this section of the code:


41bbd89257/cmd/root/root.go (L99)

In order to do this we can rely on the `configUsed` context key.   

Most commands rely on the `root.MustWorkspaceClient` function which
automatically sets the client config in the `configUsed` context key.
Bundle commands, however, do not do so. They instead store their
workspace clients in the `&bundle.Bundle{}` object.

With this PR, the `configUsed` context key will be set for all `bundle`
commands. Functionally nothing changes.

## Tests
Existing tests. Also manually verified that either
`root.MustConfigureBundle` or `utils.ConfigureBundleWithVariables` is
called for all bundle commands (except `bundle init`) thus ensuring this
context key would be set for all bundle commands.

refs for the functions:
1. `root.MustConfigureBundle`:
41bbd89257/cmd/root/bundle.go (L88)
2. `utils.ConfigureBundleWithVariables`:
41bbd89257/cmd/bundle/utils/utils.go (L19)

---------

Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
2025-01-29 11:02:08 +00:00
..
args.go Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
auth.go Set bundle auth configuration in command context (#2195) 2025-01-29 11:02:08 +00:00
auth_options.go Never load authentication configuration from bundle for sync command (#889) 2023-10-19 12:50:46 +00:00
auth_options_test.go Never load authentication configuration from bundle for sync command (#889) 2023-10-19 12:50:46 +00:00
auth_test.go Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
bundle.go Set bundle auth configuration in command context (#2195) 2025-01-29 11:02:08 +00:00
bundle_test.go Set bundle auth configuration in command context (#2195) 2025-01-29 11:02:08 +00:00
io.go Remove calls to `t.Setenv` from integration tests (#2018) 2024-12-16 12:34:37 +01:00
logger.go Enable errcheck everywhere and fix or silent remaining issues (#1987) 2024-12-11 13:26:00 +01:00
progress_logger.go Enable perfsprint linter and apply autofix (#2071) 2025-01-07 10:49:23 +00:00
progress_logger_test.go Add error checking in tests and enable errcheck there (#1980) 2024-12-09 13:56:41 +01:00
root.go Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
silent_err.go Improve `bundle validate` output (#1532) 2024-07-01 09:01:10 +00:00
user_agent.go Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
user_agent_command.go Move code for including command name in user agent (#203) 2023-02-15 10:33:35 +01:00
user_agent_command_exec_id.go Add `cmd-exec-id` to user agent (#1808) 2024-11-01 14:08:09 +00:00
user_agent_command_exec_id_test.go Add `cmd-exec-id` to user agent (#1808) 2024-11-01 14:08:09 +00:00
user_agent_command_test.go Add `cmd-exec-id` to user agent (#1808) 2024-11-01 14:08:09 +00:00
user_agent_upstream.go Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
user_agent_upstream_test.go Let caller set BRICKS_UPSTREAM for user agent (#196) 2023-02-03 17:05:58 +01:00