Skip to content

Commit a072b6c

Browse files
Unhide auth logout and add traceability comments (#4719)
## Changes - Add a traceability comment block at the top of `cmd/auth/logout.go` linking to the three original PRs (#4613, #4616, #4647). These PRs were inadvertently squashed into a single commit `cb3c326` titled after #4647 only. - The comment reflects the `--force` → `--auto-approve` rename from #4755. - Add a `NEXT_CHANGELOG.md` entry for `auth logout` under the CLI section. - Remove `Hidden: true` from the logout command so it appears in `databricks auth -h` and tab completion. - Improve the command's long description to: - Document that token cleanup only applies to profiles created by `databricks auth login` - Note that logging out of one profile does not affect others sharing the same cached token - Condense the numbered items (drop the redundant `--auto-approve` item since it's already mentioned in items 1 and 2; fold `--delete` into a single item) ## Why The `auth logout` feature was implemented across three stacked PRs (#4613, #4616, #4647) that were squashed into one commit on merge. The commit title only references the last PR ("Extract shared SelectProfile helper"), so `auth logout` itself has no changelog entry and no git-blame traceability. This followup restores that context, unhides the command for users, and adds the missing changelog entry. ## Tests No functional changes; existing unit and acceptance tests for `auth logout` continue to pass. --------- Co-authored-by: simon <simon.faltum@databricks.com>
1 parent c0801d4 commit a072b6c

2 files changed

Lines changed: 27 additions & 13 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
### CLI
88
* Auth commands now accept a profile name as a positional argument ([#4840](https://github.com/databricks/cli/pull/4840))
99

10+
* Add `auth logout` command for clearing cached OAuth tokens and optionally removing profiles ([#4613](https://github.com/databricks/cli/pull/4613), [#4616](https://github.com/databricks/cli/pull/4616), [#4647](https://github.com/databricks/cli/pull/4647))
11+
1012
### Bundles
1113
* Added support for lifecycle.started option for apps ([#4672](https://github.com/databricks/cli/pull/4672))
1214

cmd/auth/logout.go

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
// The auth logout command was implemented across three stacked PRs that were
2+
// inadvertently squashed into a single commit cb3c326 (titled after #4647 only):
3+
//
4+
// - #4613: core logout command with --profile, --auto-approve (originally --force),
5+
// --delete flags, token cache cleanup, and DeleteProfile in libs/databrickscfg/ops.go.
6+
// https://github.com/databricks/cli/pull/4613
7+
//
8+
// - #4616: interactive profile picker when --profile is
9+
// omitted in an interactive terminal.
10+
// https://github.com/databricks/cli/pull/4616
11+
//
12+
// - #4647: extract shared SelectProfile helper, deduplicate
13+
// profile pickers across auth logout, auth token, cmd/root/auth.go, cmd/root/bundle.go.
14+
// https://github.com/databricks/cli/pull/4647
15+
116
package auth
217

318
import (
@@ -29,24 +44,23 @@ You will need to run {{ "databricks auth login" | bold }} to re-authenticate.
2944

3045
func newLogoutCommand() *cobra.Command {
3146
cmd := &cobra.Command{
32-
Use: "logout [PROFILE]",
33-
Short: "Log out of a Databricks profile",
34-
Args: cobra.MaximumNArgs(1),
35-
Hidden: true,
47+
Use: "logout [PROFILE]",
48+
Short: "Log out of a Databricks profile",
49+
Args: cobra.MaximumNArgs(1),
3650
Long: `Log out of a Databricks profile.
3751
3852
This command clears any cached OAuth tokens for the specified profile so
3953
that the next CLI invocation requires re-authentication. The profile
4054
entry in ~/.databrickscfg is left intact unless --delete is also specified.
4155
56+
This only affects profiles created with "databricks auth login". Profiles
57+
using other authentication methods (personal access tokens, M2M credentials)
58+
do not store cached OAuth tokens. If multiple profiles share the same cached
59+
token, logging out of one does not affect the others.
60+
4261
You can provide a profile name as a positional argument, or use --profile
4362
to specify it explicitly.
4463
45-
This command requires a profile to be specified or an interactive terminal.
46-
If you omit the profile and run in an interactive terminal, you'll be shown
47-
a profile picker. In a non-interactive environment (e.g. CI/CD), omitting
48-
the profile is an error.
49-
5064
1. If you specify a profile (via argument or --profile), the command logs
5165
out of that profile. In an interactive terminal you'll be asked to
5266
confirm unless --auto-approve is set.
@@ -60,10 +74,8 @@ the profile is an error.
6074
pipeline), the command will fail with an error asking you to specify
6175
a profile.
6276
63-
4. Use --auto-approve to skip the confirmation prompt. This is required when
64-
running in non-interactive environments.
65-
66-
5. Use --delete to also remove the selected profile from ~/.databrickscfg.`,
77+
4. Use --delete to also remove the selected profile from the configuration
78+
file.`,
6779
}
6880

6981
var autoApprove bool

0 commit comments

Comments
 (0)