Skip to content

Commit

Permalink
Handle missing artifacts without exception (#6103)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Beddall <scbedd@microsoft.com>
  • Loading branch information
azure-sdk and scbedd authored Oct 16, 2024
1 parent 0fa0251 commit 417342f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eng/common/scripts/Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ class PackageProps
$content = Get-Content -Raw -Path $ymlPath | CompatibleConvertFrom-Yaml
if ($content) {
$artifacts = $this.GetValueSafely($content, @("extends", "parameters", "Artifacts"))
$artifactForCurrentPackage = $null

$artifactForCurrentPackage = $artifacts | Where-Object { $_["name"] -eq $this.ArtifactName -or $_["name"] -eq $this.Name }
if ($artifacts) {
$artifactForCurrentPackage = $artifacts | Where-Object { $_["name"] -eq $this.ArtifactName -or $_["name"] -eq $this.Name }
}

if ($artifactForCurrentPackage) {
return [HashTable]$artifactForCurrentPackage
Expand Down

0 comments on commit 417342f

Please sign in to comment.