Skip to content

Commit

Permalink
Update the release build to work with new module artifacts (#1930)
Browse files Browse the repository at this point in the history
- Use a new builder pool, which has the latest PowerShell 7.0.3 available.
- Remove catalog related steps, as the catalog file is unnecessary to PowerShell Gallery now.
- Update the signing xml file to sign the new "Polyfiller" assemblies.
  • Loading branch information
daxian-dbw authored Nov 4, 2020
1 parent fd1265e commit 417fe5c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 55 deletions.
37 changes: 3 additions & 34 deletions .vsts-ci/releaseBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resources:

jobs:
- job: build_windows
pool: Package ES Lab A
pool: Package ES CodeHub Lab E

# APIScan can take a long time
timeoutInMinutes: 240
Expand Down Expand Up @@ -86,39 +86,14 @@ jobs:
- pwsh: |
# Show the signed files
Get-ChildItem -Path $(Signed)
Copy-Item -Path $(Signed)\* -Destination $(PSReadLine) -Force
Copy-Item -Path $(Signed)\* -Destination $(PSReadLine) -Recurse -Force
displayName: 'Replace unsigned files with signed ones'
# Create catalog file from the signed modules files
- pwsh: |
New-FileCatalog -CatalogFilePath $(PSReadLine)\PSReadLine.cat -Path $(PSReadLine) -CatalogVersion 2.0 | `
ForEach-Object -MemberName FullName
displayName: 'Create catalog file'
# Sign the catalog file
- task: PkgESCodeSign@10
displayName: 'CodeSign - catalog file'
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
signConfigXml: '$(Build.SourcesDirectory)\.vsts-ci\sign-catalog.xml'
inPathRoot: '$(PSReadLine)'
outPathRoot: '$(Signed)'
binVersion: Production
binVersionOverride: ''

# Copy the signed catalog file over
- pwsh: |
# Show the signed files
Get-ChildItem -Path $(Signed)
Copy-Item -Path $(Signed)\PSReadLine.cat -Destination $(PSReadLine) -Force
displayName: 'Replace catalog file with the signed one'
# Verify the signatures
- pwsh: |
$HasInvalidFiles = $false
$WrongCert = @{}
Get-ChildItem -Path $(PSReadLine) -Recurse -Include "*.dll","*.ps*1*","*.cat" | `
Get-ChildItem -Path $(PSReadLine) -Recurse -Include "*.dll","*.ps*1*" | `
Get-AuthenticodeSignature | ForEach-Object {
$_ | Select-Object Path, Status
if ($_.Status -ne 'Valid') { $HasInvalidFiles = $true }
Expand All @@ -134,12 +109,6 @@ jobs:
}
displayName: 'Verify the signed files'
- pwsh: |
$CatInfo = Test-FileCatalog -Path $(PSReadLine) -CatalogFilePath $(PSReadLine)\PSReadLine.cat -Detailed
$CatInfo | Format-List
if ($CatInfo.Status -ne "Valid") { throw "Catalog file is invalid." }
displayName: 'Verify the catalog file'
- pwsh: |
try {
$RepoName = "PSRLLocal"
Expand Down
8 changes: 0 additions & 8 deletions .vsts-ci/sign-catalog.xml

This file was deleted.

3 changes: 2 additions & 1 deletion .vsts-ci/sign-module-files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<file src="__INPATHROOT__\PSReadLine.format.ps1xml" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\PSReadLine.format.ps1xml" />

<file src="__INPATHROOT__\Microsoft.PowerShell.PSReadLine2.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Microsoft.PowerShell.PSReadLine2.dll" />
<file src="__INPATHROOT__\System.Runtime.InteropServices.RuntimeInformation.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\System.Runtime.InteropServices.RuntimeInformation.dll" />
<file src="__INPATHROOT__\net461\Microsoft.PowerShell.PSReadLine.Polyfiller.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\net461\Microsoft.PowerShell.PSReadLine.Polyfiller.dll" />
<file src="__INPATHROOT__\net5.0\Microsoft.PowerShell.PSReadLine.Polyfiller.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\net5.0\Microsoft.PowerShell.PSReadLine.Polyfiller.dll" />
</job>
</SignConfigXML>
12 changes: 0 additions & 12 deletions PSReadLine.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,6 @@ task BuildMockPSConsole @mockPSConsoleParams {
exec { dotnet publish -f $Framework -c $Configuration MockPSConsole }
}

<#
Synopsis: Generate the file catalog
#>
task GenerateCatalog {
exec {
Remove-Item -ea Ignore $PSScriptRoot/bin/$Configuration/PSReadLine/PSReadLine.cat
$null = New-FileCatalog -CatalogFilePath $PSScriptRoot/bin/$Configuration/PSReadLine/PSReadLine.cat `
-Path $PSScriptRoot/bin/$Configuration/PSReadLine `
-CatalogVersion 2.0
}
}

<#
Synopsis: Run the unit tests
#>
Expand Down

0 comments on commit 417fe5c

Please sign in to comment.