Skip to content

Commit

Permalink
Revert "APIView Creation from PR for Go (Azure#24000)" (Azure#24125)
Browse files Browse the repository at this point in the history
This reverts commit 6c828dc.
  • Loading branch information
chidozieononiwu authored Feb 14, 2025
1 parent ff0577c commit a7658ce
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 134 deletions.
48 changes: 14 additions & 34 deletions eng/pipelines/templates/steps/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parameters:
NonShipping: false
LicenseCheck: true
IsSdkLibrary: true
ArtifactName: packages


steps:
- task: Powershell@2
Expand All @@ -19,25 +19,6 @@ steps:
displayName: Dump Package properties
condition: and(succeeded(), ${{ parameters.IsSdkLibrary }})

- pwsh: |
. $(Build.SourcesDirectory)/eng/scripts/apiview-helpers.ps1
$directoryToPublish = Join-Path -Path $(Build.ArtifactStagingDirectory) ${{ parameters.ArtifactName }}
New-APIViewArtifacts `
-ServiceDirectory '${{ parameters.ServiceDirectory }}' `
-OutputDirectory $(Build.ArtifactStagingDirectory) `
-DirectoryToPublish $directoryToPublish
Copy-Item "$(Build.ArtifactStagingDirectory)/PackageInfo" -Destination $directoryToPublish -Recurse
displayName: 'Create Go APIView Artifact'
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
parameters:
ArtifactName: ${{ parameters.ArtifactName }}
ArtifactPath: "$(Build.ArtifactStagingDirectory)/${{ parameters.ArtifactName }}"
CustomCondition: and(succeeded(), ${{ parameters.IsSdkLibrary }})

# Second publish of PackageInfo to avoid breakng release pipeline, should be cleaned up once release pipeline is updated
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
parameters:
ArtifactName: "PackageInfo"
Expand All @@ -46,24 +27,23 @@ steps:

- template: /eng/common/pipelines/templates/steps/set-default-branch.yml

- pwsh: |
. $(Build.SourcesDirectory)/eng/scripts/apiview-helpers.ps1
New-APIViewFromCI `
-ServiceDirectory '${{parameters.ServiceDirectory}}' `
-ArtifactPath '$(Build.ArtifactStagingDirectory)' `
-ApiKey '$(azuresdk-apiview-apikey)' `
-SourceBranch '$(Build.SourceBranchName)' `
-DefaultBranch '$(DefaultBranch)' `
-ConfigFileDir '$(Build.ArtifactStagingDirectory)/PackageInfo' `
-BuildId $(Build.BuildId) `
- task: Powershell@2
inputs:
filePath: $(Build.SourcesDirectory)/eng/scripts/Create-ApiReview.ps1
arguments: >
-ServiceDirectory '${{parameters.ServiceDirectory}}'
-OutPath '$(Build.ArtifactStagingDirectory)'
-ApiKey '$(azuresdk-apiview-apikey)'
-SourceBranch '$(Build.SourceBranchName)'
-DefaultBranch '$(DefaultBranch)'
-ConfigFileDir '$(Build.ArtifactStagingDirectory)/PackageInfo'
-BuildId $(Build.BuildId)
-RepoName '$(Build.Repository.Name)'
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Create API review for Go
workingDirectory: $(Pipeline.Workspace)
condition: and(succeeded(), ne(variables['Skip.CreateApiReview'], 'true') , ne(variables['Build.Reason'],'PullRequest'), eq(variables['System.TeamProject'], 'internal'))

- ${{ if eq(variables['Build.Reason'],'PullRequest') }}:
- template: /eng/common/pipelines/templates/steps/detect-api-changes.yml

- ${{ if and(ne(variables['Skip.PackageValidation'], 'true'), eq(variables['System.TeamProject'], 'internal')) }}:
- pwsh: |
. ./eng/common/scripts/common.ps1
Expand Down
39 changes: 39 additions & 0 deletions eng/scripts/Create-ApiReview.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Param(
[Parameter(Mandatory=$True)]
[string] $ServiceDirectory,
[Parameter(Mandatory=$True)]
[string] $OutPath,
[Parameter(Mandatory=$True)]
[string] $ApiKey,
[Parameter(Mandatory=$True)]
[string] $SourceBranch,
[Parameter(Mandatory=$True)]
[string] $DefaultBranch,
[Parameter(Mandatory=$True)]
[string] $ConfigFileDir,
[string] $RepoName,
[string] $BuildId,
[bool] $MarkPackageAsShipped = $false
)


Write-Host "$PSScriptRoot"
. (Join-Path $PSScriptRoot .. common scripts common.ps1)
$createReviewScript = (Join-Path $PSScriptRoot .. common scripts Create-APIReview.ps1)

$artifactList = @()
foreach ($sdk in (Get-AllPackageInfoFromRepo $ServiceDirectory))
{
Write-Host "Creating API review artifact for $($sdk.Name)"
New-Item -ItemType Directory -Path $OutPath/$($sdk.Name) -force
$fileName = Split-Path -Path $sdk.Name -Leaf
Compress-Archive -Path $sdk.DirectoryPath -DestinationPath $outPath/$($sdk.Name)/$fileName -force
Rename-Item $outPath/$($sdk.Name)/$fileName.zip -NewName "$fileName.gosource"

$artifactList += [PSCustomObject]@{
name = $sdk.Name
}
}

Write-Host "Create Go APIView using generated artifacts"
&($createReviewScript) -ArtifactList $artifactList -ArtifactPath $outPath -APIKey $ApiKey -SourceBranch $SourceBranch -DefaultBranch $DefaultBranch -ConfigFileDir $ConfigFileDir -RepoName $RepoName -BuildId $BuildId -MarkPackageAsShipped $MarkPackageAsShipped
100 changes: 0 additions & 100 deletions eng/scripts/apiview-helpers.ps1

This file was deleted.

0 comments on commit a7658ce

Please sign in to comment.