Skip to content

Support to install lisa automatically#4259

Open
LiliDeng wants to merge 1 commit intomainfrom
lildeng/fix_1_21_002
Open

Support to install lisa automatically#4259
LiliDeng wants to merge 1 commit intomainfrom
lildeng/fix_1_21_002

Conversation

@LiliDeng
Copy link
Collaborator

@LiliDeng LiliDeng commented Feb 2, 2026

No description provided.

@LiliDeng LiliDeng requested a review from rabdulfaizy February 2, 2026 05:28
@LiliDeng LiliDeng marked this pull request as ready for review February 2, 2026 05:28
@LiliDeng LiliDeng requested a review from Copilot February 2, 2026 05:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automated installation support for Microsoft LISA, providing quick-start scripts for Windows, Linux, and Docker-based deployments. The changes aim to simplify the LISA installation process across different platforms and reduce manual setup complexity.

Changes:

  • Added three installation automation scripts: quick-install.sh (Linux), quick-install.ps1 (Windows), and quick-container.sh (Docker container management)
  • Updated installation documentation (installation_linux.rst, docker_linux.rst) to include quick-start options
  • Created comprehensive INSTALL.md guide covering prerequisites, installation options, and troubleshooting for both platforms

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
quick-install.sh Bash script automating LISA installation on Linux with distribution detection, Python version management, and virtual environment support for Ubuntu 24.04+
quick-install.ps1 PowerShell script automating LISA installation on Windows with automatic Python and Git installation via winget or direct download
quick-container.sh Bash script for running LISA in Docker containers with support for runbooks, authentication, log mounting, and Docker/Azure CLI installation
docs/installation_linux.rst Updated with quick installation script usage, Docker quick-start section, and Ubuntu 24.04+ virtual environment guidance
docs/docker_linux.rst Added quick-container script documentation with comprehensive examples and automatic Docker installation instructions
INSTALL.md New comprehensive installation guide with prerequisites, platform-specific instructions, verification steps, and troubleshooting section

Comment on lines +223 to +224
if [ -n "$ACCESS_TOKEN" ]; then
LISA_VARIABLES+=("azure_arm_access_token:$ACCESS_TOKEN")
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sensitive credentials (ACCESS_TOKEN) are being passed through command-line arguments and may be exposed in process listings, shell history, or logs. The command is echoed on line 522, which could expose the token. Consider warning users about this security implication in the help text, or use environment variables instead of command-line arguments for sensitive data.

Suggested change
if [ -n "$ACCESS_TOKEN" ]; then
LISA_VARIABLES+=("azure_arm_access_token:$ACCESS_TOKEN")
# Prefer environment variable for access token to avoid exposing it via command-line arguments
if [ -n "$AZURE_ARM_ACCESS_TOKEN" ]; then
LISA_VARIABLES+=("azure_arm_access_token:$AZURE_ARM_ACCESS_TOKEN")

Copilot uses AI. Check for mistakes.
Comment on lines +135 to +137
5. **Install LISA with Azure extensions**
```bash
pip3 install -e .[azure]
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installation command uses the short form pip install -e .[azure] but in the scripts and other documentation, the more explicit form pip install --editable .[azure,libvirt] is used with libvirt included. This inconsistency could lead to users having different extension sets installed. Consider standardizing on one approach and clarifying which extensions are included.

Suggested change
5. **Install LISA with Azure extensions**
```bash
pip3 install -e .[azure]
5. **Install LISA with Azure and libvirt extensions**
```bash
pip3 install --editable .[azure,libvirt]

Copilot uses AI. Check for mistakes.
else {
# Fallback: Download and install Python directly
Write-Host " winget not found. Downloading Python 3.12 installer..." -ForegroundColor Yellow
$pythonUrl = "https://www.python.org/ftp/python/3.12.8/python-3.12.8-amd64.exe"
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded Python installer URL points to version 3.12.8, which may become outdated. Consider making this version configurable or using a mechanism to fetch the latest 3.12.x version dynamically to ensure users get security updates and bug fixes.

Copilot uses AI. Check for mistakes.
Comment on lines +237 to +252
if (Test-Path $InstallPath) {
Write-Host " Directory $InstallPath already exists" -ForegroundColor Yellow
$response = Read-Host " Do you want to remove it and re-clone? (y/N)"
if ($response -eq 'y' -or $response -eq 'Y') {
Remove-Item -Path $InstallPath -Recurse -Force
Write-Host " Cloning LISA repository..." -ForegroundColor Yellow
# Temporarily allow errors for git clone (it outputs to stderr)
$prevErrorPref = $ErrorActionPreference
$ErrorActionPreference = "Continue"
& git clone --branch $Branch https://github.com/microsoft/lisa.git $InstallPath 2>&1 | Out-Null
$ErrorActionPreference = $prevErrorPref
}
else {
Write-Host " Using existing directory..." -ForegroundColor Yellow
$needsClone = $false
}
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the directory already exists, the script prompts the user but doesn't validate the clone was successful after the user chooses 'N'. If the existing directory is corrupted or incomplete, the installation will proceed with a broken state. Consider adding validation of the existing directory structure (e.g., checking for pyproject.toml) before using it.

Copilot uses AI. Check for mistakes.
Comment on lines +349 to +361
NEEDS_CLONE=true

if [ -d "$INSTALL_PATH" ]; then
echo " Directory $INSTALL_PATH already exists, removing it..."
rm -rf "$INSTALL_PATH"
echo " Cloning LISA repository..."
git clone --branch "$BRANCH" https://github.com/microsoft/lisa.git "$INSTALL_PATH" --quiet
fi

if [ "$NEEDS_CLONE" = true ] && [ ! -d "$INSTALL_PATH" ]; then
echo " Cloning LISA repository to $INSTALL_PATH..."
git clone --branch "$BRANCH" https://github.com/microsoft/lisa.git "$INSTALL_PATH" --quiet
fi
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable NEEDS_CLONE is set to true but never set to false before the conditional check on line 358. This means the clone will always be attempted even after removing and re-cloning the directory on lines 352-355. The logic should set NEEDS_CLONE=false after the successful clone on line 355.

Copilot uses AI. Check for mistakes.
Comment on lines +514 to +526
# Add LISA variables
for var in "${LISA_VARIABLES[@]}"; do
DOCKER_CMD="$DOCKER_CMD -v \"$var\""
done
fi

# Show the command being executed
print_info "Executing Docker command:"
echo " $DOCKER_CMD"
echo ""

# Execute the command
eval "$DOCKER_CMD"
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command string is being built with quoted variables inside, but then evaluated with 'eval'. This can lead to word splitting issues. On line 516, variables are being added with quotes inside the string: DOCKER_CMD="$DOCKER_CMD -v "$var"". When eval executes this, the quotes may not work as intended if the variable contains spaces or special characters. Consider using an array to build the command instead of a string, or ensure proper escaping.

Copilot uses AI. Check for mistakes.
Comment on lines +158 to +163
PYTHON_BIN=$(which "python${PYTHON_VERSION}" 2>/dev/null || find /usr -name "python${PYTHON_VERSION}" 2>/dev/null | head -1)

if [ -z "$PYTHON_BIN" ]; then
echo " [ERROR] Python ${PYTHON_VERSION} installation failed - binary not found"
echo " [INFO] Searching for installed Python versions..."
find /usr -name "python3.*" -type f 2>/dev/null | head -10
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The find command searches all of /usr which can be slow on large systems and may find non-executable files or test files. Consider limiting the search to common Python installation directories like /usr/bin or /usr/local/bin to improve performance and accuracy.

Suggested change
PYTHON_BIN=$(which "python${PYTHON_VERSION}" 2>/dev/null || find /usr -name "python${PYTHON_VERSION}" 2>/dev/null | head -1)
if [ -z "$PYTHON_BIN" ]; then
echo " [ERROR] Python ${PYTHON_VERSION} installation failed - binary not found"
echo " [INFO] Searching for installed Python versions..."
find /usr -name "python3.*" -type f 2>/dev/null | head -10
PYTHON_BIN=$(which "python${PYTHON_VERSION}" 2>/dev/null || find /usr/bin /usr/local/bin -maxdepth 1 -type f -executable -name "python${PYTHON_VERSION}" 2>/dev/null | head -1)
if [ -z "$PYTHON_BIN" ]; then
echo " [ERROR] Python ${PYTHON_VERSION} installation failed - binary not found"
echo " [INFO] Searching for installed Python versions..."
find /usr/bin /usr/local/bin -maxdepth 1 -type f -name "python3.*" 2>/dev/null | head -10

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +43
# Navigate to the lisa directory
cd path\to\lisa

# Run the installation script
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation instructs users to first navigate to the LISA directory, then run the installation script. However, the script is designed to clone the LISA repository itself. This creates confusion - users would need to have already downloaded the script separately, or cloned the repository, which defeats the purpose of the automated installation. Consider clarifying whether users should download just the script file or if they already have the repository.

Suggested change
# Navigate to the lisa directory
cd path\to\lisa
# Run the installation script
# Download the LISA quick-install script (no prior clone required)
Invoke-WebRequest `
-Uri "https://raw.githubusercontent.com/microsoft/lisa/main/quick-install.ps1" `
-OutFile "quick-install.ps1"
# Run the installation script (it will clone LISA to the install path)

Copilot uses AI. Check for mistakes.
echo " [ERROR] LISA installation failed"
echo ""
echo " Common causes:"
echo " 1. Python version too old (need 3.8+, have $CURRENT_VERSION)"
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an inconsistency in the minimum Python version requirement. Line 99 warns that "LISA requires Python 3.9+", but lines 376 and 422 state "LISA requires Python 3.8+". This conflicting information could confuse users. The requirements should be consistent throughout the script - verify the actual minimum version and update all messages accordingly.

Suggested change
echo " 1. Python version too old (need 3.8+, have $CURRENT_VERSION)"
echo " 1. Python version too old (need 3.9+, have $CURRENT_VERSION)"

Copilot uses AI. Check for mistakes.
Comment on lines +514 to +522
# Add LISA variables
for var in "${LISA_VARIABLES[@]}"; do
DOCKER_CMD="$DOCKER_CMD -v \"$var\""
done
fi

# Show the command being executed
print_info "Executing Docker command:"
echo " $DOCKER_CMD"
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructed DOCKER_CMD string includes all LISA_VARIABLES (including azure_arm_access_token from --token and any other secrets passed via -v) and is then echoed verbatim, which will print sensitive bearer tokens and credentials to the console and any logs capturing this output. An attacker with access to terminal scrollback, CI logs, or log files could reuse these tokens to access your Azure subscription or other resources. To prevent this, avoid logging secrets by either not including sensitive values in DOCKER_CMD when printing it or masking/removing secret-valued variables before echoing the command.

Copilot uses AI. Check for mistakes.

.. code:: bash

bash quick-container.sh --install-docker
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

working command
bash quick-container.sh --install-docker --interactive

@@ -55,6 +65,114 @@ Use below command to launch the LISA container.

docker run --rm -i mcr.microsoft.com/lisa/runtime:latest lisa -r ./examples/runbook/hello_world.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lisa/examples/runbook/hello_world.yml
docker run --rm -i mcr.microsoft.com/lisa/runtime:latest lisa -r ./examples/runbook/hello_world.yml threw no such file or directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants