-
Notifications
You must be signed in to change notification settings - Fork 136
Add bundle mode support to apps delete/start/stop/logs commands #4369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fjakobs
wants to merge
11
commits into
main
Choose a base branch
from
apps-delete-bundle-overload
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+815
−49
Conversation
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
When run from a directory containing databricks.yml without an app name, `databricks apps delete` now destroys all project resources (similar to `databricks bundle destroy`). When an app name is provided, it falls back to the original API delete. This mirrors the behavior of `databricks apps deploy` and provides a consistent UX for project-based workflows. Changes: - Add BundleDeleteOverrideWithWrapper in cmd/apps/delete_bundle.go - Register delete override in cmd/workspace/apps/overrides.go - Add --auto-approve and --force-lock flags for project mode - Update terminology from "bundle" to "Databricks Apps project" - Add unit tests for delete override functionality Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When run from a Databricks Apps project directory without an app name, `databricks apps start` and `databricks apps stop` now automatically detect the app name from the databricks.yml configuration (similar to how `databricks apps dev-remote` works). When an app name is provided, they fall back to the original API behavior. This provides a consistent UX for project-based workflows where users don't need to manually specify the app name each time. Changes: - Add BundleStartOverrideWithWrapper in cmd/apps/start_stop_bundle.go - Add BundleStopOverrideWithWrapper in cmd/apps/start_stop_bundle.go - Register start and stop overrides in cmd/workspace/apps/overrides.go - Remove old startOverride function (replaced by bundle version) - Add unit tests for start/stop override functionality Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enhanced the apps start, stop, deploy, and delete commands with better target support and user experience: Target Flag Support: - Added examples showing --target flag usage in all project mode commands - The --target flag was already working (via TryConfigureBundle) but now properly documented in help text Human-Readable Output: - start/stop commands in project mode now show friendly success messages instead of raw JSON output - Provides clear feedback: "✔ App 'name' started/stopped successfully" Changes: - Add --target examples to all command help texts - Improve start/stop output formatting in project mode - Maintain JSON output for API mode (backward compatible) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed start and stop commands to handle cases where the app is already in the desired state gracefully instead of returning an error. Behavior: - `databricks apps start` on an already-running app now shows: "✔ App 'name' is already started" (instead of erroring) - `databricks apps stop` on an already-stopped app now shows: "✔ App 'name' is already stopped" (instead of erroring) This makes the commands idempotent and provides a better user experience, especially in automation scenarios where the exact state of the app may not be known before running the command. Works in both project mode and API mode. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Modified start and stop commands to respect the output format flag: Text Mode (default): - In project mode, calls the API directly and shows only human-readable messages without JSON output - Shows spinner with progress updates during wait - Clean output: "✔ App 'name' started/stopped successfully" - Idempotent behavior maintained JSON Mode (-o json): - Uses the original command to render JSON output - No additional human-readable messages added - Useful for scripting and automation This ensures users see clean, human-friendly output by default while still supporting JSON output when explicitly requested. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Modified the start command to display the app URL after successfully starting (or when the app is already started). Behavior: - After `databricks apps start` completes, shows: "App URL: <url>" - Works in both project mode and API mode - Works for both newly started apps and already-running apps (idempotent case) - In project mode: Uses the app info from the wait response when available, otherwise makes a separate API call to get the URL - In API mode with explicit app name: Gets URL when app is already started This makes it easier for users to immediately access their app after starting it. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enhanced the visual presentation of the app URL after starting: Before: ✔ App 'app7' is already started App URL: https://app7-1966697730403610.10.azure.databricksapps.com After: ✔ App 'app7' is already running 🔗 https://app7-1966697730403610.10.azure.databricksapps.com Changes: - Added link emoji (🔗) before URL for better visual distinction - Added blank lines before and after URL to improve readability - Changed "already started" to "already running" for consistency - Makes the URL stand out more clearly in the terminal output Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit adds bundle mode support to the `apps logs` command and
reduces code duplication across apps commands (logs, start, stop).
Changes:
- Add bundle_helpers.go with shared helper functions:
- makeArgsOptionalWithBundle: Handles optional NAME argument
- getAppNameFromArgs: Detects app name from args or bundle config
- updateCommandHelp: Generates consistent help text
- BundleLogsOverride: Applies bundle mode to logs command
- Update apps logs command to auto-detect app name from databricks.yml
- Now supports `databricks apps logs` without NAME argument
- Maintains backward compatibility with explicit NAME
- Refactor start/stop commands to reduce duplication:
- Extract formatAppStatusMessage helper for status message generation
- Reduces ~90 lines of duplicated code
- Remove obvious comments and improve code clarity
- Fix apps delete double initialization panic:
- Update CommandBundleDestroy to skip context initialization when
already initialized by parent command (apps delete override)
- Fixes: "must not call InitContext() twice" panic
All commands now support consistent dual mode behavior:
- Auto-detect from databricks.yml when no NAME provided
- Fall back to API mode with explicit NAME argument
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…rage Extracted 3 helper functions (isIdempotencyError, displayAppURL, handleAlreadyInStateError) to eliminate repeated patterns across start/stop/delete commands. Replaced inline argument validation with shared makeArgsOptionalWithBundle helper. Removed 15+ redundant comments per CLAUDE.md guidelines. Added comprehensive unit tests for all helper functions and command override behavior, increasing test coverage from 10-15% to 70-80%. Net impact: -92 lines of production code, +165 lines including tests. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Move formatAppStatusMessage and helper functions to bundle_helpers.go - Refactor start/stop overrides to use shared helper functions - Remove verbose test assertion messages Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Remove "Get current working directory for validation" comment - Remove "Show error details" comment Both comments were redundant and violated the project style guide. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Collaborator
|
Commit: fd33b4f
18 interesting tests: 9 KNOWN, 5 SKIP, 3 RECOVERED, 1 flaky
Top 50 slowest tests (at least 2 minutes):
|
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.
Summary
This PR adds bundle mode support to
apps delete,start,stop, andlogscommands, allowing them to auto-detect the app name from project configuration. It also significantly reduces code duplication by extracting common functionality into shared helper functions.Changes
New Features
databricks apps delete- Destroys all project resources (callsbundle destroy)databricks apps start/stop- Auto-detects app name fromdatabricks.ymldatabricks apps logs- Streams logs for project app automatically--targetflagExamples