Skip to content

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

Draft
shreyas-goenka wants to merge 4 commits into
mainfrom
shreyas-goenka/bundle-dms-read-only
Draft

bundle: surface read-only DMS commands under DAB sub-groups#5313
shreyas-goenka wants to merge 4 commits into
mainfrom
shreyas-goenka/bundle-dms-read-only

Conversation

@shreyas-goenka
Copy link
Copy Markdown
Contributor

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 Aliases Commands
bundle deployment deployments get, list -- additive next to existing bind, unbind, migrate
bundle version versions get, list
bundle resource resources get, list
bundle operation operations get, list

Cobra renders the noun, nouns alias pair in the help header for each group, so either form is discoverable from --help and routes the same way.

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: 5f4b668

Run: 26290925490

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
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.

2 participants