Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIView Creation from PR for Go #24000

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

chidozieononiwu
Copy link
Member

  • This adds a step to publish .gosource artifact and trigger call to APIView endpoint for detecting API changes

@chidozieononiwu
Copy link
Member Author

/azp run go - aztemplate

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@chidozieononiwu chidozieononiwu requested a review from a team as a code owner January 28, 2025 21:51
@chidozieononiwu
Copy link
Member Author

/azp run go - aztemplate - ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@chidozieononiwu
Copy link
Member Author

/azp run go - aztemplate - ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -13,6 +13,7 @@ class PackageProps {
[string]$SdkType
[boolean]$IsNewSdk
[string]$ArtifactName
[string]$ModuleName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can avoid it, I would prefer we not add a new property. I know other languages use ArtifactName for different things and it could potentially be used for module name as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove this as it turned out I don't even need it here. Go is not setting ArtifactName but instead Module name is added as NotePropertyName but it does not show up whren the properties are written to the PackageInfo file. Anyways the name property is sufficient for what I need to accomplish right now.

@@ -58,7 +58,7 @@ function Get-GoModuleProperties($goModPath)
$pkgProp.SdkType = $sdkType

$pkgProp | Add-Member -NotePropertyName "VersionFile" -NotePropertyValue $versionFile
$pkgProp | Add-Member -NotePropertyName "ModuleName" -NotePropertyValue $modName
$pkgProp.ModuleName = $modName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we use ArtifactName for the modPath and we add to ModName. Can we actually access ModuleName without it being on the base type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be accessed. But in the case where it is written to a file the property does not show up.

@chidozieononiwu chidozieononiwu force-pushed the apiView/goPullRequests branch 2 times, most recently from c9679c9 to d7d3aa0 Compare January 30, 2025 01:09
@chidozieononiwu
Copy link
Member Author

/azp run go - aztemplate - ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@chidozieononiwu
Copy link
Member Author

/azp run go - aztemplate - ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@chidozieononiwu
Copy link
Member Author

/azp run go - aztemplate - ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@chidozieononiwu
Copy link
Member Author

/azp run go - aztemplate - ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@chidozieononiwu
Copy link
Member Author

/azp run go - aztemplate - ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@chidozieononiwu chidozieononiwu force-pushed the apiView/goPullRequests branch 10 times, most recently from 22e46a3 to 56c2dae Compare January 31, 2025 08:25
@@ -101,13 +101,11 @@ function Get-AllPackageInfoFromRepo($serviceDirectory)
$searchPath = Join-Path $RepoRoot "sdk"
$pkgFiles = @()
if ($serviceDirectory) {
$searchPath = Join-Path $searchPath $serviceDirectory "go.mod"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous code was not doing recursive search when service directory is passed. I think Go has sub modules which contains go.mod and that's probably the reason we don't do Recurse to find package in service directory.

@benbp Can you please confirm if sub module also can have go.mod?

.PARAMETER DirectoryToPublish
Directory containing all artifacts to be publisehd to the pipeline
#>
function New-GoArtifacts {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please rename this function to Create-ApiView-Artifact to be more specific. Go does not have any artifact and this generic name will be misleading.

foreach ($sdk in (Get-AllPackageInfoFromRepo $ServiceDirectory))
{
Write-Host "Creating API review artifact for $($sdk.Name)"
$sdkDirectoryPath = Join-Path -Path $OutputDirectory $sdk.Name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the value of sdk.name? Go has same module name under different path and that's the reason it uses complete sdk path as package name. We cannot use just the name of last folder that contains go.mod to create unique package folders.

@@ -0,0 +1,100 @@
Write-Host "$PSScriptRoot"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also please rename this script to apiview-helpers.ps1?

-DirectoryToPublish $directoryToPublish

Copy-Item "$(Build.ArtifactStagingDirectory)/PackageInfo" -Destination $directoryToPublish -Recurse
displayName: 'Create Go Package Artifact'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
displayName: 'Create Go Package Artifact'
displayName: 'Create Go APIView Artifact'

- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
parameters:
ArtifactName: "PackageInfo"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we still need old PackageInfo for other EngSys tools?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔬 Dev in PR
Development

Successfully merging this pull request may close these issues.

3 participants