winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 32cee15877b937bb4feaad2685ff0cd2c6f3e536
parent 269c3c6bbaf967c9f5a6cb288b79812eec61773d
Author: Ryan <69221034+ryfu-msft@users.noreply.github.com>
Date:   Thu, 29 Aug 2024 16:58:56 -0400

Run Unpackaged Unit Tests with winget-installed PsExec (#4760)

Currently forked builds do not have the permission to access secure
files.

To workaround using PsExec from a secure file, we will use a stable
release of winget to install the latest PsTools and try invoking unit
tests from the PsExec executable that is installed as part of the zip
package.
Diffstat:
Mazure-pipelines.yml | 32++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/azure-pipelines.yml b/azure-pipelines.yml @@ -348,18 +348,30 @@ jobs: inputs: packageFeedSelector: 'nugetOrg' - - task: DownloadSecureFile@1 - name: PsExec - displayName: 'Download PsExec.exe' - inputs: - secureFile: 'PsExec.exe' + # TODO: Repair-WinGetPackageManager will fail because it tries to install x64 for an x86 build machine. + # Remove manual installation of VCLibs (x64) once this is fixed. + - powershell: | + if ("$(buildPlatform)" -eq "x86") { + iwr https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.appx + Add-AppxPackage Microsoft.VCLibs.x64.appx + } + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force + Install-Module Microsoft.WinGet.Client -Repository PSGallery -Force + Repair-WingetPackageManager -AllUsers -Latest + Install-WinGetPackage -Id Microsoft.Sysinternals.PsTools -Source winget + displayName: Install Sysinternals PsTools Using Winget + condition: succeededOrFailed() - - task: CmdLine@2 + - powershell: | + $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") + PsExec -accepteula -s -i $(buildOutDir)\AppInstallerCLITests\AppInstallerCLITests.exe -logto $(artifactsDir)\AICLI-Unpackaged-System.log -s -r junit -o $(artifactsDir)\TEST-AppInstallerCLI-Unpackaged-System.xml displayName: Run Unit Tests Unpackaged Under System Context - inputs: - script: | - $(PsExec.secureFilePath) -accepteula -s -i $(buildOutDir)\AppInstallerCLITests\AppInstallerCLITests.exe -logto $(artifactsDir)\AICLI-Unpackaged-System.log -s -r junit -o $(artifactsDir)\TEST-AppInstallerCLI-Unpackaged-System.xml - workingDirectory: '$(buildOutDir)\AppInstallerCLITests' + workingDirectory: '$(buildOutDir)\AppInstallerCLITests' + condition: succeededOrFailed() + + - powershell: | + Uninstall-WinGetPackage -Id Microsoft.Sysinternals.PsTools -Source winget + displayName: Clean up Sysinternals PsTools condition: succeededOrFailed() - task: PowerShell@2