Skip to content

bundle: surface read-only DMS commands under DAB sub-groups#5313

Merged
shreyas-goenka merged 6 commits into
mainfrom
shreyas-goenka/bundle-dms-read-only
May 26, 2026
Merged

bundle: surface read-only DMS commands under DAB sub-groups#5313
shreyas-goenka merged 6 commits into
mainfrom
shreyas-goenka/bundle-dms-read-only

Conversation

@shreyas-goenka
Copy link
Copy Markdown
Contributor

@shreyas-goenka shreyas-goenka commented May 22, 2026

Stacked on #5311 (the SDK v0.136 bump). Retarget to main once that lands.

Why

SDK v0.135 added a workspace-level bundle service (DMS). Its auto-generated CLI commands sit at the root databricks bundle <verb> and collide with the DAB bundle command tree, so PR #5311 filters them out of top-level registration. This PR brings the read-side commands back, grouped under the existing DAB bundle namespace.

Layout

| Group | Commands |
|---|---|---|
| bundle deployment | get, list -- additive next to existing bind, unbind, migrate |
| bundle version | get, list |
| bundle resource | get, list |
| bundle operation | get, list |

Mutating verbs are intentionally out of scope (create / delete / complete / heartbeat). They have no user-facing workflow yet; we'll add them when the DMS write-path becomes a documented feature. Until then they remain in the filtered-out cmd/workspace/bundle tree.

Wiring

The DAB deployment group is additive -- the new get/list verbs join the existing bind/unbind/migrate under one parent. The other three groups are brand new.

Implementation lives in cmd/bundle/metadata_service.go:

  • metadataServiceCommands() calls workspacebundle.New() once, detaches every subcommand from the discarded workspace root, and returns them in a map keyed by their original cobra Name (e.g. \"get-deployment\").
  • renameTo(c, newName) rewrites the first whitespace-separated token of cobra's Use field while preserving the trailing positional-arg syntax. So \"get-deployment NAME\" becomes \"get NAME\" and cobra still renders the usage string correctly.

cmd/bundle/bundle.go pulls only the four read-side entries (get-deployment, list-deployments, get-version, list-versions, get-resource, list-resources, get-operation, list-operations) out of the map and attaches them to the right parent. The workspace bundle filter in cmd/cmd.go stays in place, so the mutating verbs do not leak to the root.

Test plan

  • go build ./...
  • go test ./cmd/... ./bundle/... (all green)
  • go vet ./... clean
  • Manual: databricks bundle {deployment,version,resource,operation} --help show the expected commands + alias pair
  • databricks bundle deployments get --help (plural alias) routes correctly
  • databricks bundle debug refschema --help unaffected
  • CI on this PR

Base automatically changed from shreyas-goenka/bump-sdk-v0.136.0 to main May 22, 2026 11:21
The SDK v0.135 added a workspace-level `bundle` (Deployment Metadata
Service) whose auto-generated cobra commands live at
cmd/workspace/bundle/. The previous PR (#5311) filters that workspace
root out of top-level registration because `bundle` collides with the
DAB command tree. This commit brings the read-side verbs back, grouped
under the noun parents under `databricks bundle`:

  databricks bundle deployment {get, list}
  databricks bundle version    {get, list}
  databricks bundle resource   {get, list}
  databricks bundle operation  {get, list}

Aliases (`deployments`, `versions`, `resources`, `operations`) are
attached on each group so cobra renders the noun/nouns pair in the help
header and either form routes the same way.

Mutating verbs (create-deployment, create-version, create-operation,
delete-deployment, complete-version, heartbeat) are intentionally not
surfaced -- they have no user-facing workflow yet and stay in the
filtered-out workspace tree.

The `deployment` group is additive: the new read-side verbs sit
alongside the existing `bind`, `unbind`, `migrate` from
cmd/bundle/deployment/. Help output renders both sets together with the
alias header on top.

Implementation lives in cmd/bundle/metadata_service.go: a small helper
calls `workspacebundle.New()` once, detaches each subcommand from the
(discarded) workspace root, and exposes them via a map keyed by their
original cobra Name. cmd/bundle/bundle.go pulls only the four read-side
entries from the map and renames each from `<verb>-<noun>` to `<verb>`
via `renameTo`, which preserves the trailing positional-arg syntax that
cobra renders in usage strings.

Co-authored-by: Isaac
@shreyas-goenka shreyas-goenka force-pushed the shreyas-goenka/bundle-dms-read-only branch from a79fd4a to 96e0aad Compare May 22, 2026 11:28
The previous commit adds `operation`, `resource`, `version` as new
top-level rows in `databricks bundle --help`, and `get`/`list` as new
verbs under `bundle deployment`. Update the two `bundle/help` golden
outputs to match (test was passing under -update; verified with a
re-run without -update).

Co-authored-by: Isaac
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

eng-dev-ecosystem-bot commented May 22, 2026

Commit: f063e2b

Run: 26442535232

Removes the `deployments`/`versions`/`resources`/`operations` plural
aliases from the four sub-groups. Cobra still routes the singular form
(matching the SDK / API convention); we can revisit aliasing once the
read-only surface lands and we see what users prefer.

`bundle-deployment` help golden refreshed -- the `Aliases:` header in
the help output is what changes.

Co-authored-by: Isaac
Eight stubbed REST endpoints and one consolidated script exercise the
new `bundle {deployment,version,resource,operation} {get,list}` commands
end to end against the local testserver. The DMS APIs aren't on test
workspaces yet, so this test is `Cloud = false` -- it only runs in the
in-process matrix.

Stubbed response shapes match the SDK v0.136 `bundle` service models;
the golden captures the rendered output for each command in order:
list-then-get for each of the four nouns.

Co-authored-by: Isaac
Mark every auto-generated DMS read command (`get`, `list` under each of
deployment/version/resource/operation) and the three new noun groups
(version/resource/operation) as `Hidden: true`. The commands still
route through cobra so callers who know to invoke them get the same
behavior; help just no longer advertises the surface until DMS is
documented as a user-facing CLI feature.

The existing `deployment` group stays visible because it still has
`bind`/`unbind`/`migrate`; only its two new `get`/`list` children are
hidden.

Help goldens refreshed:
  - bundle/help/bundle:            drop the version/resource/operation rows
  - bundle/help/bundle-deployment: drop the get/list rows

The local-only `cmd/bundle/dms-read-only` acceptance test continues
to pass without -update (Hidden=true doesn't affect routing, only the
help renderer).

Co-authored-by: Isaac
@shreyas-goenka shreyas-goenka marked this pull request as ready for review May 26, 2026 08:53
@github-actions
Copy link
Copy Markdown
Contributor

Approval status: pending

/cmd/bundle/ - needs approval

Files: cmd/bundle/bundle.go, cmd/bundle/metadata_service.go
Suggested: @denik
Also eligible: @pietern, @lennartkats-db, @andrewnester, @anton-107, @janniklasrose

General files (require maintainer)

4 files changed
Based on git history:

  • @denik -- recent work in cmd/bundle/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

The previous commit set `sub.Hidden = true` inside
`metadataServiceCommands()`, which made the hide invisible at the call
site -- reading `bundle.go` you couldn't tell that the deployment `get`
and `list` rows wouldn't show up in help.

Move the hide into the call site: a single loop over the returned `dms`
map flips `Hidden` on all eight commands right where the wiring lives.
`metadataServiceCommands()` is now opinion-free -- it just detaches and
indexes -- and the visibility policy is colocated with the wiring.

No behavior change: same set of commands hidden, same help output,
existing acceptance tests still pass without `-update`.

Co-authored-by: Isaac
Copy link
Copy Markdown
Contributor

@ilyakuz-db ilyakuz-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate how these commands work, it's not clear from this PR, is this proxy for DMS CRUD commands?

I'd expect databrick bundle * commands to be context-aware, i.e. if the command is triggered from bundle folder it shows me list of deployments of this bundle, not all workspace deployments.

If this is not expected to be context aware probably it should be databricks deployments list, similar to databricks jobs list or databricks clusters list

@shreyas-goenka
Copy link
Copy Markdown
Contributor Author

@ilyakuz-db Good feedback, your suggestion makes sense thuogh it does break precedent for worksapce API commands. At this moment all deployments will be listed, and GET requires all the deployment_id. Implementing bundle aware commands requires client side filtering because the server does not provide them.

What you are suggesting is cleaner, though we'll need to work out the command paths and requires a ODD to align.

I'll proceed with merging this because it's all hidden, but lets properly design and implement the commands to make sure the final version is more intentional.

@ilyakuz-db
Copy link
Copy Markdown
Contributor

@ilyakuz-db Good feedback, your suggestion makes sense thuogh it does break precedent for worksapce API commands. At this moment all deployments will be listed, and GET requires all the deployment_id. Implementing bundle aware commands requires client side filtering because the server does not provide them.

What you are suggesting is cleaner, though we'll need to work out the command paths and requires a ODD to align.

I'll proceed with merging this because it's all hidden, but lets properly design and implement the commands to make sure the final version is more intentional.

Sounds good

@shreyas-goenka shreyas-goenka merged commit 4aa26fa into main May 26, 2026
23 of 26 checks passed
@shreyas-goenka shreyas-goenka deleted the shreyas-goenka/bundle-dms-read-only branch May 26, 2026 13:59
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

Commit: 4aa26fa

Run: 26452808451

@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

Commit: 4aa26fa

Run: 26452940888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants