Skip to content

apps: add git flags to create/update/deploy - #6371

Merged
pietern merged 4 commits into
mainfrom
add-apps-git-flags
Aug 25, 2026
Merged

pietern merged 4 commits into
mainfrom
add-apps-git-flags

Conversation

@atreyadbrx

Copy link
Copy Markdown
Contributor

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.

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
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 92eb235

Run: 32772921110

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 1 4 274 1168 5:49
💚​ aws windows 1 4 276 1166 4:37
💚​ azure linux 1 4 273 1168 5:31
💚​ azure windows 1 4 275 1166 5:29
💚​ gcp linux 1 4 274 1168 6:42
💚​ gcp windows 1 4 276 1166 5:39
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:10 aws windows TestAccept
3:08 azure windows TestAccept
3:00 gcp windows TestAccept

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
pietern enabled auto-merge August 25, 2026 17:53
@pietern
pietern added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 9a93c4c Aug 25, 2026
25 checks passed
@pietern
pietern deleted the add-apps-git-flags branch August 25, 2026 18:11
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>
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.

4 participants