Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Added `--limit` flag to all paginated list commands for client-side result capping ([#4984](https://github.com/databricks/cli/pull/4984)).

### Bundles
* Fix false duplicate source code path error for git-sourced apps ([#4996](https://github.com/databricks/cli/pull/4996))

### Dependency updates

Expand Down
13 changes: 13 additions & 0 deletions acceptance/bundle/apps/git_source_no_duplicate/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
bundle:
name: test-bundle

resources:
apps:
app1:
name: app1
git_source:
branch: main
app2:
name: app2
git_source:
branch: dev
5 changes: 5 additions & 0 deletions acceptance/bundle/apps/git_source_no_duplicate/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions acceptance/bundle/apps/git_source_no_duplicate/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

>>> [CLI] bundle validate
Name: test-bundle
Target: default
Workspace:
User: [USERNAME]
Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default

Validation OK!
1 change: 1 addition & 0 deletions acceptance/bundle/apps/git_source_no_duplicate/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trace $CLI bundle validate
5 changes: 5 additions & 0 deletions acceptance/bundle/apps/git_source_no_duplicate/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RecordRequests = false

Ignore = [
'.databricks',
]
18 changes: 10 additions & 8 deletions bundle/apps/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ func (v *validate) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics
continue
}

if _, ok := usedSourceCodePaths[app.SourceCodePath]; ok {
diags = append(diags, diag.Diagnostic{
Severity: diag.Error,
Summary: "Duplicate app source code path",
Detail: fmt.Sprintf("app resource '%s' has the same source code path as app resource '%s', this will lead to the app configuration being overriden by each other", key, usedSourceCodePaths[app.SourceCodePath]),
Locations: b.Config.GetLocations(fmt.Sprintf("resources.apps.%s.source_code_path", key)),
})
if app.SourceCodePath != "" {
if _, ok := usedSourceCodePaths[app.SourceCodePath]; ok {
diags = append(diags, diag.Diagnostic{
Severity: diag.Error,
Summary: "Duplicate app source code path",
Detail: fmt.Sprintf("app resource '%s' has the same source code path as app resource '%s', this will lead to the app configuration being overriden by each other", key, usedSourceCodePaths[app.SourceCodePath]),
Locations: b.Config.GetLocations(fmt.Sprintf("resources.apps.%s.source_code_path", key)),
})
}
usedSourceCodePaths[app.SourceCodePath] = key
}
usedSourceCodePaths[app.SourceCodePath] = key

diags = diags.Extend(warnForAppResourcePermissions(b, key, app))
}
Expand Down
Loading