Repository navigation
apps: add git flags to create/update/deploy - #6371
Merged
Merged
Conversation
The apps create/update/deploy commands accept a git repository and git deployment source, but the code generator emits these nested objects as `// TODO: complex arg` so they were only reachable via --json. Add ergonomic top-level flags for the GA git fields: - create/update: --git-url, --git-provider (App.GitRepository) - deploy: --git-branch, --git-tag, --git-commit, --git-source-code-path (AppDeployment.GitSource) The nested SDK pointers stay nil unless a git flag is set, so non-git requests are unchanged. Validation matches the API contract: url and provider must be set together; branch/tag/commit are mutually exclusive; source-code-path requires a ref. Co-authored-by: Isaac
golangci-lint's perfsprint linter flags fmt.Errorf with a static string and no format verbs. Both git flag validation errors are constant strings, so switch them to errors.New. Co-authored-by: Isaac
deployment_source is a proto oneof: an app deployment draws its code from either a workspace path (--source-code-path) or a Git source, not both. Reject the combination in the deploy git-source PreRunE so we don't build a request the server and bundle validation treat as invalid. Addresses review feedback from @atilafassina on #6182. Co-authored-by: Isaac
Collaborator
Integration test reportCommit: 92eb235
Top 3 slowest tests (at least 2 minutes):
|
atilafassina
approved these changes
Aug 24, 2026
The apps update usage now lists --git-url and --git-provider, so refresh the cmd/workspace/apps acceptance output.txt to match. Co-authored-by: Isaac
pietern
approved these changes
Aug 25, 2026
pietern
enabled auto-merge
August 25, 2026 17:53
chenyuem-db
pushed a commit
to chenyuem-db/cli
that referenced
this pull request
Sep 9, 2026
…icks#6390) ## Changes Follow-up to databricks#6371 (which added `--git-url`/`--git-provider` on create/update and the `apps deploy --git-*` ref flags). This extends the git flag overrides so a git-backed app can be fully configured without hand-written `--json`: - **`apps create` / `apps update`**: `--git-branch`, `--git-tag`, `--git-commit`, `--git-source-code-path` — populate `App.GitSource` (the app's default deployment ref, which the server persists and returns as `default_git_source`) — plus `--git-auto-deploy` (push-to-deploy). - **`apps create` only**: `--caller-git-credential-id` — the git credential granting the app's service principal repo access. The server rejects it on `UpdateApp`, so it is create-only. ### Validation - git-source flags require `--git-url`/`--git-provider` on create (the ref resolves against the app's repository). - `--git-auto-deploy` requires `--git-branch` (auto-deploy redeploys on pushes to a branch; a tag/commit has nothing to watch). Turning it off needs no branch. - The repo modifiers require the repository (`--git-url`/`--git-provider`). ### auto_deploy on update The sync `UpdateApp` replaces `git_repository` wholesale, and the server tears the push webhook down when a repository change omits `auto_deploy=true`. `GetApp` reports `auto_deploy=true` while the webhook is active, so on update the CLI reads the current value and carries it forward when `--git-auto-deploy` is not passed — a URL/provider change no longer silently disables push-to-deploy. ## Tests - Unit tests for every flag helper and validator (`git_flags_test.go`). - Acceptance golden regenerated (`apps update` help). - `golangci-lint`: clean. This pull request and its description were written by Isaac. Co-authored-by: Isaac <no-reply@databricks.com>
janniklasrose
pushed a commit
that referenced
this pull request
Sep 15, 2026
## Changes Add ergonomic top-level flags for the GA git fields on the apps commands, which the code generator emits as `// TODO: complex arg` (so today they are only reachable via `--json`): - `create` / `update`: `--git-url`, `--git-provider` (`App.GitRepository`) - `deploy`: `--git-branch`, `--git-tag`, `--git-commit`, `--git-source-code-path` (`AppDeployment.GitSource`) ## Why The git repository and git deployment source are nested objects, so the generator skips flag generation for them. Users could only configure git-based app deployment by hand-writing JSON. These flags follow the command-overrides pattern (same approach as `clusters/overrides.go`). The nested SDK pointers stay nil unless a git flag is set, so non-git requests are unchanged. Validation matches the API contract: - `--git-url` and `--git-provider` must be set together. - `--git-branch` / `--git-tag` / `--git-commit` are mutually exclusive (proto oneof). - `--git-source-code-path` requires a ref. - `deployment_source` is a oneof, so the workspace `--source-code-path` cannot be combined with the `--git-*` flags. ## Tests Unit tests in `git_flags_test.go` cover happy paths and each validation rule. Verified locally: `go build`, `go test`, and `golangci-lint` all pass. --- Supersedes #6182 (which was opened from a fork and could not run CI). Incorporates review feedback from @atilafassina on that PR (the workspace-vs-Git mutual-exclusion check). This pull request and its description were written by Isaac.
janniklasrose
pushed a commit
that referenced
this pull request
Sep 15, 2026
## Changes Follow-up to #6371 (which added `--git-url`/`--git-provider` on create/update and the `apps deploy --git-*` ref flags). This extends the git flag overrides so a git-backed app can be fully configured without hand-written `--json`: - **`apps create` / `apps update`**: `--git-branch`, `--git-tag`, `--git-commit`, `--git-source-code-path` — populate `App.GitSource` (the app's default deployment ref, which the server persists and returns as `default_git_source`) — plus `--git-auto-deploy` (push-to-deploy). - **`apps create` only**: `--caller-git-credential-id` — the git credential granting the app's service principal repo access. The server rejects it on `UpdateApp`, so it is create-only. ### Validation - git-source flags require `--git-url`/`--git-provider` on create (the ref resolves against the app's repository). - `--git-auto-deploy` requires `--git-branch` (auto-deploy redeploys on pushes to a branch; a tag/commit has nothing to watch). Turning it off needs no branch. - The repo modifiers require the repository (`--git-url`/`--git-provider`). ### auto_deploy on update The sync `UpdateApp` replaces `git_repository` wholesale, and the server tears the push webhook down when a repository change omits `auto_deploy=true`. `GetApp` reports `auto_deploy=true` while the webhook is active, so on update the CLI reads the current value and carries it forward when `--git-auto-deploy` is not passed — a URL/provider change no longer silently disables push-to-deploy. ## Tests - Unit tests for every flag helper and validator (`git_flags_test.go`). - Acceptance golden regenerated (`apps update` help). - `golangci-lint`: clean. This pull request and its description were written by Isaac. Co-authored-by: Isaac <no-reply@databricks.com>
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.
Changes
Add ergonomic top-level flags for the GA git fields on the apps commands, which the code generator emits as
// TODO: complex arg(so today they are only reachable via--json):create/update:--git-url,--git-provider(App.GitRepository)deploy:--git-branch,--git-tag,--git-commit,--git-source-code-path(AppDeployment.GitSource)Why
The git repository and git deployment source are nested objects, so the generator skips flag generation for them. Users could only configure git-based app deployment by hand-writing JSON. These flags follow the command-overrides pattern (same approach as
clusters/overrides.go).The nested SDK pointers stay nil unless a git flag is set, so non-git requests are unchanged. Validation matches the API contract:
--git-urland--git-providermust be set together.--git-branch/--git-tag/--git-commitare mutually exclusive (proto oneof).--git-source-code-pathrequires a ref.deployment_sourceis a oneof, so the workspace--source-code-pathcannot be combined with the--git-*flags.Tests
Unit tests in
git_flags_test.gocover happy paths and each validation rule. Verified locally:go build,go test, andgolangci-lintall pass.Supersedes #6182 (which was opened from a fork and could not run CI). Incorporates review feedback from @atilafassina on that PR (the workspace-vs-Git mutual-exclusion check).
This pull request and its description were written by Isaac.