diff --git a/bundle/artifacts/whl/prepare.go b/bundle/artifacts/whl/prepare.go index 7284b11e..0fbb2080 100644 --- a/bundle/artifacts/whl/prepare.go +++ b/bundle/artifacts/whl/prepare.go @@ -32,6 +32,11 @@ func (m *prepare) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics return diag.Errorf("artifact doesn't exist: %s", m.name) } + // If there is no build command for the artifact, we don't need to cleanup the dist folder before + if artifact.BuildCommand == "" { + return nil + } + dir := artifact.Path distPath := filepath.Join(dir, "dist") diff --git a/bundle/tests/python_wheel/python_wheel_no_build/.gitignore b/bundle/tests/python_wheel/python_wheel_no_build/.gitignore new file mode 100644 index 00000000..f03e23bc --- /dev/null +++ b/bundle/tests/python_wheel/python_wheel_no_build/.gitignore @@ -0,0 +1,3 @@ +build/ +*.egg-info +.databricks diff --git a/bundle/tests/python_wheel/python_wheel_no_build/bundle.yml b/bundle/tests/python_wheel/python_wheel_no_build/bundle.yml new file mode 100644 index 00000000..91b8b155 --- /dev/null +++ b/bundle/tests/python_wheel/python_wheel_no_build/bundle.yml @@ -0,0 +1,16 @@ +bundle: + name: python-wheel + +resources: + jobs: + test_job: + name: "[${bundle.environment}] My Wheel Job" + tasks: + - task_key: TestTask + existing_cluster_id: "0717-132531-5opeqon1" + python_wheel_task: + package_name: "my_test_code" + entry_point: "run" + libraries: + - whl: ./dist/*.whl + - whl: ./dist/lib/my_test_code-0.0.1-py3-none-any.whl diff --git a/bundle/tests/python_wheel/python_wheel_no_build/dist/lib/my_test_code-0.0.1-py3-none-any.whl b/bundle/tests/python_wheel/python_wheel_no_build/dist/lib/my_test_code-0.0.1-py3-none-any.whl new file mode 100644 index 00000000..4bb80477 Binary files /dev/null and b/bundle/tests/python_wheel/python_wheel_no_build/dist/lib/my_test_code-0.0.1-py3-none-any.whl differ diff --git a/bundle/tests/python_wheel/python_wheel_no_build/dist/my_test_code-0.0.1-py3-none-any.whl b/bundle/tests/python_wheel/python_wheel_no_build/dist/my_test_code-0.0.1-py3-none-any.whl new file mode 100644 index 00000000..4bb80477 Binary files /dev/null and b/bundle/tests/python_wheel/python_wheel_no_build/dist/my_test_code-0.0.1-py3-none-any.whl differ diff --git a/bundle/tests/python_wheel_test.go b/bundle/tests/python_wheel_test.go index 53c6764e..05e4fdfa 100644 --- a/bundle/tests/python_wheel_test.go +++ b/bundle/tests/python_wheel_test.go @@ -130,3 +130,16 @@ func TestPythonWheelBuildMultiple(t *testing.T) { diags = bundle.Apply(ctx, b, match) require.NoError(t, diags.Error()) } + +func TestPythonWheelNoBuild(t *testing.T) { + ctx := context.Background() + b, err := bundle.Load(ctx, "./python_wheel/python_wheel_no_build") + require.NoError(t, err) + + diags := bundle.Apply(ctx, b, bundle.Seq(phases.Load(), phases.Build())) + require.NoError(t, diags.Error()) + + match := libraries.ValidateLocalLibrariesExist() + diags = bundle.Apply(ctx, b, match) + require.NoError(t, diags.Error()) +}