diff --git a/acceptance/bundle/artifacts/same_name_libraries/databricks.yml b/acceptance/bundle/artifacts/same_name_libraries/databricks.yml index a065bae768..837cd01e86 100644 --- a/acceptance/bundle/artifacts/same_name_libraries/databricks.yml +++ b/acceptance/bundle/artifacts/same_name_libraries/databricks.yml @@ -34,6 +34,8 @@ resources: package_name: my_default_python libraries: - whl: ./whl1/dist/*.whl + - pypi: + package: test_package - task_key: task2 new_cluster: ${var.cluster} python_wheel_task: diff --git a/acceptance/bundle/artifacts/same_name_libraries/output.txt b/acceptance/bundle/artifacts/same_name_libraries/output.txt index 38cdd43c4e..1253d96809 100644 --- a/acceptance/bundle/artifacts/same_name_libraries/output.txt +++ b/acceptance/bundle/artifacts/same_name_libraries/output.txt @@ -6,7 +6,7 @@ Error: Duplicate local library name my_default_python-0.0.1-py3-none-any.whl at resources.jobs.test.tasks[0].libraries[0].whl resources.jobs.test.tasks[1].libraries[0].whl in databricks.yml:36:15 - databricks.yml:43:15 + databricks.yml:45:15 Local library names must be unique diff --git a/bundle/libraries/same_name_libraries.go b/bundle/libraries/same_name_libraries.go index 88b96ab54b..8de34cfece 100644 --- a/bundle/libraries/same_name_libraries.go +++ b/bundle/libraries/same_name_libraries.go @@ -31,13 +31,18 @@ func (c checkForSameNameLibraries) Apply(ctx context.Context, b *bundle.Bundle) var err error for _, pattern := range patterns { v, err = dyn.MapByPattern(v, pattern, func(p dyn.Path, lv dyn.Value) (dyn.Value, error) { - libPath := lv.MustString() + libFullPath, ok := lv.AsString() + // If the value is not a string, skip the check because it's not whl or jar type which defines the library + // as a string versus PyPi or Maven which defines the library as a map. + if !ok { + return v, nil + } + // If not local library, skip the check - if !IsLibraryLocal(libPath) { + if !IsLibraryLocal(libFullPath) { return lv, nil } - libFullPath := lv.MustString() lib := filepath.Base(libFullPath) // If the same basename was seen already but full path is different // then it's a duplicate. Add the location to the location list.