Skip to content

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

Closed
atreyadbrx wants to merge 2 commits into
databricks:mainfrom
atreyadbrx:add-apps-git-flags
Closed

apps: add git flags to create/update/deploy#6182
atreyadbrx wants to merge 2 commits into
databricks:mainfrom
atreyadbrx:add-apps-git-flags

Conversation

@atreyadbrx

Copy link
Copy Markdown
Collaborator

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

Changes

Why

Tests

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
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

Based on git history, these people are best suited to review:

  • @pietern -- recent work in cmd/workspace/apps/

Eligible reviewers: @MarioCadenas, @Shridhad, @atilafassina, @calvarjorge, @ditadi, @fjakobs, @igrekun, @keugenek, @pffigueiredo, @pkosiec

Suggestions based on git history. See OWNERS for ownership rules.

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
@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 6182
  • Commit SHA: bfd8cbf8765cac30f8d4e75717c2b55ecdfddd90

Checks will be approved automatically on success.

@atilafassina atilafassina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one little extra-check pending, let me know your thoughts

Comment on lines +64 to +71
if !refSet && !pathSet {
return nil
}
// A source-code path without a reference has no repository to resolve
// against — the reference is what selects the code to deploy.
if pathSet && !refSet {
return errors.New("--git-source-code-path requires one of --git-branch, --git-tag, or --git-commit")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should also reject --source-code-path before assigning git source, these params are mutually exclusive.

Otherwise the request can contain both workspace and Git source modes, which existing bundle validation treats as mutually exclusive.

@atreyadbrx

Copy link
Copy Markdown
Collaborator Author

Superseding this with #6371, opened as a same-repo (non-fork) branch so CI can run. It includes the same change plus @atilafassina's review feedback (rejecting the workspace --source-code-path when combined with the --git-* flags, since deployment_source is a oneof). Thanks for the review — carrying it over to #6371.

@atreyadbrx atreyadbrx closed this Aug 24, 2026
dkling-it pushed a commit to dkling-it/cli that referenced this pull request Aug 26, 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 databricks#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.
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.

2 participants