Make '-CI' not depend on '-PSModuleRestore' in 'Start-PSBuild' (#6450)

This commit is contained in:
Dongbo Wang 2018-03-21 14:24:44 -07:00 committed by GitHub
parent 9df8ea58e9
commit c33e1ff828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -635,9 +635,13 @@ Fix steps:
# download modules from powershell gallery.
# - PowerShellGet, PackageManagement, Microsoft.PowerShell.Archive
if($PSModuleRestore)
{
Restore-PSModuleToBuild -PublishPath $publishPath -CI:$CI.IsPresent
if ($PSModuleRestore) {
Restore-PSModuleToBuild -PublishPath $publishPath
}
# Restore the Pester module
if ($CI) {
Restore-PSPester -Destination (Join-Path $publishPath "Modules")
}
}
@ -646,22 +650,12 @@ function Restore-PSModuleToBuild
param(
[Parameter(Mandatory)]
[string]
$PublishPath,
[Switch]
$CI
$PublishPath
)
Write-Log "Restore PowerShell modules to $publishPath"
$modulesDir = Join-Path -Path $publishPath -ChildPath "Modules"
Copy-PSGalleryModules -Destination $modulesDir
if($CI.IsPresent)
{
# take the latest version of pester and install it so it may be used
Restore-PSPester -Destination $modulesDir
}
}
function Restore-PSPester