Skip to content

Commit 4191b69

Browse files
azure-sdkscbedd
andauthored
Allow eng/ based packages to parse ci.yml (#2444)
Co-authored-by: Scott Beddall <[email protected]>
1 parent f96ab53 commit 4191b69

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

eng/common/scripts/Package-Properties.ps1

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,28 @@ class PackageProps {
115115
return $null
116116
}
117117

118-
[PSCustomObject]GetCIYmlForArtifact() {
118+
[System.IO.FileInfo[]]ResolveCIFolderPath() {
119119
$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot ".." ".." "..")
120-
121120
$ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "sdk" $this.ServiceDirectory)
122-
$ciFiles = @(Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File)
121+
$ciFiles = @()
122+
123+
# if this path exists, then we should look in it for the ci.yml files and return nothing if nothing is found
124+
if (Test-Path $ciFolderPath){
125+
$ciFiles = @(Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File)
126+
}
127+
# if not, we should at least try to resolve the eng/ folder to fall back and see if that's where the path exists
128+
else {
129+
$ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "eng" $this.ServiceDirectory)
130+
if (Test-Path $ciFolderPath) {
131+
$ciFiles = @(Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File)
132+
}
133+
}
134+
135+
return $ciFiles
136+
}
137+
138+
[PSCustomObject]GetCIYmlForArtifact() {
139+
$ciFiles = @($this.ResolveCIFolderPath())
123140
$ciArtifactResult = $null
124141
$soleCIYml = ($ciFiles.Count -eq 1)
125142

0 commit comments

Comments
 (0)