projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.
Apache License 2.0
3.12k stars 654 forks source link

Custom deploy script for miniconda #1862

Closed Korijn closed 7 years ago

Korijn commented 8 years ago

The start of my custom deploy script looks like this:

@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.6
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Verify conda is installed
where conda 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
    mkdir "%appdata%\Miniconda3_tmp"
    pushd "%appdata%\Miniconda3_tmp"
    curl --silent -O https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe
    Miniconda3-latest-Windows-x86_64.exe /InstallationType=JustMe /AddToPath=1 /RegisterPython=0 /S /D=%appdata%\Miniconda3
    popd
    rm -rf "%appdata%\Miniconda3_tmp"
    :: PATH has been updated by the miniconda installer, but that doesn't affect the value in this session
    set "PATH=%appdata%\Miniconda3;%appdata%\Miniconda3\Scripts;%PATH%"
)

:: Make sure conda is up to date
conda update conda --yes --quiet

However, the installer never succeeds. It works just fine on my local test setup. Any ideas?

davidebbo commented 8 years ago

Generally, everything runs in a sandbox environment which doesn't allow modifying machine global state. So most installers/PSIs can't be used. Instead, relevant files need to be just copied to a folder if they are able to run that way. But if the technology is such that it can't run without registry changes, or things in the Program Files folder, then it is problematic.

davidebbo commented 8 years ago

Reading your post in more details, if the main issue is the PATH, you should be able to set the right path manual using an XDT. Example here.

Korijn commented 7 years ago

This has been fixed; the miniconda installer has a few command line options now to prevent it from touching the registry.

laurence-hudson-tessella commented 7 years ago

@Korijn Could you confirm what version number (and arguments) you are using successfully with this? Not sure if there has been a regression at the miniconda end, but I can't quite get this to work.

Korijn commented 7 years ago

You can find some docs here: http://conda.pydata.org/docs/help/silent.html

New options were added later (which is why I closed this issue), but they weren't documented.

Luckily you can use the /? help flag on the command line to see an up-to-date overview of all the options.

Someone re-posted the output here: https://github.com/conda/conda/issues/1977#issuecomment-227797275

laurence-hudson-tessella commented 7 years ago

Yeah, those were the docs I was following, but miniconda.exe /AddToPath=0 /NoRegistry=1 /S /D=D:\home\site\tools\conda seems to run indefinately (without cpu use, have to force kill) in kudu (the other flags, i.e registerpython, dont have an impact either). I've tried lasted Miniconda3-latest-Windows-x86_64.exe & Miniconda3-4.1.11-Windows-x86_64.exe, but both seem to have the same behavior.

Korijn commented 7 years ago

That's unfortunate. Try inspecting the system's application logs?