Skip to content

Preserve git-backed config in bundle generate app - #6620

Closed
atreyadbrx wants to merge 3 commits into
databricks:mainfrom
atreyadbrx:apps-generate-git-backed
Closed

atreyadbrx wants to merge 3 commits into
databricks:mainfrom
atreyadbrx:apps-generate-git-backed

Conversation

@atreyadbrx

Copy link
Copy Markdown
Collaborator

Changes

databricks bundle generate app now reproduces a git-backed app's deployment configuration. When the existing app deploys from Git, it emits git_repository + git_source instead of a workspace source_code_path.

Why

ConvertAppToValue unconditionally wrote source_code_path, ignoring app.GitRepository / app.GitSource. Running bundle generate app against a git-backed app therefore:

  • dropped the Git configuration entirely, and
  • wrote source_code_path pointing at a local directory with nothing in it — a git-backed app has no workspace default_source_code_path, so the download step is skipped and nothing is written to the source dir.

The result silently down-converted a git-backed app to (broken) workspace source. Now, when app.GitRepository is set, generate emits git_repository (url/provider, plus auto_deploy when set) and the git_source reference — taken from app.git_source, falling back to app.default_git_source (the reference of the app's most recent deployment). Output-only fields (resolved_commit, the nested git_repository) are omitted. Workspace-source apps are unchanged.

Tests

  • New unit tests for ConvertAppToValue: workspace source is unchanged; a git-backed app emits git_repository/git_source and no source_code_path; default_git_source is used when git_source is unset.
  • Existing bundle/generate/app acceptance tests pass unchanged.

This pull request and its description were written by Isaac.

bundle generate app always emitted a workspace source_code_path, even
for an app that deploys from Git — silently converting it to workspace
source and pointing source_code_path at a local directory that has
nothing downloaded into it (a git-backed app has no workspace source to
download). Emit git_repository + git_source instead when the app is
git-backed, taking the reference from the app's git_source and falling
back to default_git_source.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: atreyadbrx <atreya.misra@databricks.com>
Comment thread bundle/generate/app_test.go Outdated
@@ -0,0 +1,94 @@
package generate

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.

Could you please instead of unit test convert it to acceptance test similar to this? https://github.com/databricks/cli/tree/main/acceptance/bundle/generate/app_subfolders

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done — converted to an acceptance test at acceptance/bundle/generate/app_git_backed, modeled on app_subfolders: it stubs a git-backed app GET response and asserts the generated out.app.yml carries git_repository + git_source (and no workspace source_code_path). Removed the unit test. Thanks for the review!

atreyadbrx and others added 2 commits September 11, 2026 13:48
Per review, replace the ConvertAppToValue unit test with an acceptance
test under acceptance/bundle/generate/app_git_backed that stubs a
git-backed app GET response and asserts the generated bundle config
carries git_repository + git_source (no workspace source_code_path).

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: atreyadbrx <atreya.misra@databricks.com>
@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: 6620
  • Commit SHA: cc204e4876f038fdf514572c22d68da6fd01a70e

Checks will be approved automatically on success.

@atreyadbrx

Copy link
Copy Markdown
Collaborator Author

Superseded by # — same change opened in-repo. This PR was accidentally opened from the atreyadbrx/cli fork, which forces the isolated integration-test path; the in-repo PR runs the normal flow. Closing.

@atreyadbrx atreyadbrx closed this Sep 11, 2026
@atreyadbrx

Copy link
Copy Markdown
Collaborator Author

Correction: superseded by #6656 (in-repo). #6656

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