-
-
Notifications
You must be signed in to change notification settings - Fork 42
LT-22801: Keep patches from dropping shipped components #1147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b43a70e
LT-22801: Keep Fluent in patches and check patches keep components
johnml1135 bc316bc
LT-22801: Reuse patch rescue for previous components
johnml1135 9abe796
LT-22801: Keep patch ledgers in S3
johnml1135 1b7727f
LT-22801: Preserve ledger file paths
johnml1135 09d2886
LT-22801: Address patch ledger review
johnml1135 089eb90
LT-22801: Address second patch ledger review
johnml1135 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Removing a file from a patch line | ||
|
|
||
| A patch must keep every file-backed component under MSI APPFOLDER (application output | ||
| files) shipped by the base or by the immediately previous published patch. Windows | ||
| Installer sees the base and newest patch together, so those file-backed components must | ||
| remain in the new patch. | ||
|
|
||
| ## What CI checks | ||
|
|
||
| `patch-installer-cd.yml` runs the file-backed component ledger check before signing or publishing. | ||
| The check compares the new Update MSI with the union of: | ||
|
|
||
| - the file-backed components under MSI APPFOLDER in the Master/base MSI; and | ||
| - the complete file-backed update-minus-base ledger published beside the immediately previous MSP. | ||
|
|
||
| The first published patch on a patch line creates the initial S3 ledger. After a | ||
| ledger-bearing patch exists, the immediately previous MSP must have its matching | ||
| `*_components.tsv` file. Version filtering keeps a release branch from consuming a ledger | ||
| for a later patch. Ledgers are release artifacts in S3 and are not stored in this repository. | ||
|
|
||
| Each successful patch writes its complete update-minus-base file-backed component set under MSI APPFOLDER to a ledger beside | ||
| the MSP. A later patch uses the ledger beside its immediately previous MSP. | ||
|
|
||
| ## When the check fails | ||
|
|
||
| The diagnostic names every missing file-backed component and file, regardless of whether it came from | ||
| the base MSI or the previous-patch ledger: | ||
|
|
||
| ``` | ||
| Patch 9.3.12.2761 drops file-backed component {B3A225EB-3642-5FE4-8ED4-B2DAE6F8AC9B} | ||
| file: Avalonia.Themes.Fluent.dll (feature Complete) | ||
| base: 1452 | ||
| Remediation: | ||
| Add each missing file's output path to RemovedSinceLastBase in Build/Installer.legacy.targets, | ||
| preserving its relative output path: | ||
| <RemovedSinceLastBase Include="$(dir-outputBase)/Avalonia.Themes.Fluent.dll" /> | ||
| Create an issue to remove the placeholder before the next base build, unless one already exists for the current base. | ||
| ``` | ||
|
|
||
| The `RemovedSinceLastBase` entry makes the build write a zero-byte stand-in at that path. | ||
| That file-backed component remains in the patch, so machines that already have the real file keep | ||
| working while the removal issue is completed. | ||
|
|
||
| ## Before publishing a base | ||
|
|
||
| A scheduled base verification build warns while any `RemovedSinceLastBase` entries remain. | ||
| A base release build fails. Both messages list the stand-in paths. Remove each | ||
| `RemovedSinceLastBase` entry from `Build/Installer.legacy.targets`. CI builds start clean; | ||
| a dirty local build must also delete each corresponding zero-byte file from the build output. | ||
|
|
||
| Complete the removal issue before creating the base. A new base establishes the file-backed component | ||
| set under MSI APPFOLDER that future patches must preserve. | ||
|
|
||
| ## Running the check locally | ||
|
|
||
| ```powershell | ||
| .\scripts\Installer\Check-PatchComponentLedger.ps1 -MasterMsi <base.msi> -UpdateMsi <update.msi> ` | ||
| -BaseBuildNumber 1452 -PatchVersion 9.3.12.2761 ` | ||
| -OutLedger out.tsv | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Fails a patch build when the new Update MSI drops a file-backed component under MSI APPFOLDER | ||
| from the base or previous patch. | ||
|
|
||
| .DESCRIPTION | ||
| Compares the new Update MSI with file-backed components under MSI APPFOLDER from the base | ||
| MSI and the complete file-backed ledger from the immediately previous published patch. | ||
| Writes the complete update-minus-base file-backed ledger for this patch. | ||
|
|
||
| .PARAMETER MasterMsi | ||
| The base (Master) MSI rebuilt by the patch build. | ||
|
|
||
| .PARAMETER UpdateMsi | ||
| The upgraded (Update) MSI the patch was diffed from. | ||
|
|
||
| .PARAMETER PatchVersion | ||
| The new patch's product version, e.g. 9.3.12.2761. | ||
|
|
||
| .PARAMETER OutLedger | ||
| Where to write this patch's file-backed component ledger. | ||
|
|
||
| #> | ||
| [CmdletBinding()] | ||
| param( | ||
| [Parameter(Mandatory = $true)][string]$MasterMsi, | ||
| [Parameter(Mandatory = $true)][string]$UpdateMsi, | ||
| [Parameter(Mandatory = $true)][string]$BaseBuildNumber, | ||
| [Parameter(Mandatory = $true)][string]$PatchVersion, | ||
| [Parameter(Mandatory = $true)][string]$OutLedger | ||
| ) | ||
|
|
||
| Set-StrictMode -Version Latest | ||
| $ErrorActionPreference = 'Stop' | ||
| Import-Module (Join-Path $PSScriptRoot 'PatchComponentLedger.psm1') -Force | ||
|
|
||
| $master = Get-MsiComponents -MsiPath $MasterMsi | ||
| $update = Get-MsiComponents -MsiPath $UpdateMsi | ||
|
|
||
| $publishedPatchKeys = @(Get-PublishedPatchKeys -BaseBuildNumber $BaseBuildNumber -Wildcard '*.msp') | ||
| $publishedLedgerKeys = @(Get-PublishedPatchKeys -BaseBuildNumber $BaseBuildNumber -Wildcard '*_components.tsv') | ||
| $previous = Select-PreviousPublishedPatch ` | ||
| -PatchKeys $publishedPatchKeys ` | ||
| -LedgerKeys $publishedLedgerKeys ` | ||
| -BaseBuildNumber $BaseBuildNumber ` | ||
| -PatchVersion $PatchVersion | ||
|
|
||
| $ledgerFiles = New-Object System.Collections.Generic.List[string] | ||
| if ($previous.LedgerKey) { | ||
| $downloads = Join-Path ([IO.Path]::GetTempPath()) "fw-patch-ledgers-b$BaseBuildNumber" | ||
| New-Item -ItemType Directory -Force -Path $downloads | Out-Null | ||
| $ledgerFiles.Add((Save-PublishedFile -Key $previous.LedgerKey -Directory $downloads)) | ||
| } | ||
|
|
||
| $previousLedger = Read-ComponentLedger -LedgerFiles $ledgerFiles.ToArray() | ||
| $required = @{} | ||
| foreach ($entry in $master.Values) { $required[$entry.ComponentId] = $entry } | ||
| foreach ($entry in $previousLedger.Values) { | ||
| if (-not $required.ContainsKey($entry.ComponentId)) { $required[$entry.ComponentId] = $entry } | ||
| } | ||
| $dropped = @(Get-MissingComponents -Required $required -Available $update) | ||
| $newLedgerEntries = @(Get-UpdateMinusBaseLedgerEntries -Master $master -Update $update) | ||
| Write-ComponentLedger -Path $OutLedger -Entries $newLedgerEntries -Heading "Complete update-minus-base file-backed ledger under MSI APPFOLDER for patch $PatchVersion on base $BaseBuildNumber" | ||
| Write-Output "Patch $PatchVersion ledger contains $($newLedgerEntries.Count) update-minus-base file-backed components under MSI APPFOLDER; ledger written to $OutLedger" | ||
| Write-Output "Checking against $($required.Count) required file-backed components under MSI APPFOLDER" | ||
|
|
||
| if ($dropped.Count -eq 0) { | ||
| Write-Output '[OK] The patch keeps every required file-backed component under MSI APPFOLDER.' | ||
| exit 0 | ||
| } | ||
|
|
||
| $message = Format-DroppedComponentMessage -PatchVersion $PatchVersion -BaseBuildNumber $BaseBuildNumber -Dropped $dropped | ||
| Write-Output $message | ||
| if ($env:GITHUB_ACTIONS -eq 'true') { | ||
| Write-Output ('::error title=Patch file-backed component removal::' + ($message -replace "`r?`n", ' ')) | ||
| } | ||
| exit 1 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.