bundle: surface read-only DMS commands under DAB sub-groups#5313
Draft
shreyas-goenka wants to merge 4 commits into
Draft
bundle: surface read-only DMS commands under DAB sub-groups#5313shreyas-goenka wants to merge 4 commits into
shreyas-goenka wants to merge 4 commits into
Conversation
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
a79fd4a to
96e0aad
Compare
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
Collaborator
|
Commit: 5f4b668 |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #5311 (the SDK v0.136 bump). Retarget to
mainonce that lands.Why
SDK v0.135 added a workspace-level
bundleservice (DMS). Its auto-generated CLI commands sit at the rootdatabricks bundle <verb>and collide with the DABbundlecommand tree, so PR #5311 filters them out of top-level registration. This PR brings the read-side commands back, grouped under the existing DABbundlenamespace.Layout
bundle deploymentdeploymentsget,list-- additive next to existingbind,unbind,migratebundle versionversionsget,listbundle resourceresourcesget,listbundle operationoperationsget,listCobra renders the
noun, nounsalias pair in the help header for each group, so either form is discoverable from--helpand 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/bundletree.Wiring
The DAB
deploymentgroup is additive -- the newget/listverbs join the existingbind/unbind/migrateunder one parent. The other three groups are brand new.Implementation lives in
cmd/bundle/metadata_service.go:metadataServiceCommands()callsworkspacebundle.New()once, detaches every subcommand from the discarded workspace root, and returns them in a map keyed by their original cobraName(e.g.\"get-deployment\").renameTo(c, newName)rewrites the first whitespace-separated token of cobra'sUsefield 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.gopulls 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 workspacebundlefilter incmd/cmd.gostays in place, so the mutating verbs do not leak to the root.Test plan
go build ./...go test ./cmd/... ./bundle/...(all green)go vet ./...cleandatabricks bundle {deployment,version,resource,operation} --helpshow the expected commands + alias pairdatabricks bundle deployments get --help(plural alias) routes correctlydatabricks bundle debug refschema --helpunaffected