Update pipeline step to remove deprecated params in API view script (#5458)

* Update pipeline step to remove deprecated params in API view script
This commit is contained in:
Praven Kuttappan 2024-03-19 17:16:13 -04:00 committed by GitHub
parent 469775373c
commit 8891f9511e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 78 additions and 77 deletions

View File

@ -80,61 +80,35 @@ jobs:
# Disable build for cpp - client
- ${{ if and(eq(parameters.RunMetaJobs, 'true'), ne(parameters.ServiceDirectory, 'not-specified' )) }}:
- ${{ each artifact in parameters.Artifacts }}:
- job:
displayName: Create API Review for ${{ artifact.name }}
pool:
name: $(WINDOWSPOOL)
image: $(WINDOWSVMIMAGE)
os: windows
steps:
- task: Powershell@2
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1
arguments: >
-ServiceDirectory ${{ parameters.ServiceDirectory }}
-OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Dump Package properties
condition: succeeded()
- job:
displayName: Create API Review
pool:
name: $(WINDOWSPOOL)
image: $(WINDOWSVMIMAGE)
os: windows
steps:
- task: Powershell@2
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1
arguments: >
-ServiceDirectory ${{ parameters.ServiceDirectory }}
-OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Dump Package properties
condition: succeeded()
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml
- task: UniversalPackages@0
displayName: Download ApiView Parser.
inputs:
command: download
vstsFeed: 'internal/AzureSDKForCpp'
vstsFeedPackage: 'parseazuresdkcpp'
downloadDirectory: '$(System.DefaultWorkingDirectory)/parser'
vstsPackageVersion: 0.11.0
condition: >-
and(
succeeded(),
ne(variables['Skip.CreateApiReview'], 'true'),
ne(variables['Build.Reason'],'PullRequest'),
eq(variables['System.TeamProject'], 'internal')
)
- task: Powershell@2
inputs:
filePath: $(System.DefaultWorkingDirectory)/eng/scripts/Create-APIReview.ps1
arguments: >
-ArtifactName ${{ artifact.name }}
-OutPath $(Build.ArtifactStagingDirectory)
-ApiviewUri "$(azuresdk-apiview-uri)"
-ApiKey "$(azuresdk-apiview-apikey)"
-ApiLabel "Auto Review - $(Build.SourceVersion)"
-SourceBranch $(Build.SourceBranchName)
-DefaultBranch $(DefaultBranch)
-ConfigFileDir $(Build.ArtifactStagingDirectory)/PackageInfo
-ParserPath $(System.DefaultWorkingDirectory)/parser/RelWithDebInfo/ParseAzureSdkCpp.exe
-SourcePath $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}/${{ artifact.name }}/inc
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Create API Review for ${{ artifact.name }}
condition: >-
- task: UniversalPackages@0
displayName: Download ApiView Parser.
inputs:
command: download
vstsFeed: 'internal/AzureSDKForCpp'
vstsFeedPackage: 'parseazuresdkcpp'
downloadDirectory: '$(System.DefaultWorkingDirectory)/parser'
vstsPackageVersion: 0.11.0
condition: >-
and(
succeeded(),
ne(variables['Skip.CreateApiReview'], 'true'),
@ -142,6 +116,30 @@ jobs:
eq(variables['System.TeamProject'], 'internal')
)
- task: Powershell@2
inputs:
filePath: $(System.DefaultWorkingDirectory)/eng/scripts/Create-APIReview.ps1
arguments: >
-ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name)
-OutPath $(Build.ArtifactStagingDirectory)
-ApiKey "$(azuresdk-apiview-apikey)"
-SourceBranch $(Build.SourceBranchName)
-DefaultBranch $(DefaultBranch)
-ParserPath $(System.DefaultWorkingDirectory)/parser/RelWithDebInfo/ParseAzureSdkCpp.exe
-ServicePath $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}
-BuildId $(Build.BuildId)
-RepoName "$(Build.Repository.Name)"
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Create API Review
condition: >-
and(
succeeded(),
ne(variables['Skip.CreateApiReview'], 'true'),
ne(variables['Build.Reason'],'PullRequest'),
eq(variables['System.TeamProject'], 'internal')
)
- job: GenerateReleaseArtifacts
pool:
name: $(WINDOWSPOOL)

View File

@ -1,44 +1,47 @@
Param(
[Parameter(Mandatory=$True)]
[string] $ArtifactName,
[array] $ArtifactList,
[Parameter(Mandatory=$True)]
[string] $OutPath,
[Parameter(Mandatory=$True)]
[string] $ApiviewUri,
[Parameter(Mandatory=$True)]
[string] $ApiKey,
[Parameter(Mandatory=$True)]
[string] $ApiLabel,
[Parameter(Mandatory=$True)]
[string] $SourceBranch,
[Parameter(Mandatory=$True)]
[string] $DefaultBranch,
[Parameter(Mandatory=$True)]
[string] $ConfigFileDir,
[Parameter(Mandatory=$True)]
[string] $ParserPath,
[Parameter(Mandatory=$True)]
[string] $SourcePath
[string] $ServicePath,
[Parameter(Mandatory=$True)]
[string] $RepoName,
[Parameter(Mandatory=$True)]
[string] $BuildId
)
Write-Host "$PSScriptRoot"
. (Join-Path $PSScriptRoot .. common scripts common.ps1)
$createReviewScript = (Join-Path $PSScriptRoot .. common scripts Create-APIReview.ps1)
$apiviewSettings = Join-Path $SourcePath "ApiViewSettings.json"
if (!(Test-Path $apiviewSettings))
foreach ($artifact in $ArtifactList)
{
Write-Host "ApiViewSettings.json file is not found in $($SourcePath). APIView settings file is required to generate API review file."
exit 1
$ArtifactName = $artifact.name
Write-Host "Generating artifact for $ArtifactName"
$SourcePath = Join-Path $ServicePath $ArtifactName "inc"
$apiviewSettings = Join-Path $SourcePath "ApiViewSettings.json"
if (!(Test-Path $apiviewSettings))
{
Write-Host "ApiViewSettings.json file is not found in $($SourcePath). APIView settings file is required to generate API review file."
exit 1
}
Write-Host "Creating API review artifact for $($ArtifactName)"
New-Item -ItemType Directory -Path $OutPath/$ArtifactName -force
$parentPath = Split-Path $ParserPath -Parent
Write-Host "Contents in $($parentPath)"
Get-ChildItem -Path $parentPath -Recurse
& $ParserPath -o $OutPath/$ArtifactName/$ArtifactName.json $SourcePath
}
Write-Host "Creating API review artifact for $($ArtifactName)"
New-Item -ItemType Directory -Path $OutPath/$ArtifactName -force
$parentPath = Split-Path $ParserPath -Parent
Write-Host "Contents in $($parentPath)"
Get-ChildItem -Path $parentPath -Recurse
& $ParserPath -o $OutPath/$ArtifactName/$ArtifactName.json $SourcePath
Write-Host "Send request to APIView to create review for $ArtifactName"
&($createReviewScript) -ArtifactPath $OutPath -APIViewUri $ApiviewUri -APIKey $ApiKey -APILabel $ApiLabel -PackageName $ArtifactName -SourceBranch $SourceBranch -DefaultBranch $DefaultBranch -ConfigFileDir $ConfigFileDir
$createReviewScript = (Join-Path $PSScriptRoot .. common scripts Create-APIReview.ps1)
Write-Host "Running script to create review for all artifacts."
&($createReviewScript) -ArtifactList $ArtifactList -ArtifactPath $OutPath -APIKey $ApiKey -SourceBranch $SourceBranch -DefaultBranch $DefaultBranch -RepoName $RepoName -BuildId $BuildId

View File

@ -106,7 +106,7 @@ function SetPackageVersion ($PackageName, $Version, $ServiceDirectory, $ReleaseD
function Find-cpp-Artifacts-For-Apireview($ArtifactPath, $PackageName)
{
$artifact = Get-ChildItem -Path (Join-Path $ArtifactPath $PackageName) -Filter "*.json"
$artifact = @(Get-ChildItem -Path (Join-Path $ArtifactPath $PackageName) -Filter "*.json")
if ($artifact)
{
$packages = @{