Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .ci/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ stages:
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release -BuildFramework 'net472'
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release -BuildFramework 'net10.0'
displayName: Build Module

- pwsh: |
Expand Down Expand Up @@ -124,13 +124,6 @@ stages:
displayName: PowerShell Core on Windows
imageName: windows-latest

- template: test.yml
parameters:
jobName: TestPkgWinPS
displayName: Windows PowerShell on Windows
imageName: windows-latest
powershellExecutable: powershell

- template: test.yml
parameters:
jobName: TestPkgUbuntu
Expand Down
56 changes: 25 additions & 31 deletions .ci/ci_auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ stages:

steps:

- task: UseDotNet@2
inputs:
useGlobalJson: true

- pwsh: |
Get-ChildItem -Path env:
displayName: Capture environment for build
Expand Down Expand Up @@ -68,8 +72,8 @@ stages:
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
# Build for net472 framework
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release -BuildFramework 'net472'
# Build for net10.0 framework
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release -BuildFramework 'net10.0'
displayName: Build module

- pwsh: |
Expand Down Expand Up @@ -104,17 +108,17 @@ stages:
$null = New-Item -Path $thirdPartySignSrcPath -ItemType Directory -Verbose
}

# Net472 directory
$net472Path = Join-Path -Path $thirdPartySignSrcPath -ChildPath "net472"
if (! (Test-Path -Path $net472Path)) {
$null = New-Item -Path $net472Path -ItemType Directory -Verbose
# dependency directory
$depsPath = Join-Path -Path $thirdPartySignSrcPath -ChildPath "dependencies"
if (! (Test-Path -Path $depsPath)) {
$null = New-Item -Path $depsPath -ItemType Directory -Verbose
}
Get-ChildItem -Path (Join-Path -Path $srcPath -ChildPath "net472") -Filter '*.dll' | Foreach-Object {
if ($_.Name -ne 'PSResourceGet.dll') {
Get-ChildItem -Path (Join-Path -Path $srcPath -ChildPath "dependencies") -Filter '*.dll' | Foreach-Object {
if ($_.Name -ne 'Microsoft.PowerShell.PSResourceGet.dll') {
$sig = Get-AuthenticodeSignature -FilePath $_.FullName
if ($sig.Status -ne 'Valid' -or $sig.SignerCertificate.Subject -notlike '*Microsoft*' -or $sig.SignerCertificate.Issuer -notlike '*Microsoft Code Signing PCA*') {
# Copy for third party signing
Copy-Item -Path $_.FullName -Dest $net472Path -Force -Verbose
Copy-Item -Path $_.FullName -Dest $depsPath -Force -Verbose
}
}
}
Expand Down Expand Up @@ -160,17 +164,17 @@ stages:
# Copy LICENSE
Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "LICENSE") -Dest $signOutPath

# Net472 directory
$net472SignedOutPath = Join-Path -Path $signOutPath -ChildPath "net472"
if (! (Test-Path -Path $net472SignedOutPath)) {
$null = New-Item -Path $net472SignedOutPath -ItemType Directory -Verbose
# dependency directory
$depsSignedOutPath = Join-Path -Path $signOutPath -ChildPath "dependencies"
if (! (Test-Path -Path $depsSignedOutPath)) {
$null = New-Item -Path $depsSignedOutPath -ItemType Directory -Verbose
}
Get-ChildItem -Path (Join-Path -Path $srcPath -ChildPath "net472") -Filter '*.dll' | Foreach-Object {
if ($_.Name -ne 'PSResourceGet.dll') {
Get-ChildItem -Path (Join-Path -Path $srcPath -ChildPath "dependencies") -Filter '*.dll' | Foreach-Object {
if ($_.Name -ne 'Microsoft.PowerShell.PSResourceGet.dll') {
$sig = Get-AuthenticodeSignature -FilePath $_.FullName
if ($sig.Status -eq 'Valid' -and ($sig.SignerCertificate.Subject -like '*Microsoft*' -and $sig.SignerCertificate.Issuer -like '*Microsoft Code Signing PCA*')) {
# Copy already signed files directly to output
Copy-Item -Path $_.FullName -Dest $net472SignedOutPath -Force -Verbose
Copy-Item -Path $_.FullName -Dest $depsSignedOutPath -Force -Verbose
}
}
}
Expand All @@ -190,14 +194,11 @@ stages:
if (! (Test-Path -Path $createdSignSrcPath)) {
$null = New-Item -Path $createdSignSrcPath -ItemType Directory -Verbose
}
Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "PSResourceGet.psd1") -Dest $createdSignSrcPath -Force -Verbose
Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "Microsoft.PowerShell.PSResourceGet.psd1") -Dest $createdSignSrcPath -Force -Verbose
Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "Microsoft.PowerShell.PSResourceGet.psm1") -Dest $createdSignSrcPath -Force -Verbose
Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "PSGet.Format.ps1xml") -Dest $createdSignSrcPath -Force -Verbose

$net472Path = Join-Path -Path $createdSignSrcPath -ChildPath "net472"
if (! (Test-Path -Path $net472Path)) {
$null = New-Item -Path $net472Path -ItemType Directory -Verbose
}
Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "net472\PSResourceGet.dll") -Dest $net472Path -Force -Verbose
Copy-Item -Path (Join-Path -Path $srcPath -ChildPath "Microsoft.PowerShell.PSResourceGet.dll") -Dest $createdSignSrcPath -Force -Verbose

# Set signing src path variable
$vstsCommandString = "vso[task.setvariable variable=signSrcPath]${createdSignSrcPath}"
Expand Down Expand Up @@ -294,11 +295,11 @@ stages:
- checkout: ComplianceRepo
clean: true
- download: current
artifact: 'PSResourceGet'
artifact: 'Microsoft.PowerShell.PSResourceGet'
- template: assembly-module-compliance.yml@ComplianceRepo
parameters:
# binskim
AnalyzeTarget: '$(Pipeline.Workspace)/PSResourceGet/net472/PSResourceGet.dll'
AnalyzeTarget: '$(Pipeline.Workspace)/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.dll'
AnalyzeSymPath: 'SRV*'
# component-governance
sourceScanPath: '$(Build.SourcesDirectory)'
Expand All @@ -322,13 +323,6 @@ stages:
displayName: PowerShell Core on Windows
imageName: windows-latest

- template: test.yml
parameters:
jobName: TestPkgWinPS
displayName: Windows PowerShell on Windows
imageName: windows-latest
powershellExecutable: powershell

- template: test.yml
parameters:
jobName: TestPkgUbuntu
Expand Down
15 changes: 6 additions & 9 deletions .ci/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ stages:
- ImageOverride -equals PSMMS2019-Secure

steps:
- task: UseDotNet@2
inputs:
useGlobalJson: true

- pwsh: |
Get-ChildItem -Path env:
Get-ChildItem -Path . -Recurse -Directory
Expand Down Expand Up @@ -59,8 +63,8 @@ stages:
Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)"
Import-Module -Name $(Build.SourcesDirectory)/buildtools.psd1 -Force
#
# Build for net472 framework
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release -BuildFramework 'net472'
# Build for net10.0 framework
$(Build.SourcesDirectory)/build.ps1 -Build -Clean -BuildConfiguration Release -BuildFramework 'net10.0'
displayName: Build and publish artifact

- pwsh: |
Expand Down Expand Up @@ -398,13 +402,6 @@ stages:
displayName: PowerShell Core on Windows
imageName: windows-latest

- template: test.yml
parameters:
jobName: TestPkgWinPS
displayName: Windows PowerShell on Windows
imageName: windows-latest
powershellExecutable: powershell

- template: test.yml
parameters:
jobName: TestPkgUbuntu
Expand Down
6 changes: 6 additions & 0 deletions .ci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
variables:
- group: InstallDSC
steps:
- pwsh: |
if ($PSVersionTable.PSVersion -lt [version]'7.6' -or [Environment]::Version.Major -lt 10) {
throw "Tests require PowerShell 7.6 or newer running on .NET 10 or newer."
}
displayName: Verify PowerShell and .NET runtime requirements

- ${{ parameters.powershellExecutable }}: |
Install-Module -Name 'Microsoft.PowerShell.SecretManagement' -force -SkipPublisherCheck -AllowClobber
Install-Module -Name 'Microsoft.PowerShell.SecretStore' -force -SkipPublisherCheck -AllowClobber
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/PSResourceGet-Official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ extends:
# this is installing .NET
- pwsh: |
Set-Location "$(repoRoot)"
try { ./build.ps1 -Build -Clean -BuildConfiguration Release -BuildFramework 'net472'} catch { throw $_ }
try { ./build.ps1 -Build -Clean -BuildConfiguration Release -BuildFramework 'net10.0'} catch { throw $_ }
displayName: Execute build
env:
ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step.
Expand Down
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/PowerShell/PSResourceGet/blob/master/LICENSE)
[![Documentation - PSResourceGet](https://img.shields.io/badge/Documentation-PowerShellGet-blue.svg)](https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget)
[![PowerShell Gallery - PSResourceGet](https://img.shields.io/badge/PowerShell%20Gallery-PSResourceGet-blue.svg)](https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet)
[![Minimum Supported PowerShell Version](https://img.shields.io/badge/PowerShell-5.0-blue.svg)](https://github.com/PowerShell/PSResourceGet)
[![Minimum Supported PowerShell Version](https://img.shields.io/badge/PowerShell-7.6-blue.svg)](https://github.com/PowerShell/PSResourceGet)

## Important Notes

Expand All @@ -27,7 +27,7 @@ PSResourceGet is a PowerShell module with commands for discovering, installing,

## Requirements

* PowerShell 5.0 or higher.
* PowerShell 7.6 or higher running on .NET 10. Windows PowerShell is not supported by this build.

## Install the PSResourceGet module

Expand All @@ -54,8 +54,8 @@ Please use the [PowerShell Gallery](https://www.powershellgallery.com) to get th

Note: Please ensure you have the exact version of the .NET SDK installed. The current version can be found in the [global.json](https://github.com/PowerShell/PSResourceGet/blob/master/global.json) and installed from the [.NET website](https://dotnet.microsoft.com/en-us/download).
```powershell
# Build for the net472 framework
PS C:\Repos\PSResourceGet> .\build.ps1 -Clean -Build -BuildConfiguration Debug -BuildFramework net472
# Build for the net10.0 framework
PS C:\Repos\PSResourceGet> .\build.ps1 -Clean -Build -BuildConfiguration Debug -BuildFramework net10.0
```

### Run functional tests
Expand All @@ -72,13 +72,9 @@ Note: Please ensure you have the exact version of the .NET SDK installed. The c
### Import the built module into a new PowerShell session

```powershell
# If running PowerShell 6+
# Run in a fresh PowerShell 7.6+ session
C:\> pwsh
C:\> Import-Module C:\Repos\PSResourceGet\out\PSResourceGet

# If running Windows PowerShell
c:\> PowerShell
C:\> Import-Module C:\Repos\PSResourceGet\out\PSResourceGet\PSResourceGet.psd1
C:\> Import-Module C:\Repos\PSResourceGet\out\Microsoft.PowerShell.PSResourceGet\Microsoft.PowerShell.PSResourceGet.psd1
```
## Module Support Lifecycle
Microsoft.PowerShell.PSResourceGet follows the support lifecycle of the version of PowerShell that it ships in.
Expand Down
4 changes: 2 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ param (
[ValidateSet("Debug", "Release")]
[string] $BuildConfiguration = "Debug",

[ValidateSet("net472")]
[string] $BuildFramework = "net472"
[ValidateSet("net10.0")]
[string] $BuildFramework = "net10.0"
)

Import-Module -Name "$PSScriptRoot/buildtools.psd1" -Force
Expand Down
18 changes: 3 additions & 15 deletions doBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ function DoBuild
'Azure.Core'
'Azure.Identity'
'Microsoft.Bcl.AsyncInterfaces'
'Microsoft.Bcl.Cryptography'
'Microsoft.Extensions.Caching.Abstractions'
'Microsoft.Extensions.Caching.Memory'
'Microsoft.Extensions.Configuration.Abstractions'
'Microsoft.Extensions.DependencyInjection.Abstractions'
'Microsoft.Extensions.Diagnostics.Abstractions'
Expand All @@ -120,24 +121,11 @@ function DoBuild
'NuGet.ProjectModel'
'NuGet.Protocol'
'NuGet.Versioning'
'System.Buffers'
'System.Collections.Immutable'
'OrasProject.Oras'
'System.ClientModel'
'System.Diagnostics.DiagnosticSource'
'System.Formats.Asn1'
'System.IO.FileSystem.AccessControl'
'System.IO.Pipelines'
'System.Memory.Data'
'System.Memory'
'System.Numerics.Vectors'
'System.Runtime.CompilerServices.Unsafe'
'System.Security.AccessControl'
'System.Security.Cryptography.Pkcs'
'System.Security.Cryptography.ProtectedData'
'System.Security.Principal.Windows'
'System.Text.Encodings.Web'
'System.Text.Json'
'System.Threading.Tasks.Extensions'
)

$buildSuccess = $true
Expand Down
7 changes: 2 additions & 5 deletions src/Microsoft.PowerShell.PSResourceGet.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
RootModule = './Microsoft.PowerShell.PSResourceGet.dll'
NestedModules = @('./Microsoft.PowerShell.PSResourceGet.psm1')
ModuleVersion = '1.3.1'
CompatiblePSEditions = @('Core', 'Desktop')
CompatiblePSEditions = @('Core')
GUID = 'e4e0bda1-0703-44a5-b70d-8fe704cd0643'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = '(c) Microsoft Corporation. All rights reserved.'
Description = 'PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, Scripts, and DSC Resources.'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '2.0'
CLRVersion = '4.0.0'
PowerShellVersion = '7.6'
FormatsToProcess = 'PSGet.Format.ps1xml'
CmdletsToExport = @(
'Compress-PSResource',
Expand Down Expand Up @@ -52,7 +50,6 @@
PSData = @{
# Prerelease = ''
Tags = @('PackageManagement',
'PSEdition_Desktop',
'PSEdition_Core',
'Linux',
'Mac',
Expand Down
Loading
Loading