Preserve git-backed config in bundle generate app - #6620
atreyadbrx wants to merge 3 commits into
Conversation
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>
| @@ -0,0 +1,94 @@ | |||
| package generate | |||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
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>
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
|
Superseded by # — same change opened in-repo. This PR was accidentally opened from the |
Changes
databricks bundle generate appnow reproduces a git-backed app's deployment configuration. When the existing app deploys from Git, it emitsgit_repository+git_sourceinstead of a workspacesource_code_path.Why
ConvertAppToValueunconditionally wrotesource_code_path, ignoringapp.GitRepository/app.GitSource. Runningbundle generate appagainst a git-backed app therefore:source_code_pathpointing at a local directory with nothing in it — a git-backed app has no workspacedefault_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.GitRepositoryis set, generate emitsgit_repository(url/provider, plusauto_deploywhen set) and thegit_sourcereference — taken fromapp.git_source, falling back toapp.default_git_source(the reference of the app's most recent deployment). Output-only fields (resolved_commit, the nestedgit_repository) are omitted. Workspace-source apps are unchanged.Tests
ConvertAppToValue: workspace source is unchanged; a git-backed app emitsgit_repository/git_sourceand nosource_code_path;default_git_sourceis used whengit_sourceis unset.bundle/generate/appacceptance tests pass unchanged.This pull request and its description were written by Isaac.