Skip to content

Commit 3b9ad33

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
change where modules are installed from depending on GitHub or ADO
1 parent 99ebf51 commit 3b9ad33

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

build.ps1

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,23 +352,31 @@ if (!$Clippy -and !$SkipBuild) {
352352
if ($Test) {
353353
$failed = $false
354354

355-
if ($null -eq (Get-PSResourceRepository -Name CFS -ErrorAction Ignore)) {
356-
"Registering CFS repository"
357-
Register-PSResourceRepository -uri 'https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2' -Name CFS -Trusted
355+
$usingADO = ($null -ne $env:TF_BUILD)
356+
357+
if ($usingADO) {
358+
$repository = 'CFS'
359+
if ($null -eq (Get-PSResourceRepository -Name CFS -ErrorAction Ignore)) {
360+
"Registering CFS repository"
361+
Register-PSResourceRepository -uri 'https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2' -Name CFS -Trusted
362+
}
363+
}
364+
else {
365+
$repository = 'PSGallery'
358366
}
359367

360368
if ($IsWindows) {
361369
# PSDesiredStateConfiguration module is needed for Microsoft.Windows/WindowsPowerShell adapter
362370
$FullyQualifiedName = @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="2.0.7"}
363371
if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName))
364372
{ "Installing module PSDesiredStateConfiguration 2.0.7"
365-
Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository CFS -Verbose
373+
Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository $repository
366374
}
367375
}
368376

369377
if (-not(Get-Module -ListAvailable -Name Pester))
370378
{ "Installing module Pester"
371-
Install-PSResource Pester -WarningAction Ignore -Repository CFS -Verbose
379+
Install-PSResource Pester -WarningAction Ignore -Repository $repository
372380
}
373381

374382
foreach ($project in $projects) {

0 commit comments

Comments
 (0)