From 6734391b9d63d9d576f3e10f18cf30434e094e8d Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Mon, 1 Feb 2021 17:15:11 -0800 Subject: [PATCH 1/8] Support sub directory for artifact location --- eng/common/scripts/Create-APIReview.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/eng/common/scripts/Create-APIReview.ps1 b/eng/common/scripts/Create-APIReview.ps1 index 210b82d4f69b..e496326068c8 100644 --- a/eng/common/scripts/Create-APIReview.ps1 +++ b/eng/common/scripts/Create-APIReview.ps1 @@ -8,7 +8,8 @@ Param ( [string] $APIKey, [Parameter(Mandatory=$True)] [string] $APILabel, - [string] $PackageName = "" + [string] $PackageName, + [string] $ArtifactSubDir = "" ) @@ -56,7 +57,12 @@ function Submit-APIReview($packagename, $filePath, $uri, $apiKey, $apiLabel) $packages = @{} if ($FindArtifactForApiReviewFn -and (Test-Path "Function:$FindArtifactForApiReviewFn")) { - $packages = &$FindArtifactForApiReviewFn $ArtifactPath $PackageName + $artifactLoc = $ArtifactPath + if ($ArtifactSubDir) + { + $artifactLoc = Join-Path -Path $artifactLoc $ArtifactSubDir + } + $packages = &$FindArtifactForApiReviewFn $artifactLoc $PackageName } else { From cafcdf87ea1e3ae6b84f5281cedb6db89f3b6acd Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Tue, 2 Feb 2021 09:27:27 -0800 Subject: [PATCH 2/8] Fix as per review comment to avoid artifact sub path --- eng/common/scripts/Create-APIReview.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/common/scripts/Create-APIReview.ps1 b/eng/common/scripts/Create-APIReview.ps1 index e496326068c8..63d3e754cb6e 100644 --- a/eng/common/scripts/Create-APIReview.ps1 +++ b/eng/common/scripts/Create-APIReview.ps1 @@ -9,7 +9,7 @@ Param ( [Parameter(Mandatory=$True)] [string] $APILabel, [string] $PackageName, - [string] $ArtifactSubDir = "" + [string] $ConfigFileDir = "" ) @@ -57,12 +57,7 @@ function Submit-APIReview($packagename, $filePath, $uri, $apiKey, $apiLabel) $packages = @{} if ($FindArtifactForApiReviewFn -and (Test-Path "Function:$FindArtifactForApiReviewFn")) { - $artifactLoc = $ArtifactPath - if ($ArtifactSubDir) - { - $artifactLoc = Join-Path -Path $artifactLoc $ArtifactSubDir - } - $packages = &$FindArtifactForApiReviewFn $artifactLoc $PackageName + $packages = &$FindArtifactForApiReviewFn $ArtifactPath $PackageName } else { @@ -88,7 +83,12 @@ else } $FoundFailure = $False -$pkgInfoPath = Join-Path -Path $ArtifactPath "PackageInfo" +# Default config file path to artifact path to support backward compatibility until those scripts are modified +if (-not $ConfigFileDir) +{ + $ConfigFileDir = $ArtifactPath +} +$pkgInfoPath = Join-Path -Path $ConfigFileDir "PackageInfo" foreach ($pkgName in $responses.Keys) { $respCode = $responses[$pkgName] From 9928bead3273b54f5111af0ad5cebb66dcd2a526 Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Tue, 2 Feb 2021 09:33:13 -0800 Subject: [PATCH 3/8] Package property file is not created for track1 and management pacakges. --- eng/common/scripts/Create-APIReview.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/common/scripts/Create-APIReview.ps1 b/eng/common/scripts/Create-APIReview.ps1 index 63d3e754cb6e..b5a66260935b 100644 --- a/eng/common/scripts/Create-APIReview.ps1 +++ b/eng/common/scripts/Create-APIReview.ps1 @@ -98,7 +98,6 @@ foreach ($pkgName in $responses.Keys) if (-Not (Test-Path $pkgPropPath)) { Write-Host " Package property file path $($pkgPropPath) is invalid." - $FoundFailure = $True } else { From bfda53445dd673126ebfabdfd06b16549c87a662 Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Tue, 2 Feb 2021 14:00:08 -0800 Subject: [PATCH 4/8] Fix property name case --- eng/common/scripts/Save-Package-Properties.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Save-Package-Properties.ps1 b/eng/common/scripts/Save-Package-Properties.ps1 index b78e3342efe0..a433b32d805a 100644 --- a/eng/common/scripts/Save-Package-Properties.ps1 +++ b/eng/common/scripts/Save-Package-Properties.ps1 @@ -13,7 +13,7 @@ if ($allPackageProperties) New-Item -ItemType Directory -Force -Path $outDirectory foreach($pkg in $allPackageProperties) { - if ($pkg.IsNewSDK) + if ($pkg.IsNewSdk) { Write-Host "Package Name: $($pkg.Name)" Write-Host "Package Version: $($pkg.Version)" From 58a82bb21283049b6b9a1a1ef740b56c9aa2551c Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Tue, 2 Feb 2021 23:49:30 -0800 Subject: [PATCH 5/8] Fix as per review comments --- eng/common/scripts/Create-APIReview.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/common/scripts/Create-APIReview.ps1 b/eng/common/scripts/Create-APIReview.ps1 index b5a66260935b..e195a3f73e74 100644 --- a/eng/common/scripts/Create-APIReview.ps1 +++ b/eng/common/scripts/Create-APIReview.ps1 @@ -84,11 +84,11 @@ else $FoundFailure = $False # Default config file path to artifact path to support backward compatibility until those scripts are modified -if (-not $ConfigFileDir) +$pkgInfoPath = Join-Path -Path $ArtifactPath "PackageInfo" +if ($ConfigFileDir) { - $ConfigFileDir = $ArtifactPath + $pkgInfoPath = Join-Path -Path $ConfigFileDir "PackageInfo" } -$pkgInfoPath = Join-Path -Path $ConfigFileDir "PackageInfo" foreach ($pkgName in $responses.Keys) { $respCode = $responses[$pkgName] From 787c84d0bc3ae58c3317b707d597f2de311a46a1 Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Tue, 2 Feb 2021 23:53:10 -0800 Subject: [PATCH 6/8] Fix as per review comments --- eng/common/scripts/Create-APIReview.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/common/scripts/Create-APIReview.ps1 b/eng/common/scripts/Create-APIReview.ps1 index e195a3f73e74..13cddce3e083 100644 --- a/eng/common/scripts/Create-APIReview.ps1 +++ b/eng/common/scripts/Create-APIReview.ps1 @@ -83,7 +83,6 @@ else } $FoundFailure = $False -# Default config file path to artifact path to support backward compatibility until those scripts are modified $pkgInfoPath = Join-Path -Path $ArtifactPath "PackageInfo" if ($ConfigFileDir) { From 4783fbcea8536a8bb8a084ff0a107f17e52d6651 Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Wed, 3 Feb 2021 09:58:51 -0800 Subject: [PATCH 7/8] Use Config File param value as is --- eng/common/scripts/Create-APIReview.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/eng/common/scripts/Create-APIReview.ps1 b/eng/common/scripts/Create-APIReview.ps1 index 13cddce3e083..567561440208 100644 --- a/eng/common/scripts/Create-APIReview.ps1 +++ b/eng/common/scripts/Create-APIReview.ps1 @@ -83,17 +83,16 @@ else } $FoundFailure = $False -$pkgInfoPath = Join-Path -Path $ArtifactPath "PackageInfo" -if ($ConfigFileDir) +if (-not $ConfigFileDir) { - $pkgInfoPath = Join-Path -Path $ConfigFileDir "PackageInfo" + $ConfigFileDir = Join-Path -Path $ArtifactPath "PackageInfo" } foreach ($pkgName in $responses.Keys) { $respCode = $responses[$pkgName] if ($respCode -ne '200') { - $pkgPropPath = Join-Path -Path $pkgInfoPath ($PackageName + ".json") + $pkgPropPath = Join-Path -Path $ConfigFileDir ($PackageName + ".json") if (-Not (Test-Path $pkgPropPath)) { Write-Host " Package property file path $($pkgPropPath) is invalid." From 85b2e25131f7fbc564d37ecd951de99b3d459c7b Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Wed, 3 Feb 2021 10:44:57 -0800 Subject: [PATCH 8/8] Change to make path joineasily readable --- eng/common/scripts/Create-APIReview.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Create-APIReview.ps1 b/eng/common/scripts/Create-APIReview.ps1 index 567561440208..1cef3141337e 100644 --- a/eng/common/scripts/Create-APIReview.ps1 +++ b/eng/common/scripts/Create-APIReview.ps1 @@ -92,7 +92,7 @@ foreach ($pkgName in $responses.Keys) $respCode = $responses[$pkgName] if ($respCode -ne '200') { - $pkgPropPath = Join-Path -Path $ConfigFileDir ($PackageName + ".json") + $pkgPropPath = Join-Path -Path $ConfigFileDir "$PackageName.json" if (-Not (Test-Path $pkgPropPath)) { Write-Host " Package property file path $($pkgPropPath) is invalid."