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

[TypeSpec APIView] Ensure apiview only triggers on packages directly changed by the pr #31871

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

Conversation

ckairen
Copy link
Member

@ckairen ckairen commented Dec 13, 2024

closes #31870

@ckairen ckairen added the Central-EngSys This issue is owned by the Engineering System team. label Dec 13, 2024
@ckairen ckairen self-assigned this Dec 13, 2024
Copy link

openapi-pipeline-app bot commented Dec 13, 2024

Next Steps to Merge

⌛ Please wait. Next steps to merge this PR are being evaluated by automation. ⌛

@azure-sdk
Copy link
Collaborator

azure-sdk commented Dec 13, 2024

API change check

APIView has identified API level changes in this PR and created following API reviews.

Microsoft.Contoso

@@ -17,12 +17,6 @@ model Employee is TrackedResource<EmployeeProperties> {

/** Employee properties */
model EmployeeProperties {
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
model EmployeeProperties {
model EmployeeProperties {
/** Age of employee */
age?: int32;
/** City of employee */
city?: string;

Copy link
Member Author

Choose a reason for hiding this comment

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

temp removal for testing

@ckairen ckairen marked this pull request as ready for review December 17, 2024 14:55
@praveenkuttappan
Copy link
Member

praveenkuttappan commented Dec 17, 2024

Do we really want to show entire npm package tree in log? This makes it difficult to read the logs that's more important.
For reference, I am talking about: https://dev.azure.com/azure-sdk/public/_build/results?buildId=4410154&view=logs&j=011e1ec8-6569-5e69-4f06-baf193d1351e&t=91baa004-7830-58b9-b0bb-1d930da3801a&l=44

@chidozieononiwu
Copy link
Member

Do we really want to show entire npm package tree in log? This makes it difficult to read the logs that's more important. For reference, I am talking about: https://dev.azure.com/azure-sdk/public/_build/results?buildId=4410154&view=logs&j=011e1ec8-6569-5e69-4f06-baf193d1351e&t=91baa004-7830-58b9-b0bb-1d930da3801a&l=44

You can use the log grouping similar to

LogGroupStart " Generating '$Type' APIView Tokens using '$ReadMeFilePath' for '$ResourceProvider'..."
& $command @arguments 2>&1 | ForEach-Object { Write-Host $_ }
LogGroupEnd

which will hide the lengthy logs in a toggle. That way people can still expand to view it if they want to.

while ($filePathParts.Length -and !$configFilesInTypeSpecProjects) {
$filePathParts = $filePathParts | Select-Object -SkipLast 1
$typeSpecProjectBaseDirectory = $filePathParts -join [IO.Path]::DirectorySeparatorChar
$configFilesInTypeSpecProjects = Get-ChildItem -Path $typeSpecProjectBaseDirectory -File "tspconfig.yaml"
Copy link
Member

Choose a reason for hiding this comment

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

This will still be an issue. It is possible to have tspconfig.yaml in sub folders for a shared project. Current logic will stop looking further upwards and move to next block to check if current directory has main.tsp. It won't come back and check again the parent path of current file path if there is no main.tsp.

We can simplify this logic that will work for shared projects also.

for each changed files, strip the prefix before `specification/' from path:

  1. check if current path has tspconfig.yaml and main.tsp.
  2. If yes, add this folder to project set
  3. If no, then go upwards and continue step 2 until we match current path to 'specification/[^\/]+/+`

APIView needs to be generated from paths that contain both main.tsp and tspconfig.yaml (at least to retain same behavior as current one.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm I don't think I understand the exact situation where this might not work.
The code right now is checking all parent directory of the changed file till we reach root.
line 96 $filePathParts = $filePathParts | Select-Object -SkipLast 1 deletes the leaf directory on each iteration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Central-EngSys This issue is owned by the Engineering System team. TypeSpec Authored with TypeSpec
Projects
Status: 🆕 New
Status: 🤔 Triage
Development

Successfully merging this pull request may close these issues.

[TypeSpec APIView] Narrow down typespec apiview to trigger only on changed service
5 participants