@@ -20,7 +20,7 @@ class PackageProps {
2020 # additional packages required for validation of this one
2121 [string []]$AdditionalValidationPackages
2222 [HashTable ]$ArtifactDetails
23- [HashTable []] $CIMatrixConfigs
23+ [HashTable ] $CIParameters
2424
2525 PackageProps([string ]$name , [string ]$version , [string ]$directoryPath , [string ]$serviceDirectory ) {
2626 $this.Initialize ($name , $version , $directoryPath , $serviceDirectory )
@@ -61,6 +61,7 @@ class PackageProps {
6161 $this.ChangeLogPath = $null
6262 }
6363
64+ $this.CIParameters = @ {" CIMatrixConfigs" = @ ()}
6465 $this.InitializeCIArtifacts ()
6566 }
6667
@@ -89,51 +90,54 @@ class PackageProps {
8990 if ($artifactForCurrentPackage ) {
9091 $result = [PSCustomObject ]@ {
9192 ArtifactConfig = [HashTable ]$artifactForCurrentPackage
92- MatrixConfigs = @ ()
93- AdditionalMatrixConfigs = @ ()
93+ ParsedYml = $content
9494 }
9595
96- # if we know this is the matrix for our file, we should now see if there is a custom matrix config for the package
97- $matrixConfigList = GetValueSafelyFrom- Yaml $content @ (" extends" , " parameters" , " MatrixConfigs" )
98-
99- if ($matrixConfigList ) {
100- $result.MatrixConfigs += $matrixConfigList
101- }
96+ return $result
97+ }
98+ }
99+ return $null
100+ }
102101
103- $additionalMatrixConfigList = GetValueSafelyFrom- Yaml $content @ (" extends" , " parameters" , " AdditionalMatrixConfigs" )
102+ [PSCustomObject ]GetCIYmlForArtifact() {
103+ $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot " .." " .." " .." )
104104
105- if ( $additionalMatrixConfigList ) {
106- $result .AdditionalMatrixConfigs += $additionalMatrixConfigList
107- }
105+ $ciFolderPath = Join-Path - Path $RepoRoot - ChildPath ( Join-Path " sdk " $this .ServiceDirectory )
106+ $ciFiles = Get-ChildItem - Path $ciFolderPath - Filter " ci*.yml " - File
107+ $ciArtifactResult = $null
108108
109- return $result
109+ foreach ($ciFile in $ciFiles ) {
110+ $ciArtifactResult = $this.ParseYmlForArtifact ($ciFile.FullName )
111+ if ($ciArtifactResult ) {
112+ break
110113 }
111114 }
112- return $null
115+
116+ return $ciArtifactResult
113117 }
114118
115119 [void ]InitializeCIArtifacts() {
116120 if (-not $env: SYSTEM_TEAMPROJECTID -and -not $env: GITHUB_ACTIONS ) {
117121 return
118122 }
119123
120- $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot " .." " .." " .." )
124+ if (-not $this.ArtifactDetails ) {
125+ $ciArtifactResult = $this.GetCIYmlForArtifact ()
121126
122- $ciFolderPath = Join-Path - Path $RepoRoot - ChildPath ( Join-Path " sdk " $this .ServiceDirectory )
123- $ciFiles = Get-ChildItem - Path $ciFolderPath - Filter " ci*.yml " - File
127+ if ( $ciArtifactResult ) {
128+ $this .ArtifactDetails = [ Hashtable ] $ciArtifactResult .ArtifactConfig
124129
125- if (-not $this.ArtifactDetails ) {
126- foreach ($ciFile in $ciFiles ) {
127- $ciArtifactResult = $this.ParseYmlForArtifact ($ciFile.FullName )
128- if ($ciArtifactResult ) {
129- $this.ArtifactDetails = [Hashtable ]$ciArtifactResult.ArtifactConfig
130- $this.CIMatrixConfigs = $ciArtifactResult.MatrixConfigs
131- # if this package appeared in this ci file, then we should
132- # treat this CI file as the source of the Matrix for this package
133- if ($ciArtifactResult.PSObject.Properties.Name -contains " AdditionalMatrixConfigs" -and $ciArtifactResult.AdditionalMatrixConfigs ) {
134- $this.CIMatrixConfigs += $ciArtifactResult.AdditionalMatrixConfigs
135- }
136- break
130+ # if we know this is the matrix for our file, we should now see if there is a custom matrix config for the package
131+ $matrixConfigList = GetValueSafelyFrom- Yaml $ciArtifactResult.ParsedYml @ (" extends" , " parameters" , " MatrixConfigs" )
132+
133+ if ($matrixConfigList ) {
134+ $this.CIParameters [" CIMatrixConfigs" ] += $matrixConfigList
135+ }
136+
137+ $additionalMatrixConfigList = GetValueSafelyFrom- Yaml $ciArtifactResult.ParsedYml @ (" extends" , " parameters" , " AdditionalMatrixConfigs" )
138+
139+ if ($additionalMatrixConfigList ) {
140+ $this.CIParameters [" CIMatrixConfigs" ] += $additionalMatrixConfigList
137141 }
138142 }
139143 }
0 commit comments