Improve site extension installation robustness

- Fix errorlevel checking
- Allow nuget package on pre-releases
This commit is contained in:
Fred Park 2018-05-02 07:48:08 -07:00
Родитель c84f3b62b3
Коммит 5168320335
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3C4D545F457737EB
4 изменённых файлов: 44 добавлений и 19 удалений

Просмотреть файл

@ -47,13 +47,29 @@ test_script:
)
after_test:
- echo is pr %APPVEYOR_PULL_REQUEST_NUMBER% is commit tag %APPVEYOR_REPO_TAG% name %APPVEYOR_REPO_TAG_NAME% branch %APPVEYOR_REPO_BRANCH%
- ps: >-
if ($env:APPVEYOR_REPO_TAG -eq "true") {
$env:APPVEYOR_REPO_TAG_NAME -match "^([\d\.])+"
$env:BUILDVER_DOTTED = $matches[0]
if ($env:APPVEYOR_REPO_TAG_NAME -match "([a-z]+\d+)") {
$env:NUGET_PACKAGE_VERSION = $env:BUILDVER_DOTTED + "-" + $matches[1]
}
else {
$env:NUGET_PACKAGE_VERSION = $env:BUILDVER_DOTTED
}
}
else {
$env:NUGET_PACKAGE_VERSION = $null
$env:BUILDVER_DOTTED = "0.0.0"
}
- echo is pr %APPVEYOR_PULL_REQUEST_NUMBER% is commit tag %APPVEYOR_REPO_TAG% name %APPVEYOR_REPO_TAG_NAME% branch %APPVEYOR_REPO_BRANCH% nugetpkg %NUGET_PACKAGE_VERSION%
- IF "%APPVEYOR_REPO_TAG%"=="true" IF "%PYTHON_VERSION%"=="3.6" (
set UPLOAD_NUGET=1&
echo %APPVEYOR_REPO_TAG_NAME%> site-extension\\version.txt &
nuget pack site-extension\\BatchShipyard.nuspec -Version %APPVEYOR_REPO_TAG_NAME% &
nuget pack site-extension\\BatchShipyard.nuspec -Version %NUGET_PACKAGE_VERSION% &
7z l BatchShipyard.*.nupkg &
appveyor PushArtifact BatchShipyard.%APPVEYOR_REPO_TAG_NAME%.nupkg || set UPLOAD_NUGET=0)
appveyor PushArtifact BatchShipyard.%NUGET_PACKAGE_VERSION%.nupkg || set UPLOAD_NUGET=0)
- ps: >-
if (!($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null)) {
Write-Host "Build is from a PR, not creating binary"
@ -66,13 +82,11 @@ after_test:
if ($env:APPVEYOR_REPO_TAG -eq "true") {
$env:BATCH_SHIPYARD_CLI_ARITFACT = "batch-shipyard-" + $env:APPVEYOR_REPO_TAG_NAME + "-cli-win-amd64.exe"
$env:UPLOAD_PATH="releases/" + $env:APPVEYOR_REPO_TAG_NAME
$env:BUILDVER_DOTTED = $env:APPVEYOR_REPO_TAG_NAME
}
else {
if ($env:APPVEYOR_REPO_BRANCH -eq "master" -Or $env:APPVEYOR_REPO_BRANCH -eq "develop") {
$env:BATCH_SHIPYARD_CLI_ARITFACT = "batch-shipyard-" + $env:APPVEYOR_REPO_BRANCH + "-" + $env:APPVEYOR_BUILD_NUMBER + "-cli-win-amd64.exe"
$env:UPLOAD_PATH="builds/" + $env:APPVEYOR_REPO_BRANCH
$env:BUILDVER_DOTTED = [string]::Format("0.0.{0}",$env:APPVEYOR_BUILD_NUMBER)
}
else {
Write-Host "Invalid tag or branch $env:APPVEYOR_REPO_BRANCH to build binary"
@ -82,7 +96,7 @@ after_test:
$bvt0,$bvt1,$bvt2 = $env:BUILDVER_DOTTED.split('.')
$env:BUILDVER_TUPLE = [string]::Format("({0}, {1}, {2}, 0)",$bvt0,$bvt1,$bvt2)
$env:BUILDVER_TUPLE = [string]::Format("({0}, {1}, {2}, {3})",$bvt0,$bvt1,$bvt2,$env:APPVEYOR_BUILD_NUMBER)
$env:BRANCH_GITSHA1 = [string]::Format("{0}@{1}",$env:APPVEYOR_REPO_BRANCH,$env:APPVEYOR_REPO_COMMIT.Substring(0,7))

Просмотреть файл

@ -42,6 +42,7 @@ site extension nuget page can be found
![60-site-extension-step2-2.png](https://azurebatchshipyard.blob.core.windows.net/github/60-site-extension-step2-2.png)
You should select the latest version of Python 3.X x64 that is available.
You may have to search for it using the search box under the `Gallery` tab.
Click the `+` icon to install this site extension to your Azure Function App
environment.
@ -49,8 +50,9 @@ environment.
### Step 3: Install Batch Shipyard Site Extension
After Python 3.X x64 installs successfully, find the `Batch Shipyard`
site extension in the same `Gallery` area. Click the `+` icon to install the
Batch Shipyard site extension to your Azure Function app environment.
site extension in the same `Gallery` area. You may have to search for it
using the search box under the `Gallery` tab. Click the `+` icon to install
the Batch Shipyard site extension to your Azure Function app environment.
![60-site-extension-step3-0.png](https://azurebatchshipyard.blob.core.windows.net/github/60-site-extension-step3-0.png)

Просмотреть файл

@ -56,8 +56,8 @@ IF %ANACONDA% EQU 1 (
) ELSE (
echo Performing install for Python.
pip install --upgrade virtualenv
IF %ERRORLEVEL% NEQ 0 (
echo "pip install failed"
IF ERRORLEVEL 1 (
echo "pip install virtualenv failed"
exit /b 1
)
virtualenv -p %PYTHON% %VENVNAME%

Просмотреть файл

@ -12,7 +12,7 @@ popd
REM ensure git is in path
where git.exe
IF %ERRORLEVEL% NEQ 0 (
IF ERRORLEVEL 1 (
echo "git not found"
exit /b 1
)
@ -32,14 +32,21 @@ IF EXIST "%CLONEDIR%" (
pushd "%CLONEDIR%"
git fetch --tags
git checkout %SHIPYARDVER%
IF %ERRORLEVEL% NEQ 0 (
echo "Could not git fetch to tag %SHIPYARDVER% at %CLONEDIR%"
exit /b 1
IF ERRORLEVEL 1 (
REM fallback to git clone
echo "Could not git fetch and checkout to tag %SHIPYARDVER% at %CLONEDIR%"
cd ..
rd /s /q "%CLONEDIR%"
git clone --single-branch --branch %SHIPYARDVER% "https://github.com/Azure/batch-shipyard.git" "%CLONEDIR%"
IF ERRORLEVEL 1 (
echo "Could not git clone to tag %SHIPYARDVER% at %CLONEDIR%"
exit /b 1
)
)
popd
) ELSE (
git clone --branch %SHIPYARDVER% "https://github.com/Azure/batch-shipyard.git" "%CLONEDIR%"
IF %ERRORLEVEL% NEQ 0 (
git clone --single-branch --branch %SHIPYARDVER% "https://github.com/Azure/batch-shipyard.git" "%CLONEDIR%"
IF ERRORLEVEL 1 (
echo "Could not git clone to tag %SHIPYARDVER% at %CLONEDIR%"
exit /b 1
)
@ -53,18 +60,18 @@ type shipyard.cmd>> "%CLONEDIR%\shipyard.cmd"
REM install requirements
pushd "%CLONEDIR%"
"%PYTHON%" -m pip install --upgrade appdirs packaging six
IF %ERRORLEVEL% NEQ 0 (
IF ERRORLEVEL 1 (
echo "pip install pre-requisites failed"
exit /b 1
)
"%PYTHON%" -m pip uninstall -y azure-storage
"%PYTHON%" -m pip install --upgrade -r requirements.txt
IF %ERRORLEVEL% NEQ 0 (
IF ERRORLEVEL 1 (
echo "pip install requirements.txt failed"
exit /b 1
)
"%PYTHON%" -m pip install --upgrade --no-deps -r req_nodeps.txt
IF %ERRORLEVEL% NEQ 0 (
IF ERRORLEVEL 1 (
echo "pip install req_nodeps.txt failed"
exit /b 1
)
@ -80,3 +87,5 @@ IF NOT EXIST "%FUTURIZE%" (
pushd "%PYTHONHOME%\Lib\site-packages\isodate"
"%FUTURIZE%" -0 -w -n .
popd
echo "Batch Shipyard site extension install completed."