Repository navigation
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 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 dropped the Git configuration and wrote a `source_code_path` pointing at a local directory with nothing downloaded (a git-backed app has no workspace `default_source_code_path`), silently down-converting it 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 — from `app.git_source`, falling back to `app.default_git_source`. Output-only fields (`resolved_commit`, nested `git_repository`) are omitted. Workspace-source apps are unchanged. ## Tests - Acceptance test `acceptance/bundle/generate/app_git_backed`: stubs a git-backed app `GET` and asserts the generated `out.app.yml` carries `git_repository` + `git_source` (no workspace `source_code_path`). - Existing `bundle/generate/app` acceptance tests pass unchanged. Supersedes databricks#6620 (accidentally opened from a fork, which forced the isolated integration-test path); this is the same change in-repo, with the review feedback incorporated. This pull request and its description were written by Isaac. --------- Signed-off-by: atreyadbrx <atreya.misra@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com> Co-authored-by: Andrew Nester <andrew.nester.dev@gmail.com>
## 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 dropped the Git configuration and wrote a `source_code_path` pointing at a local directory with nothing downloaded (a git-backed app has no workspace `default_source_code_path`), silently down-converting it 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 — from `app.git_source`, falling back to `app.default_git_source`. Output-only fields (`resolved_commit`, nested `git_repository`) are omitted. Workspace-source apps are unchanged. ## Tests - Acceptance test `acceptance/bundle/generate/app_git_backed`: stubs a git-backed app `GET` and asserts the generated `out.app.yml` carries `git_repository` + `git_source` (no workspace `source_code_path`). - Existing `bundle/generate/app` acceptance tests pass unchanged. Supersedes #6620 (accidentally opened from a fork, which forced the isolated integration-test path); this is the same change in-repo, with the review feedback incorporated. This pull request and its description were written by Isaac. --------- Signed-off-by: atreyadbrx <atreya.misra@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com> Co-authored-by: Andrew Nester <andrew.nester.dev@gmail.com>
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.