Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 14 additions & 54 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ jobs:


- script: |
set /p ARCH=$(Platform)
set /p CLI_VERSION=<$(System.ArtifactsDirectory)/metadata/version
set ARCH=$(Platform)
set CLI_VERSION=<$(System.ArtifactsDirectory)/metadata/version
set

build_scripts/windows/scripts/build.cmd
Expand All @@ -216,16 +216,22 @@ jobs:
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM'
inputs:
BuildDropPath: 'build_scripts/windows/out/$(Platform)'
BuildDropPath: 'build_scripts/windows/out/'

- task: PublishPipelineArtifact@0
displayName: 'Publish Artifact: MSI'
inputs:
TargetPath: 'build_scripts/windows/out/$(Platform)'
ArtifactName: msi
TargetPath: 'build_scripts/windows/out/'
ArtifactName: msi-$(Platform)

- job: TestWindowsMSI
displayName: Test Windows MSI
strategy:
matrix:
x86:
Platform: x86
x64:
Platform: x64

dependsOn: BuildWindowsMSI
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
Expand All @@ -242,56 +248,10 @@ jobs:
displayName: 'Download Build Artifacts'
inputs:
TargetPath: '$(Build.ArtifactStagingDirectory)/msi'
artifactName: msi

- task: PowerShell@2
displayName: Install and Load x86 CLI
inputs:
targetType: inline
script: |
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
# Start another Powershell process as Admin and execute this script again
$arguments = "& '" +$myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
# Stop if the PowerShell is not run as Admin
Break
}
# The following are executed by elevated PowerShell
az --version

$InstallArgs = @(
"/i"
"`"$env:SYSTEM_ARTIFACTSDIRECTORY\msi\x86\Microsoft Azure CLI.msi`""
"/q"
"/norestart"
"/l*v"
".\install_logs.txt"
)
$pre_installed_version=az version --query '\"azure-cli\"' -o tsv
$to_be_installed_version=Get-Content $(System.ArtifactsDirectory)/metadata/version
if ($pre_installed_version -eq $to_be_installed_version){
# See https://docs.microsoft.com/windows/win32/msi/reinstallmode about options of REINSTALLMODE
$reinstall_option="REINSTALL=ALL REINSTALLMODE=emus"
$InstallArgs += $reinstall_option
}
Start-Process "msiexec.exe" -ArgumentList $InstallArgs -Wait -NoNewWindow
$install_time=Measure-Command {Start-Process "msiexec.exe" -ArgumentList $InstallArgs -Wait -NoNewWindow} | select -expand TotalSeconds
$installed_version=az version --query '\"azure-cli\"' -o tsv
if ($installed_version -ne $to_be_installed_version){
echo "The MSI failed to install."
Exit 1
}
echo 'Install time(seconds):' $install_time
az --version
# Test bundled pip with extension installation
az extension add -n rdbms-connect
az self-test

Get-Content .\install_logs.txt
artifactName: msi-$(Platform)

- task: PowerShell@2
# Test install (upgrade of x86) of x64 MSI as well.
displayName: Install and Load x64 CLI
displayName: Install and Load CLI
inputs:
targetType: inline
script: |
Expand All @@ -307,7 +267,7 @@ jobs:

$InstallArgs = @(
"/i"
"`"$env:SYSTEM_ARTIFACTSDIRECTORY\msi\x64\Microsoft Azure CLI.msi`""
"`"$env:SYSTEM_ARTIFACTSDIRECTORY\msi\Microsoft Azure CLI.msi`""
"/q"
"/norestart"
"/l*v"
Expand Down
20 changes: 10 additions & 10 deletions build_scripts/windows/azure-cli.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@
</PropertyGroup>
<!-- Local WiX -->
<PropertyGroup>
<LocalWixRoot>artifacts\$(Platform)\wix</LocalWixRoot>
<LocalWixRoot>artifacts\wix</LocalWixRoot>
<WixToolPath>$(LocalWixRoot)</WixToolPath>
<WixTargetsPath Condition="Exists('$(WixToolPath)\Wix.targets')">$(WixToolPath)\Wix.targets</WixTargetsPath>
<WixTasksPath Condition="Exists('$(WixToolPath)\wixtasks.dll')">wixtasks.dll</WixTasksPath>
<AzureCliSource>artifacts\$(Platform)\cli</AzureCliSource>
<AzureCliSource>artifacts\cli</AzureCliSource>
<LinkerAdditionalOptions>-fv</LinkerAdditionalOptions>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>out\$(Platform)\$(Configuration)\</OutputPath>
<IntermediateOutputPath>out\obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
<OutputPath>out\$(Configuration)\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;AzureCliSource=$(AzureCliSource)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>out\$(Platform)\</OutputPath>
<IntermediateOutputPath>out\obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
<OutputPath>out\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>AzureCliSource=$(AzureCliSource)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<OutputPath>out\$(Platform)\$(Configuration)\</OutputPath>
<IntermediateOutputPath>out\obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
<OutputPath>out\$(Configuration)\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;AzureCliSource=$(AzureCliSource)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>out\$(Platform)\</OutputPath>
<IntermediateOutputPath>out\obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
<OutputPath>out\</OutputPath>
<IntermediateOutputPath>out\obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>AzureCliSource=$(AzureCliSource)</DefineConstants>
</PropertyGroup>
<ItemGroup>
Expand Down
5 changes: 1 addition & 4 deletions build_scripts/windows/scripts/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ set OUTPUT_DIR=%~dp0..\out
if exist %OUTPUT_DIR% rmdir /s /q %OUTPUT_DIR%
mkdir %OUTPUT_DIR%

set ARTIFACTS_DIR=%~dp0..\artifacts\%ARCH%
set ARTIFACTS_DIR=%~dp0..\artifacts
mkdir %ARTIFACTS_DIR%
set TEMP_SCRATCH_FOLDER=%ARTIFACTS_DIR%\cli_scratch
set BUILDING_DIR=%ARTIFACTS_DIR%\cli
Expand Down Expand Up @@ -87,9 +87,6 @@ if not exist %WIX_DIR% (
popd
)

REM Use only downloaded python and ignore machine state
set PYTHONHOME=%PYTHON_DIR%

REM ensure Python is available
if exist %PYTHON_DIR% (
echo Using existing Python at %PYTHON_DIR%
Expand Down