Skip to content

Commit 8c686f6

Browse files
committed
Merge branch 'master' of https://github.com/powershell/PSResourceGet into concurrentInstall
2 parents d40c9a8 + e256d8b commit 8c686f6

5 files changed

Lines changed: 128 additions & 22 deletions

File tree

.pipelines/PSResourceGet-Official.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,55 +209,76 @@ extends:
209209
type: windows
210210
steps:
211211
- checkout: self
212+
env:
213+
ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
212214

213215
- pwsh: |
214216
if (-not (Test-Path $(repoRoot)/.config/tsaoptions.json)) {
215217
Get-ChildItem $(Build.SourcesDirectory) -recurse -ErrorAction SilentlyContinue
216218
throw "tsaoptions.json does not exist under $(repoRoot)/.config"
217219
}
218220
displayName: Test if tsaoptions.json exists
221+
env:
222+
ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
219223
220224
- task: DownloadPipelineArtifact@2
221225
displayName: 'Download build files'
222226
inputs:
223227
targetPath: $(signOutPath)
224228
artifact: drop_stagebuild_jobbuild
229+
env:
230+
ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
225231

226232
- pwsh: |
227233
Set-Location "$(signOutPath)"
228234
Write-Host "Contents of signOutPath:"
229235
Get-ChildItem $(signOutPath) -Recurse
230236
displayName: Capture artifacts directory structure
237+
env:
238+
ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
231239
232240
- pwsh: |
233241
# This need to be done before set-location so the module from PSHome is loaded
234242
Import-Module -Name Microsoft.PowerShell.PSResourceGet -Force
235243
236244
Set-Location "$(signOutPath)\Microsoft.PowerShell.PSResourceGet"
237-
$null = New-Item -ItemType Directory -Path "$(signOutPath)\PublishedNupkg" -Force
245+
$publishPath = Join-Path $(signOutPath) -ChildPath 'PublishedNupkg'
238246
239-
Register-PSResourceRepository -Name 'localRepo' -Uri "$(signOutPath)\PublishedNupkg"
247+
$null = New-Item -ItemType Directory -Path $publishPath -Force
248+
249+
Register-PSResourceRepository -Name 'localRepo' -Uri $publishPath
240250
Publish-PSResource -Path "$(signOutPath)\Microsoft.PowerShell.PSResourceGet" -Repository 'localRepo' -Verbose
251+
Write-Output "##vso[task.setvariable variable=publishPath]$publishPath"
241252
displayName: Create nupkg for publishing
253+
env:
254+
ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
255+
256+
- pwsh: |
257+
Set-Location '$(publishPath)'
258+
Write-Host "Contents of signOutPath:"
259+
Get-ChildItem '$(publishPath)' -Recurse
260+
displayName: Find Nupkg Pre Signing
261+
env:
262+
ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
242263
243264
- task: onebranch.pipeline.signing@1
244265
displayName: Sign nupkg
245266
inputs:
246267
command: 'sign'
247268
signing_profile: external_distribution
248269
files_to_sign: '**\*.nupkg'
249-
search_root: "$(signOutPath)\PublishedNupkg"
270+
search_root: '$(publishPath)'
250271

251272
- pwsh: |
252-
Set-Location "$(signOutPath)\PublishedNupkg"
273+
Set-Location '$(publishPath)'
253274
Write-Host "Contents of signOutPath:"
254-
Get-ChildItem "$(signOutPath)" -Recurse
255-
displayName: Find Nupkg
275+
Get-ChildItem '$(publishPath)' -Recurse
276+
displayName: Find Nupkg Post Signing
256277
257278
- task: CopyFiles@2
258279
displayName: "Copy nupkg to ob_outputDirectory - '$(ob_outputDirectory)'"
259280
inputs:
260-
Contents: $(signOutPath)\PublishedNupkg\Microsoft.PowerShell.PSResourceGet.*.nupkg
281+
Contents: $(publishPath)\Microsoft.PowerShell.PSResourceGet.*.nupkg
261282
TargetFolder: $(ob_outputDirectory)
262283

263284
- pwsh: |

CHANGELOG/1.2.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 1.2 Changelog
2+
3+
## [1.2.0](https://github.com/PowerShell/PSResourceGet/compare/v1.2.0-rc3...v1.2.0) - 2026-03-10
4+

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "8.0.417"
3+
"version": "8.0.419"
44
}
55
}

src/Microsoft.PowerShell.PSResourceGet.psd1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
'usres')
5151
PrivateData = @{
5252
PSData = @{
53-
Prerelease = 'rc3'
53+
# Prerelease = ''
5454
Tags = @('PackageManagement',
5555
'PSEdition_Desktop',
5656
'PSEdition_Core',
@@ -60,6 +60,8 @@
6060
ProjectUri = 'https://go.microsoft.com/fwlink/?LinkId=828955'
6161
LicenseUri = 'https://go.microsoft.com/fwlink/?LinkId=829061'
6262
ReleaseNotes = @'
63+
## 1.2.0
64+
6365
## 1.2.0-rc3
6466
6567
## Bug fix

test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1

Lines changed: 92 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
128128

129129
It "find multiple resources from all repositories where it exists where package Name contains wildcard (without -Repository specified)" {
130130
$res = Find-PSResource -Name "test_module*" -ErrorVariable err -ErrorAction SilentlyContinue
131-
$res | Should -HaveCount 12
131+
$res.Count | Should -BeGreaterOrEqual 1
132132
$err | Should -HaveCount 0
133133

134134
$pkgFoundinLocalRepo = $false
@@ -309,7 +309,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
309309
# Package with Tag "" exists in the following repositories: PSGallery, NuGetGallery, and localRepo
310310
$res = Find-PSResource -Tag $tag1 -ErrorVariable err -ErrorAction SilentlyContinue
311311
$err | Should -HaveCount 0
312-
$res.Count | Should -BeGreaterOrEqual 5
312+
$res.Count | Should -BeGreaterOrEqual 1
313313

314314
$pkg1 = $res[0]
315315
$pkg1.Name | Should -Be $testModuleName
@@ -338,7 +338,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
338338
# Package with tag "Tag-Required-Script1-2.5" exists in the following repositories: PSGallery, NuGetGallery
339339
$res = Find-PSResource -Tag $tag2 -ErrorVariable err -ErrorAction SilentlyContinue
340340
$err | Should -HaveCount 0
341-
$res.Count | Should -BeGreaterOrEqual 3
341+
$res.Count | Should -BeGreaterOrEqual 1
342342

343343
$pkg1 = $res[0]
344344
$pkg1.Name | Should -Be "test_script"
@@ -379,7 +379,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
379379
$err | Should -HaveCount 1
380380
$err[0].FullyQualifiedErrorId | Should -BeExactly "WildcardsUnsupportedForTag,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
381381

382-
$res.Count | Should -BeGreaterOrEqual 3
382+
$res.Count | Should -BeGreaterOrEqual 1
383383
$pkg1 = $res[0]
384384
$pkg1.Name | Should -Be "test_script"
385385
$pkg1.Repository | Should -Be $PSGalleryName
@@ -397,7 +397,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
397397
# Package with Tag "CommandsAndResource" exists in the following repositories: PSGallery, NuGetGallery, localRepo
398398
$res = Find-PSResource -Tag $tag1 -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue
399399
$err | Should -HaveCount 0
400-
$res.Count | Should -BeGreaterOrEqual 4
400+
$res.Count | Should -BeGreaterOrEqual 1
401401

402402
# Note Find-PSResource -Tag returns package Ids in desc order
403403
$pkg1 = $res[0]
@@ -431,7 +431,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
431431

432432
It "find resource from single specific repository (-Repository with single non-wildcard value)" {
433433
$res = Find-PSResource -Tag $tag2 -Repository $PSGalleryName
434-
$res.Count | Should -BeGreaterOrEqual 2
434+
$res.Count | Should -BeGreaterOrEqual 1
435435
$pkg1 = $res[0]
436436
$pkg1.Name | Should -Be "test_script"
437437
$pkg1.Repository | Should -Be $PSGalleryName
@@ -450,7 +450,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
450450

451451
It "find resource from all repositories where it exists (-Repository with multiple non-wildcard values)" {
452452
$res = Find-PSResource -Tag $tag2 -Repository $PSGalleryName,$NuGetGalleryName
453-
$res.Count | Should -BeGreaterOrEqual 3
453+
$res.Count | Should -BeGreaterOrEqual 1
454454

455455
$pkg1 = $res[0]
456456
$pkg1.Name | Should -Be "test_script"
@@ -469,7 +469,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
469469
# Package with Tag "Tag-TestMyLocalScript-1.0.0.0" exists in the following repositories: PSGallery
470470
$tagForPkgOnPSGallery = "Tag-TestMyLocalScript-1.0.0.0"
471471
$res = Find-PSResource -Tag $tagForPkgOnPSGallery -Repository $PSGalleryName,$NuGetGalleryName -ErrorVariable err -ErrorAction SilentlyContinue
472-
$res.Count | Should -BeGreaterOrEqual 2
472+
$res.Count | Should -BeGreaterOrEqual 1
473473
$err | Should -HaveCount 1
474474

475475
$pkg1 = $res[0]
@@ -488,7 +488,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
488488
# $cmdNameToSearch = "Get-TargetResource"
489489
$res = Find-PSResource -CommandName $cmdName -ErrorVariable err -ErrorAction SilentlyContinue
490490
$err | Should -HaveCount 0
491-
$res.Count | Should -BeGreaterOrEqual 9
491+
$res.Count | Should -BeGreaterOrEqual 1
492492
$pkgFoundFromLocalRepo = $false
493493
$pkgFoundFromPSGallery = $false
494494

@@ -531,6 +531,60 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
531531
$err[0].FullyQualifiedErrorId | Should -BeExactly "WildcardsUnsupportedForCommandNameorDSCResourceName,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
532532
}
533533

534+
It "not find resource and discard CommandName entry containing wildcard, but search for other non-wildcard CommandName entries (without -Repository specified)" {
535+
$res = Find-PSResource -CommandName $cmdName,"myCommandName*" -ErrorVariable err -ErrorAction SilentlyContinue
536+
$err | Should -HaveCount 1
537+
$err[0].FullyQualifiedErrorId | Should -BeExactly "WildcardsUnsupportedForCommandNameorDSCResourceName,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
538+
539+
$res.Count | Should -BeGreaterOrEqual 1
540+
$pkgFoundFromLocalRepo = $false
541+
$pkgFoundFromPSGallery = $false
542+
543+
foreach ($pkg in $res)
544+
{
545+
if ($pkg.ParentResource.Repository -eq $localRepoName)
546+
{
547+
$pkgFoundFromLocalRepo = $true
548+
}
549+
elseif ($pkg.ParentResource.Repository -eq $PSGalleryName)
550+
{
551+
$pkgFoundFromPSGallery = $true
552+
}
553+
}
554+
555+
$pkg.Names | Should -Be $cmdName
556+
$pkg.ParentResource.Includes.Command | Should -Contain $cmdName
557+
$pkgFoundFromLocalRepo | Should -BeTrue
558+
$pkgFoundFromPSGallery | Should -BeTrue
559+
}
560+
561+
It "find resources from all pattern matching repositories where it exists (-Repository with wildcard)" {
562+
# Package with CommandName "Get-TargetResource" exists in the following repositories: PSGallery, localRepo
563+
$res = Find-PSResource -CommandName $cmdName -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue
564+
$err | Should -HaveCount 0
565+
$res.Count | Should -BeGreaterOrEqual 1
566+
567+
$pkgFoundFromLocalRepo = $false
568+
$pkgFoundFromPSGallery = $false
569+
570+
foreach ($pkg in $res)
571+
{
572+
if ($pkg.ParentResource.Repository -eq $localRepoName)
573+
{
574+
$pkgFoundFromLocalRepo = $true
575+
}
576+
elseif ($pkg.ParentResource.Repository -eq $PSGalleryName)
577+
{
578+
$pkgFoundFromPSGallery = $true
579+
}
580+
}
581+
582+
$pkg.Names | Should -Be $cmdName
583+
$pkg.ParentResource.Includes.Command | Should -Contain $cmdName
584+
$pkgFoundFromLocalRepo | Should -BeFalse
585+
$pkgFoundFromPSGallery | Should -BeTrue
586+
}
587+
534588
It "should not allow for repository name with wildcard and non-wildcard command name specified in same command run" {
535589
{Find-PSResource -CommandName $cmdName -Repository "*Gallery",$localRepoName} | Should -Throw -ErrorId "RepositoryNamesWithWildcardsAndNonWildcardUnsupported,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
536590
}
@@ -563,6 +617,31 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
563617
$err[0].FullyQualifiedErrorId | Should -BeExactly "FindCmdOrDSCNamesPackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
564618
}
565619

620+
It "find resource given CommandName from all repositories where it exists (-Repository with multiple non-wildcard values)" {
621+
$res = Find-PSResource -CommandName $cmdName -Repository $PSGalleryName,$localRepoName
622+
$res.Count | Should -BeGreaterOrEqual 1
623+
624+
$pkgFoundFromLocalRepo = $false
625+
$pkgFoundFromPSGallery = $false
626+
627+
foreach ($pkg in $res)
628+
{
629+
if ($pkg.ParentResource.Repository -eq $localRepoName)
630+
{
631+
$pkgFoundFromLocalRepo = $true
632+
}
633+
elseif ($pkg.ParentResource.Repository -eq $PSGalleryName)
634+
{
635+
$pkgFoundFromPSGallery = $true
636+
}
637+
}
638+
639+
$pkg.Names | Should -Be $cmdName
640+
$pkg.ParentResource.Includes.Command | Should -Contain $cmdName
641+
$pkgFoundFromLocalRepo | Should -BeTrue
642+
$pkgFoundFromPSGallery | Should -BeTrue
643+
}
644+
566645
It "find resource given CommandName from all repositories where it exists and write errors for those it does not exist from (-Repository with multiple non-wildcard values)" {
567646
# Package with Command "Get-MyCommand" exists in the following repositories: localRepo
568647
$res = Find-PSResource -CommandName $cmdName2 -Repository $PSGalleryName,$localRepoName -ErrorVariable err -ErrorAction SilentlyContinue
@@ -629,7 +708,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
629708
It "find resource that has DSCResourceName specified from all repositories where it exists and not write errors where it does not exist (without -Repository specified)" {
630709
$res = Find-PSResource -DscResourceName $dscName -ErrorVariable err -ErrorAction SilentlyContinue
631710
$err | Should -HaveCount 0
632-
$res.Count | Should -BeGreaterOrEqual 2
711+
$res.Count | Should -BeGreaterOrEqual 1
633712
$pkgFoundFromLocalRepo = $false
634713
$pkgFoundFromPSGallery = $false
635714

@@ -677,7 +756,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
677756
$err | Should -HaveCount 1
678757
$err[0].FullyQualifiedErrorId | Should -BeExactly "WildcardsUnsupportedForCommandNameorDSCResourceName,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
679758

680-
$res.Count | Should -BeGreaterOrEqual 2
759+
$res.Count | Should -BeGreaterOrEqual 1
681760
$pkgFoundFromLocalRepo = $false
682761
$pkgFoundFromPSGallery = $false
683762

@@ -703,7 +782,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
703782
# Package with DSCResourceName "SystemLocale" exists in the following repositories: PSGallery, localRepo
704783
$res = Find-PSResource -DscResourceName $dscName -Repository "*Gallery" -ErrorVariable err -ErrorAction SilentlyContinue
705784
$err | Should -HaveCount 0
706-
$res.Count | Should -BeGreaterOrEqual 2
785+
$res.Count | Should -BeGreaterOrEqual 1
707786

708787
$pkgFoundFromLocalRepo = $false
709788
$pkgFoundFromPSGallery = $false
@@ -761,7 +840,7 @@ Describe 'Test Find-PSResource for searching and looping through repositories' -
761840

762841
It "find resource given DSCResourceName from all repositories where it exists (-Repository with multiple non-wildcard values)" {
763842
$res = Find-PSResource -DscResourceName $dscName -Repository $PSGalleryName,$localRepoName
764-
$res.Count | Should -BeGreaterOrEqual 3
843+
$res.Count | Should -BeGreaterOrEqual 1
765844

766845
$pkgFoundFromLocalRepo = $false
767846
$pkgFoundFromPSGallery = $false

0 commit comments

Comments
 (0)