From 65c7ba53c4ff9665ea945594db20370df43a0c17 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 8 Apr 2025 10:16:38 -0700 Subject: [PATCH] Allow eng/ based packages to parse ci.yml (#6514) Co-authored-by: Scott Beddall --- eng/common/scripts/Package-Properties.ps1 | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index be53163a8..a1413e968 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -115,11 +115,28 @@ class PackageProps { return $null } - [PSCustomObject]GetCIYmlForArtifact() { + [System.IO.FileInfo[]]ResolveCIFolderPath() { $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot ".." ".." "..") - $ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "sdk" $this.ServiceDirectory) - $ciFiles = @(Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File) + $ciFiles = @() + + # if this path exists, then we should look in it for the ci.yml files and return nothing if nothing is found + if (Test-Path $ciFolderPath){ + $ciFiles = @(Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File) + } + # if not, we should at least try to resolve the eng/ folder to fall back and see if that's where the path exists + else { + $ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "eng" $this.ServiceDirectory) + if (Test-Path $ciFolderPath) { + $ciFiles = @(Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File) + } + } + + return $ciFiles + } + + [PSCustomObject]GetCIYmlForArtifact() { + $ciFiles = @($this.ResolveCIFolderPath()) $ciArtifactResult = $null $soleCIYml = ($ciFiles.Count -eq 1)