[apiview] adding pr support (#5932)
* add detect api changes * add detect api changes * trigger test pipeline * adding cpp.json ref * yml syntax * move partial script below artifact publish * renaming + trimming down * download parser * download parser * download parser * fix parser download * update to parser 2.0 * update to parser 2.1 * update parser version * trigger pipeline * trigger pipeline * download ste7p testing * download ste7p testing * download ste7p testing * download parser from blob * download parser from blob * download parser from blob * download parser from blob * cspell * download parser from blob * download parser from blob * directory change for get artifacts * directory change for get artifacts * publish packageinfo artifact * publish packageinfo artifact * publish packageinfo artifact * debug * debug * artifact name * artifact name * artifact name * artifact name * api file * delete job * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * dupe package json * dupe package json * codefile * codefile * codefile * codefile * codefile * test in staging * cleanup * use api parser 0.15.0 * ignore unfound package for apiview artifacts * pr adjustments * pr adjustments * pr adjustments * latest version update * update latest parser version * add api parser version * Update sdk/template/azure-template/src/template_client.cpp * add template testing for api changes * add template testing for api changes * out path change * out path change * delete parser path * delete parser path * move save package properties out of artifacts loop * Update sdk/template/azure-template/src/template_client.cpp * Update sdk/template/azure-template/src/private/package_version.hpp * Update sdk/template/azure-template/inc/azure/template/template_client.hpp
This commit is contained in:
parent
519e208a00
commit
9f2b00be2b
1
.vscode/cspell.json
vendored
1
.vscode/cspell.json
vendored
@ -74,6 +74,7 @@
|
||||
"avro",
|
||||
"antkmsft",
|
||||
"azcmagent",
|
||||
"azcopy",
|
||||
"azcore",
|
||||
"azsdk",
|
||||
"azsdkengsys",
|
||||
|
||||
@ -80,75 +80,17 @@ jobs:
|
||||
|
||||
# Disable build for cpp - client
|
||||
- ${{ if and(eq(parameters.RunMetaJobs, 'true'), ne(parameters.ServiceDirectory, 'not-specified' )) }}:
|
||||
- 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
|
||||
|
||||
- task: UniversalPackages@0
|
||||
displayName: Download ApiView Parser.
|
||||
inputs:
|
||||
command: download
|
||||
vstsFeed: 'internal/AzureSDKForCpp'
|
||||
vstsFeedPackage: 'parseazuresdkcpp'
|
||||
downloadDirectory: '$(System.DefaultWorkingDirectory)/parser'
|
||||
vstsPackageVersion: 0.14.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: >
|
||||
-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)
|
||||
image: $(WINDOWSVMIMAGE)
|
||||
os: windows
|
||||
variables:
|
||||
apiviewParserVersion: "20240927.5"
|
||||
VCPKG_DEFAULT_TRIPLET: 'x64-windows-static'
|
||||
Package.EnableSBOMSigning: true
|
||||
steps:
|
||||
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml
|
||||
- template: /eng/common/pipelines/templates/steps/credscan.yml
|
||||
parameters:
|
||||
SuppressionFilePath: $(Build.SourcesDirectory)/eng/CredScanSuppression.json
|
||||
@ -219,6 +161,33 @@ jobs:
|
||||
- pwsh: npm install -g moxygen
|
||||
displayName: Install Moxygen to generate markdown for docs.microsoft.com
|
||||
|
||||
- pwsh: |
|
||||
Write-Host "Using apiview parser version ${{ variables.apiviewParserVersion }}"
|
||||
azcopy copy "https://azuresdkartifacts.blob.core.windows.net/azure-sdk-for-cpp/parseazuresdkcpp/${{ variables.apiviewParserVersion }}/*" "$(System.DefaultWorkingDirectory)/parser" --recursive
|
||||
displayName: Download ApiView Parser.
|
||||
|
||||
- task: Powershell@2
|
||||
inputs:
|
||||
filePath: $(System.DefaultWorkingDirectory)/eng/scripts/Generate-APIReview-Token-Files.ps1
|
||||
arguments: >
|
||||
-ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name)
|
||||
-OutPath $(Build.ArtifactStagingDirectory)
|
||||
-ParserPath $(System.DefaultWorkingDirectory)/parser/RelWithDebInfo/ParseAzureSdkCpp.exe
|
||||
-ServicePath $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}
|
||||
pwsh: true
|
||||
workingDirectory: $(Pipeline.Workspace)
|
||||
displayName: Generate APIReview Token Files
|
||||
|
||||
- task: Powershell@2
|
||||
inputs:
|
||||
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1
|
||||
arguments: >
|
||||
-ServiceDirectory ${{parameters.ServiceDirectory}}
|
||||
-OutDirectory $(Build.ArtifactStagingDirectory)/packages/PackageInfo
|
||||
pwsh: true
|
||||
workingDirectory: $(Pipeline.Workspace)
|
||||
displayName: Dump Package properties
|
||||
|
||||
# Generate package spec JSON files for tagging the repo
|
||||
- ${{ each artifact in parameters.Artifacts }}:
|
||||
- pwsh: >-
|
||||
@ -226,6 +195,7 @@ jobs:
|
||||
-ItemType directory
|
||||
-Path $(Build.ArtifactStagingDirectory)
|
||||
-Name packages/${{ artifact.Name }}
|
||||
-Force
|
||||
displayName: Create package info artifact location
|
||||
|
||||
- pwsh: |
|
||||
@ -334,10 +304,47 @@ jobs:
|
||||
continueOnError: true
|
||||
condition: and(succeeded(), eq(variables['VerifyChangeLogForRelease'], 'true'))
|
||||
|
||||
- pwsh: |
|
||||
$packageJsonDest = Join-Path -Path $(Build.ArtifactStagingDirectory) PackageInfo
|
||||
$packageJsonSource = Join-Path -Path $(Build.ArtifactStagingDirectory) packages/PackageInfo
|
||||
mkdir $packageJsonDest
|
||||
Copy-Item $packageJsonSource/* $packageJsonDest -Force
|
||||
displayName: Copy Package Json
|
||||
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
|
||||
parameters:
|
||||
ArtifactPath: $(Build.ArtifactStagingDirectory)/packages
|
||||
ArtifactName: packages
|
||||
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
|
||||
parameters:
|
||||
ArtifactPath: $(Build.ArtifactStagingDirectory)/PackageInfo
|
||||
ArtifactName: PackageInfo
|
||||
|
||||
- task: Powershell@2
|
||||
inputs:
|
||||
filePath: $(System.DefaultWorkingDirectory)/eng/common/scripts/Create-APIReview.ps1
|
||||
arguments: >
|
||||
-ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name)
|
||||
-ArtifactPath "$(Build.ArtifactStagingDirectory)/packages"
|
||||
-ApiKey "$(azuresdk-apiview-apikey)"
|
||||
-SourceBranch $(Build.SourceBranchName)
|
||||
-DefaultBranch $(DefaultBranch)
|
||||
-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')
|
||||
)
|
||||
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
|
||||
- ${{ each artifact in parameters.Artifacts }}:
|
||||
- template: /eng/common/pipelines/templates/steps/detect-api-changes.yml
|
||||
parameters:
|
||||
ArtifactPath: $(Build.ArtifactStagingDirectory)\packages
|
||||
|
||||
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
|
||||
parameters:
|
||||
|
||||
@ -4,19 +4,9 @@ Param(
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $OutPath,
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $ApiKey,
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $SourceBranch,
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $DefaultBranch,
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $ParserPath,
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $ServicePath,
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $RepoName,
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $BuildId
|
||||
[string] $ServicePath
|
||||
)
|
||||
|
||||
Write-Host "$PSScriptRoot"
|
||||
@ -34,19 +24,15 @@ foreach ($artifact in $ArtifactList)
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Creating API review artifact for $($ArtifactName)"
|
||||
New-Item -ItemType Directory -Path $OutPath/$ArtifactName -force
|
||||
Write-Host "Creating API review artifact for $ArtifactName"
|
||||
New-Item -ItemType Directory -Path "$OutPath/packages/$ArtifactName" -Force
|
||||
$parentPath = Split-Path $ParserPath -Parent
|
||||
Write-Host "Contents in $($parentPath)"
|
||||
Write-Host "Contents in ${parentPath}:"
|
||||
Get-ChildItem -Path $parentPath -Recurse
|
||||
& $ParserPath -o $OutPath/$ArtifactName/$ArtifactName.json $SourcePath
|
||||
& $ParserPath -o "$OutPath/packages/$ArtifactName/${ArtifactName}_cpp.json" $SourcePath
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
Write-Host "Failed to generate API review file for $($ArtifactName)"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
$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
|
||||
@ -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 "PackageInfo") -Filter "${PackageName}.json" -ErrorAction Ignore)
|
||||
if ($artifact)
|
||||
{
|
||||
$packages = @{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user