diff --git a/.azure-pipelines/util/smoke-test-steps.yml b/.azure-pipelines/util/smoke-test-steps.yml index 8575cc76749d..a3d3f007ec1d 100644 --- a/.azure-pipelines/util/smoke-test-steps.yml +++ b/.azure-pipelines/util/smoke-test-steps.yml @@ -78,13 +78,6 @@ jobs: Write-Host "List artifacts..." Get-ChildItem "$(Pipeline.Workspace)\\LocalRepo\\" - - task: NuGetCommand@2 - condition: and(succeeded(), eq('${{ parameters.psVersion }}', '5.1.14')) - displayName: 'Download ThreadJob .nupkg File for PowerShell 5.1.14' - inputs: - command: custom - arguments: 'install ThreadJob -directdownload -packagesavemode nupkg -source https://www.powershellgallery.com/api/v2 -OutputDirectory packages' - - task: NuGetCommand@2 condition: and(succeeded(), eq(variables['GalleryName'], 'LocalRepo')) displayName: 'Download Previous Az .nupkg Files' diff --git a/tools/Test/SmokeTest/InstallAzModules.ps1 b/tools/Test/SmokeTest/InstallAzModules.ps1 index f82a55990424..549ce30b4095 100644 --- a/tools/Test/SmokeTest/InstallAzModules.ps1 +++ b/tools/Test/SmokeTest/InstallAzModules.ps1 @@ -42,13 +42,6 @@ Register-Gallery $gallery $localRepoLocation Write-Host "Installing Az..." Install-Module -Name Az -Repository $gallery -Scope CurrentUser -AllowClobber -Force - -$file = Get-ChildItem $localRepoLocation | Where-Object {$_.Name -like "ThreadJob*"} -$installedModule = Get-Module -ListAVailable -Name ThreadJob -if ($file -ne $null -and $installedModule -eq $null) { - Write-Host "Install ThreadJob..." - Install-Module -Name ThreadJob -Repository $gallery -Scope CurrentUser -AllowClobber -Force -} # Check version Import-Module -MinimumVersion '2.6.0' -Name 'Az' -Force @@ -61,4 +54,4 @@ Get-Module -Name Az.* -ListAvailable if (!$azVersion) { throw "No Az is installed" -} +} \ No newline at end of file diff --git a/tools/Test/SmokeTest/PrepareRequiredPowershell.ps1 b/tools/Test/SmokeTest/PrepareRequiredPowershell.ps1 index 98ecc83958c6..3b16bebe23ba 100644 --- a/tools/Test/SmokeTest/PrepareRequiredPowershell.ps1 +++ b/tools/Test/SmokeTest/PrepareRequiredPowershell.ps1 @@ -56,6 +56,22 @@ function Install-PowerShell { dotnet tool run pwsh -c $command } } + + #Install ThreadJob for Windows PowerShell + if ($requiredPsVersion -eq $windowsPowershellVersion) { + Write-Host "Install ThreadJob for Windows PowerShell." + $installedModule = Get-Module -ListAVailable -Name ThreadJob + if ($installedModule -eq $null) { + try { + Install-Module -Name ThreadJob -Repository PSGallery -Scope CurrentUser -AllowClobber -Force + Write-Host "Install ThreadJob successfully." + } + catch { + Write-Host "Fail to install ThreadJob from PSGallery." + Write-Host $_ + } + } + } } # Image "macOS-10.15" preinstalled Az modules