Skip to content

Commit 7385230

Browse files
authored
Update CI to use Microsoft.PowerShell.PSResourceGet (#1408)
1 parent f18a42e commit 7385230

File tree

7 files changed

+19
-17
lines changed

7 files changed

+19
-17
lines changed

.ci/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ stages:
5151
- pwsh: |
5252
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
5353
Write-Verbose -Verbose "Install PSResourceGet to temp module path"
54-
Save-Module -Name PowerShellGet -MinimumVersion 3.0.18-beta18 -Path $modulePath -AllowPrerelease -Force
55-
displayName: Install PowerShellGet v3
54+
Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force
55+
displayName: Install Microsoft.PowerShell.PSResourceGet v3
5656
5757
- pwsh: |
5858
Get-ChildItem -Path $(Build.SourcesDirectory)/src/code -Recurse

.ci/ci_auto.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ stages:
5959
- pwsh: |
6060
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
6161
Write-Verbose -Verbose "Install PSResourceGet to temp module path"
62-
Save-Module -Name PowerShellGet -MinimumVersion 3.0.18-beta18 -Path $modulePath -AllowPrerelease -Force
63-
displayName: Install PowerShellGet v3
62+
Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force
63+
displayName: Install Microsoft.PowerShell.PSResourceGet v3
6464
6565
- pwsh: |
6666
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'

.ci/ci_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ stages:
4949
- pwsh: |
5050
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
5151
Write-Verbose -Verbose "Install PSResourceGet to temp module path"
52-
Save-Module -Name PowerShellGet -MinimumVersion 3.0.18-beta18 -Path $modulePath -AllowPrerelease -Force
53-
displayName: Install PowerShellGet v3
52+
Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force
53+
displayName: Install Microsoft.PowerShell.PSResourceGet v3
5454
5555
- pwsh: |
5656
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'

.ci/test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ jobs:
3737
3838
- ${{ parameters.powershellExecutable }}: |
3939
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
40-
Write-Verbose -Verbose "Install PSResourceGet to temp module path"
41-
Save-Module -Name PowerShellGet -MinimumVersion 3.0.18-beta18 -Path $modulePath -AllowPrerelease -Force
40+
Write-Verbose -Verbose "Install Microsoft.PowerShell.PSResourceGet to temp module path"
41+
Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force
4242
Write-Verbose -Verbose "Install Pester 4.X to temp module path"
4343
Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force
44-
displayName: Install PowerShellGetV3 and Pester
44+
displayName: Install Microsoft.PowerShell.PSResourceGet and Pester
4545
4646
- ${{ parameters.powershellExecutable }}: |
4747
$modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
@@ -58,7 +58,6 @@ jobs:
5858
$env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
5959
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
6060
Import-Module -Name (Join-Path -Path '${{ parameters.buildDirectory }}' -ChildPath 'buildtools.psd1') -Force
61-
#
6261
Invoke-ModuleTests -Type Functional
6362
env:
6463
MAPPED_GITHUB_PAT: $(github_pat)

.github/ISSUE_TEMPLATE/Bug_Report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ body:
1010
1111
For PowerShellGet v2 issues, please use [PowerShellGetv2 repo](https://github.com/PowerShell/PowerShellGetv2).
1212
13-
This repository is **ONLY** for PSResourceGet issues.
13+
This repository is **ONLY** for Microsoft.PowerShell.PSResourceGet issues.
1414
- type: checkboxes
1515
attributes:
1616
label: Prerequisites

buildtools.psm1

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the MIT License.
33

44
$ConfigurationFileName = 'package.config.json'
5-
Import-Module -Name PowerShellGet -MinimumVersion 3.0.18
5+
Import-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0
66

77
function Get-BuildConfiguration {
88
[CmdletBinding()]
@@ -109,16 +109,18 @@ function Install-ModulePackageForTest {
109109
$config = Get-BuildConfiguration
110110

111111
$localRepoName = 'packagebuild-local-repo'
112-
Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName to path: $PackagePath"
113-
Register-PSResourceRepository -Name $localRepoName -Uri $PackagePath -Trusted -Force
112+
$packagePathWithNupkg = Join-Path -Path $PackagePath -ChildPath "nupkg"
113+
Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName to path: $packagePathWithNupkg"
114+
Register-PSResourceRepository -Name $localRepoName -Uri $packagePathWithNupkg -Trusted -Force
114115

115116
$installationPath = $config.BuildOutputPath
116117
if ( !(Test-Path $installationPath)) {
117118
Write-Verbose -Verbose -Message "Creating module directory location for tests: $installationPath"
118119
$null = New-Item -Path $installationPath -ItemType Directory -Verbose
119120
}
121+
120122
Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath"
121-
Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false
123+
Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false -TrustRepository
122124

123125
Write-Verbose -Verbose -Message "Unregistering local package repo: $localRepoName"
124126
Unregister-PSResourceRepository -Name $localRepoName -Confirm:$false
@@ -139,7 +141,8 @@ function Invoke-ModuleTests {
139141
$excludeTag = 'ManualValidationOnly'
140142
$testResultFileName = 'result.pester.xml'
141143
$testPath = $config.TestPath
142-
$moduleToTest = Join-Path -Path $config.BuildOutputPath -ChildPath $config.ModuleName
144+
Write-Verbose -Verbose $config.ModuleName
145+
$moduleToTest = Join-Path -Path $config.BuildOutputPath -ChildPath "Microsoft.PowerShell.PSResourceGet"
143146
$command = "Import-Module -Name ${moduleToTest} -Force -Verbose; Set-Location -Path ${testPath}; Invoke-Pester -Path . -OutputFile ${testResultFileName} -Tags '${tags}' -ExcludeTag '${excludeTag}'"
144147
$pwshExePath = (Get-Process -Id $pid).Path
145148

test/PublishPSResourceTests/PublishPSResourceADOServer.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Describe "Test Publish-PSResource" -tags 'CI' {
9797

9898
Publish-PSResource -Path $script:PublishModuleBase -Repository $ADOPublicRepoName -Credential $correctPublicRepoCred -ErrorAction SilentlyContinue
9999

100-
$Error[0].FullyQualifiedErrorId | Should -be "400ApiKeyError,Microsoft.PowerShell.PSResourceGet.Cmdlets.PublishPSResource"
100+
$Error[0].FullyQualifiedErrorId | Should -be "401Error,Microsoft.PowerShell.PSResourceGet.Cmdlets.PublishPSResource"
101101
}
102102

103103
It "Should not publish module to ADO repository feed (private) when Credentials are incorrect" {

0 commit comments

Comments
 (0)