Skip to content

Commit afc345f

Browse files
authored
Add template test to confirm the output when uv is not found (#3240)
## Why We should provide installation instructions when uv is not found when we try to execute it. This test confirms the baseline to improve.
1 parent e36dea7 commit afc345f

File tree

5 files changed

+66
-0
lines changed

5 files changed

+66
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"project_name": "fail_missing_uv",
3+
"include_notebook": "no",
4+
"include_dlt": "no",
5+
"include_python": "yes",
6+
"serverless": "no"
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Local = true
2+
Cloud = false
3+
4+
[EnvMatrix]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
>>> [CLI] bundle init default-python --config-file ./input.json --output-dir output
3+
4+
Welcome to the default Python template for Databricks Asset Bundles!
5+
Workspace to use (auto-detected, edit in 'fail_missing_uv/databricks.yml'): [DATABRICKS_URL]
6+
7+
✨ Your new project has been created in the 'fail_missing_uv' directory!
8+
9+
Please refer to the README.md file for "getting started" instructions.
10+
See also the documentation at https://docs.databricks.com/dev-tools/bundles/index.html.
11+
12+
>>> [CLI] bundle validate
13+
Name: fail_missing_uv
14+
Target: dev
15+
Workspace:
16+
Host: [DATABRICKS_URL]
17+
User: [USERNAME]
18+
Path: /Workspace/Users/[USERNAME]/.bundle/fail_missing_uv/dev
19+
20+
Validation OK!
21+
22+
>>> [CLI] bundle deploy
23+
Building python_artifact...
24+
Error: build failed python_artifact, error: exit status 127, output: bash: uv: command not found
25+
26+
27+
28+
Exit code: 1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trace $CLI bundle init default-python --config-file ./input.json --output-dir output
2+
3+
cd output/fail_missing_uv
4+
trace $CLI bundle validate
5+
6+
# Dynamically find the directory containing 'uv' and remove it from PATH
7+
uv_dir=$(dirname "$(command -v uv 2>/dev/null || which uv 2>/dev/null)")
8+
if [ -n "$uv_dir" ]; then
9+
export PATH=$(echo "$PATH" | tr ':' '\n' | grep -v "^$uv_dir$" | paste -sd: -)
10+
fi
11+
12+
# Try to deploy, expect failure due to missing uv
13+
errcode trace $CLI bundle deploy
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Badness = "The error message is not ideal: it reports a generic build failure or 'command not found' instead of a clear message that 'uv' is missing from the environment."
2+
3+
Local = true
4+
Cloud = false
5+
6+
Ignore = [
7+
'output/fail_missing_uv',
8+
]
9+
10+
# Replace the uv not found error for portability
11+
[[Repls]]
12+
Old = '(/usr)?(/bin)?/bash(: line 1)?: uv: command not found'
13+
New = 'bash: uv: command not found'

0 commit comments

Comments
 (0)