feat(cube-cli): add data-model enable-branch / disable-branch commands - #11433
feat(cube-cli): add data-model enable-branch / disable-branch commands#11433paveltiunov wants to merge 1 commit into
Conversation
Expose the per-branch staging-environment toggle (Settings → Staging
Environments in the UI) through the CLI, so keeping a shared branch's
staging environment always active can be scripted from CI:
cube data-model enable-branch DEPLOYMENT_ID BRANCH
cube data-model disable-branch DEPLOYMENT_ID BRANCH
Both call the new `PUT /build/api/v1/deployments/{id}/branches/staging-environment`
endpoint with `{ branchName, enabled }`, mirroring how `embed
enable-dashboard` / `disable-dashboard` drive their boolean endpoint.
`data-model branches` now reports the state as an ENABLED column. Its
previous DEFAULT / CURRENT columns read `isDefault` / `isCurrent`, which
the branches endpoint does not return, so they always rendered empty;
they are replaced with PARENT and ENABLED, which it does return.
Docs: CLI reference (command table + Git-workflow section), the new
endpoint in the Control Plane API reference, and a pointer from the
staging-environments section of the deployment-environments page.
|
Claude finished @paveltiunov's task in 2m 56s —— View job Review: looks good to merge — 0 blocking, 1 medium, 2 low (4 inline comments)Full review
What's good
FindingsMedium —
Also worth a thought: dropping Low — stale command in the doc comment ( Low — "Cube Cloud" in user-facing help text ( Notes, not asks
|
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
| ("NAME", "name"), | ||
| ("DEFAULT", "isDefault"), | ||
| ("CURRENT", "isCurrent"), | ||
| ("PARENT", "parentBranch"), | ||
| ("ENABLED", "isStagingEnvironmentEnabled"), | ||
| ], |
There was a problem hiding this comment.
output::field returns an empty string for both a missing key and null, so if the branches endpoint omits isStagingEnvironmentEnabled for not-yet-toggled branches (rather than returning false), ENABLED renders blank — the exact failure mode this change is fixing for isDefault/isCurrent, just harder to notice because blank is plausible for "not enabled". Same for parentBranch on a root branch.
Since the endpoint lives in the enterprise repo, could you confirm against a real (non-stub) response that both keys are always present on every branch object, including branches never toggled? If isStagingEnvironmentEnabled can be absent, a blank cell will be indistinguishable from false.
Separately: dropping DEFAULT/CURRENT also drops the only place the CLI surfaced which branch is the deploy branch. If the response carries an equivalent (e.g. isDeployBranch/isMain), it'd be worth keeping a column for it — merge-to-default behavior depends on knowing it.
| /// Enabling a branch keeps its staging environment always active and accessible | ||
| /// at `<deploymentUrl>/dev-mode/<branch>/cubejs-api/v1`; disabled (the default) | ||
| /// it is only active while someone views the branch in Cube Cloud. Enabled | ||
| /// branches are the ones `cube environments list --type staging` reports. Only |
There was a problem hiding this comment.
Nit: environments list takes the deployment id as a required positional, so this command as written would fail. The success message below (line 263-265) has it right.
| /// branches are the ones `cube environments list --type staging` reports. Only | |
| /// branches are the ones `cube environments list <deployment> --type staging` |
| /// Enabling a branch keeps its staging environment always active and accessible | ||
| /// at `<deploymentUrl>/dev-mode/<branch>/cubejs-api/v1`; disabled (the default) | ||
| /// it is only active while someone views the branch in Cube Cloud. Enabled | ||
| /// branches are the ones `cube environments list --type staging` reports. Only |
There was a problem hiding this comment.
Correcting the suggestion above — it dropped the trailing reports. Only. Use:
| /// branches are the ones `cube environments list --type staging` reports. Only | |
| /// branches are the ones `cube environments list <deployment> --type staging` | |
| /// reports. Only |
| /// Disable a branch: its staging environment is active only while the | ||
| /// branch is viewed in Cube Cloud |
There was a problem hiding this comment.
docs-mintlify/CLAUDE.md lists "Cube Cloud" as legacy naming that shouldn't be used in new content. The new docs text correctly says "the Cube UI"; this help string (and the module doc at line 241) still says "Cube Cloud", and --help output is user-facing too. Worth aligning both to "the Cube UI".
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Check List
Description of Changes Made
Exposes the per-branch staging-environment toggle (Settings → Staging Environments in the UI) through the CLI, so keeping a shared branch's staging environment always active — rather than only while someone views the branch — can be scripted from CI:
Both call
PUT /build/api/v1/deployments/{id}/branches/staging-environmentwith{ branchName, enabled }, mirroring howembed enable-dashboard/disable-dashboarddrive their boolean endpoint. The endpoint is added in cubedevinc/cubejs-enterprise#13535, so these commands need a tenant running that build.data-model branchesnow reports the state as anENABLEDcolumn. Its previousDEFAULT/CURRENTcolumns readisDefault/isCurrent, which the branches endpoint does not return, so they always rendered empty — they are replaced withPARENTandENABLED, which it does return.Docs: CLI reference (command table + Git-workflow section), the new endpoint in the Control Plane API reference, and a pointer from the staging-environments section of the deployment-environments page.
Verification
cargo fmt,cargo clippy --all-targetsandcargo buildclean. Both commands were driven end-to-end against a stub HTTP server, confirming method, path, body,Authorizationscheme, the table and--jsonrendering, and the newENABLEDcolumn.Generated by Claude Code