diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 5ce471466c..9128ab8029 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -74,6 +74,7 @@ "avro", "antkmsft", "azcmagent", + "azcopy", "azcore", "azsdk", "azsdkengsys", diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index caaa7666ef..c22a9527a9 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -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: diff --git a/eng/scripts/Create-APIReview.ps1 b/eng/scripts/Generate-APIReview-Token-Files.ps1 similarity index 51% rename from eng/scripts/Create-APIReview.ps1 rename to eng/scripts/Generate-APIReview-Token-Files.ps1 index c10927c314..63a0b50512 100644 --- a/eng/scripts/Create-APIReview.ps1 +++ b/eng/scripts/Generate-APIReview-Token-Files.ps1 @@ -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 diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index ed22d5a5a5..738d7f2be4 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -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 = @{