[release/v7.5] Make sure the vPack pipeline does not produce an empty package (#25320)

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
PowerShell Team Bot
2025-04-11 12:39:54 -07:00
committed by GitHub
co-authored by Travis Plunk
parent 9d14d5068a
commit 8ee12f6c52
+19 -6
View File
@@ -142,18 +142,27 @@ extends:
$vstsCommandString = "vso[task.setvariable variable=PackageArtifactName]$packageArtifactName"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: 'Set package artifact name'
$packageArtifactPath = '$(Pipeline.Workspace)\PSPackagesOfficial'
$vstsCommandString = "vso[task.setvariable variable=PackageArtifactPath]$packageArtifactPath"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: 'Set package artifact variables'
- download: PSPackagesOfficial
artifact: $(PackageArtifactName)
displayName: Download package
- pwsh: 'Get-ChildItem $(System.ArtifactsDirectory)\* -recurse | Select-Object -ExpandProperty Name'
- pwsh: 'Get-ChildItem $(PackageArtifactPath)\* -recurse | Select-Object -ExpandProperty Name'
displayName: 'Capture Artifact Listing'
- pwsh: |
$message = @()
Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -include *.zip, *.msi | ForEach-Object {
$packages = Get-ChildItem $(PackageArtifactPath)\* -recurse -include *.zip, *.msi
if($packages.count -eq 0) {throw "No packages found in $(PackageArtifactPath)"}
$packages | ForEach-Object {
if($_.Name -notmatch 'PowerShell-\d+\.\d+\.\d+\-([a-z]*.\d+\-)?win\-(fxdependent|x64|arm64|x86|fxdependentWinDesktop)\.(msi|zip){1}')
{
$messageInstance = "$($_.Name) is not a valid package name"
@@ -166,7 +175,7 @@ extends:
displayName: 'Validate Zip and MSI Package Names'
- pwsh: |
Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -include *.zip, *.msi | ForEach-Object {
Get-ChildItem $(PackageArtifactPath)\* -recurse -include *.zip | ForEach-Object {
if($_.Name -match 'PowerShell-\d+\.\d+\.\d+\-([a-z]*.\d+\-)?win\-(${{ parameters.architecture }})\.(zip){1}')
{
Expand-Archive -Path $_.FullName -DestinationPath $(ob_outputDirectory)
@@ -197,7 +206,11 @@ extends:
- pwsh: |
Write-Verbose "VPack Version: $(ob_createvpack_version)" -Verbose
Get-ChildItem -Path $(ob_outputDirectory)\* -Recurse
$vpackFiles = Get-ChildItem -Path $(ob_outputDirectory)\* -Recurse
if($vpackFiles.Count -eq 0) {
throw "No files found in $(ob_outputDirectory)"
}
$vpackFiles
displayName: Debug Output Directory and Version
condition: succeededOrFailed()
@@ -207,5 +220,5 @@ extends:
command: 'sign'
signing_environment: 'azure-ado'
cp_code: $(windows_build_tools_cert_id)
files_to_sign: '**/*.exe;**/*.dll;**/*.ps1;**/*.psm1'
files_to_sign: '**/*.exe;**/System.Management.Automation.dll'
search_root: $(ob_outputDirectory)