diff --git a/eng/common/pipelines/templates/steps/create-apireview.yml b/eng/common/pipelines/templates/steps/create-apireview.yml index 6942abd0ba..288c775aac 100644 --- a/eng/common/pipelines/templates/steps/create-apireview.yml +++ b/eng/common/pipelines/templates/steps/create-apireview.yml @@ -41,7 +41,7 @@ steps: inputs: filePath: ${{ parameters.SourceRootPath }}/eng/common/scripts/Create-APIReview.ps1 arguments: > - -PackageInfoFiles ('${{ convertToJson(parameters.PackageInfoFiles) }}' | ConvertFrom-Json -NoEnumerate) + -PackageInfoFiles @('${{ join(''',''', parameters.PackageInfoFiles) }}') -ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name) -ArtifactPath '${{parameters.ArtifactPath}}' -ArtifactName ${{ parameters.ArtifactName }} diff --git a/eng/common/pipelines/templates/steps/validate-all-packages.yml b/eng/common/pipelines/templates/steps/validate-all-packages.yml index ab75877a02..ae09d268a9 100644 --- a/eng/common/pipelines/templates/steps/validate-all-packages.yml +++ b/eng/common/pipelines/templates/steps/validate-all-packages.yml @@ -34,7 +34,7 @@ steps: -BuildDefinition $(System.CollectionUri)$(System.TeamProject)/_build?definitionId=$(System.DefinitionId) ` -PipelineUrl $(System.CollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId) ` -IsReleaseBuild $$(SetAsReleaseBuild) ` - -PackageInfoFiles ('${{ convertToJson(parameters.PackageInfoFiles) }}' | ConvertFrom-Json -NoEnumerate) + -PackageInfoFiles @('${{ join(''',''', parameters.PackageInfoFiles) }}') workingDirectory: $(Pipeline.Workspace) displayName: Validate packages and update work items continueOnError: true diff --git a/eng/common/scripts/Create-APIReview.ps1 b/eng/common/scripts/Create-APIReview.ps1 index 5d112d71a0..ff98d45704 100644 --- a/eng/common/scripts/Create-APIReview.ps1 +++ b/eng/common/scripts/Create-APIReview.ps1 @@ -373,7 +373,8 @@ elseif ($ArtifactList -and $ArtifactList.Count -gt 0) { elseif ($PackageInfoFiles -and $PackageInfoFiles.Count -gt 0) { # Lowest Priority: Direct PackageInfoFiles (new method) Write-Host "Using PackageInfoFiles parameter with $($PackageInfoFiles.Count) files" - $ProcessedPackageInfoFiles = $PackageInfoFiles # Use as-is + # Filter out empty strings or whitespace-only entries + $ProcessedPackageInfoFiles = $PackageInfoFiles | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } } else { Write-Error "No package information provided. Please provide either 'PackageName', 'ArtifactList', or 'PackageInfoFiles' parameters." @@ -382,7 +383,7 @@ else { # Validate that we have package info files to process if (-not $ProcessedPackageInfoFiles -or $ProcessedPackageInfoFiles.Count -eq 0) { - Write-Error "No package info files found after processing parameters." + Write-Error "No package info files found after processing parameters. Or PackageInfoFiles parameter contains only empty or whitespace entries, please check the artifact settings." exit 1 } diff --git a/eng/common/scripts/Validate-All-Packages.ps1 b/eng/common/scripts/Validate-All-Packages.ps1 index a27fd4652d..24cfdc8546 100644 --- a/eng/common/scripts/Validate-All-Packages.ps1 +++ b/eng/common/scripts/Validate-All-Packages.ps1 @@ -282,12 +282,13 @@ elseif ($PackageInfoFiles -and $PackageInfoFiles.Count -gt 0) { # Direct PackageInfoFiles (new method) Write-Host "Using PackageInfoFiles parameter with $($PackageInfoFiles.Count) files" - $ProcessedPackageInfoFiles = $PackageInfoFiles + # Filter out empty strings or whitespace-only entries + $ProcessedPackageInfoFiles = $PackageInfoFiles | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } } # Validate that we have package info files to process if (-not $ProcessedPackageInfoFiles -or $ProcessedPackageInfoFiles.Count -eq 0) { - Write-Error "No package info files found after processing parameters." + Write-Error "No package info files found after processing parameters. Or PackageInfoFiles parameter contains only empty or whitespace entries, please check the artifact settings." exit 1 }