From e320abf153158c86dd7ad6ad5885a822fd9a0b90 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 13 Sep 2024 14:57:23 -0700 Subject: [PATCH] updating package properties with direct/indirect (if named differently) as well as pulling BuildDocs from ci.yml artifact list if it exists --- eng/common/scripts/Package-Properties.ps1 | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index e3cea7d392..aa4fa27e9d 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -15,6 +15,10 @@ class PackageProps [boolean]$IsNewSdk [string]$ArtifactName [string]$ReleaseStatus + [boolean]$BuildDocs + # was this package purely included because other packages included it as an AdditionalValidationPackage? + [boolean]$IncludedForValidation + # does this package include other packages that we should trigger validation for? [string[]]$AdditionalValidationPackages PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory) @@ -38,6 +42,7 @@ class PackageProps $this.Version = $version $this.DirectoryPath = $directoryPath $this.ServiceDirectory = $serviceDirectory + $this.IncludedForValidation = $false if (Test-Path (Join-Path $directoryPath "README.md")) { @@ -62,6 +67,8 @@ class PackageProps { $this.ChangeLogPath = $null } + + $this.InitializeBuildDocs($ServiceDirectory) } hidden [void]Initialize( @@ -75,6 +82,41 @@ class PackageProps $this.Initialize($name, $version, $directoryPath, $serviceDirectory) $this.Group = $group } + + hidden [void]InitializeBuildDocs( + [string]$ServiceDirectory + ) + { + # parse the relevant ci.yml file to determine if the package should build docs + $ciYmlPath = Join-Path $ServiceDirectory ".ci.yml" + + if (Test-Path $ciYmlPath) + { + $ciYml = ConvertFrom-Yaml (Get-Content $ciYmlPath -Raw) + + if ($ciYml.extends -and $ciYml.extends.parameters -and $ciYml.extends.parameters.Artifacts) { + $packagesBuildingDocs = $ciYml.extends.parameters.Artifacts ` + | Where-Object { + if ($_.PSObject.Properties["skipPublishDocsMs"]) { + $false + } + else { + $true + } + } ` + | Select-Object -ExpandProperty name + + if ($packagesBuildingDocs -contains $this.Name) + { + $this.BuildDocs = $true + } + } + } + else + { + $this.BuildDocs = $false + } + } } # Takes package name and service Name @@ -143,6 +185,7 @@ function Get-PrPkgProperties([string]$InputDiffJson) { $key = $addition.Replace($RepoRoot, "").TrimStart('\/') if ($lookup[$key]) { + $lookup[$key].IncludedForValidation = $true $packagesWithChanges += $lookup[$key] } }