mirror of https://github.com/databricks/cli.git
Fixed incorrectly cleaning up python wheel dist folder (#1656)
## Changes In https://github.com/databricks/cli/pull/1618 we introduced prepare step in which Python wheel folder was cleaned. Now it was cleaned everytime instead of only when there is a build command how it is used to work. This PR fixes it by only cleaning up dist folder when there is a build command for wheels. Fixes #1638 ## Tests Added regression test
This commit is contained in:
parent
809c67b675
commit
d26f3f4863
|
@ -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")
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
build/
|
||||
*.egg-info
|
||||
.databricks
|
|
@ -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
|
BIN
bundle/tests/python_wheel/python_wheel_no_build/dist/lib/my_test_code-0.0.1-py3-none-any.whl
vendored
Normal file
BIN
bundle/tests/python_wheel/python_wheel_no_build/dist/lib/my_test_code-0.0.1-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
bundle/tests/python_wheel/python_wheel_no_build/dist/my_test_code-0.0.1-py3-none-any.whl
vendored
Normal file
BIN
bundle/tests/python_wheel/python_wheel_no_build/dist/my_test_code-0.0.1-py3-none-any.whl
vendored
Normal file
Binary file not shown.
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue