From 5669d9b1a58c731f90d8798cf9cd14444656c593 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:12:45 -0800 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 9381 (#1920) * change our verifyChangelogs over to utilizing the artifact details. if we don't have an artifact details at all, don't verify changelog. if we do, but skipverifychangelog is present, don't verify changelog. if we have artifact details, but no disable, verify the changelog --------- Co-authored-by: Scott Beddall --- eng/common/scripts/Verify-ChangeLogs.ps1 | 33 +++++++----------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/eng/common/scripts/Verify-ChangeLogs.ps1 b/eng/common/scripts/Verify-ChangeLogs.ps1 index 1aeb33a52c..9598472720 100644 --- a/eng/common/scripts/Verify-ChangeLogs.ps1 +++ b/eng/common/scripts/Verify-ChangeLogs.ps1 @@ -7,30 +7,17 @@ Set-StrictMode -Version 3 . (Join-Path $PSScriptRoot common.ps1) -function ShouldVerifyChangeLog ($ServiceDirectory, $PackageName) { - $jsonCiYmlPath = Join-Path $ServiceDirectory "ci.yml" - - if (Test-Path $jsonCiYmlPath) - { - $ciYml = Get-Content $jsonCiYmlPath -Raw | yq -o=json | ConvertFrom-Json -AsHashTable - - if ($ciYml.extends -and $ciYml.extends.parameters -and $ciYml.extends.parameters.Artifacts) { - $packagesCheckingChangeLog = $ciYml.extends.parameters.Artifacts ` - | Where-Object { -not ($_["skipVerifyChangelog"] -eq $true) } ` - | Select-Object -ExpandProperty name - if ($packagesCheckingChangeLog -contains $PackageName) - { - return $true - } else { - return $false - } - } + +function ShouldVerifyChangeLog ($PkgArtifactDetails) { + if ($PkgArtifactDetails) { + if ($PkgArtifactDetails.PSObject.Properties["skipVerifyChangeLog"] -eq $true) { + return $false } -} -if (-not (Get-Command 'yq' -ErrorAction SilentlyContinue)) { - Write-Host "Error: 'yq' is not installed or not found in PATH. Please remedy this before running this script." - exit 1 + return $true + } + + return $false } # find which packages we need to confirm the changelog for @@ -41,7 +28,7 @@ $allPassing = $true foreach($propertiesFile in $packageProperties) { $PackageProp = Get-Content -Path $propertiesFile | ConvertFrom-Json - if (-not (ShouldVerifyChangeLog -ServiceDirectory (Join-Path $RepoRoot "sdk" $PackageProp.ServiceDirectory) -PackageName $PackageProp.Name)) { + if (-not (ShouldVerifyChangeLog $PackageProp.ArtifactDetails)) { Write-Host "Skipping changelog verification for $($PackageProp.Name)" continue }