-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Resolve bug in API View Script #31637
base: main
Are you sure you want to change the base?
Conversation
Next Steps to Merge⌛ Please wait. Next steps to merge this PR are being evaluated by automation. ⌛ |
PR validation pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment. |
@@ -111,15 +117,17 @@ function Invoke-SwaggerAPIViewParser { | |||
LogGroupEnd | |||
|
|||
$generatedAPIViewTokenFile = Get-ChildItem -File | Select-Object -First 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not know the expected outputted file name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the file named after the tag? If so is that a hacky way of getting the tag name as output or does it make since for it to be named that and we should get that value another way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added logic to get the tag on the pipeline side so I can pass the tag to the tool rather than relying on the tool to find the default tag.
$apiViewTokensFilePath = [System.IO.Path]::Combine($TokenDirectory, "$resourceProvider.$Type.json") | ||
LogInfo " Moving generated APIView Token file to '$apiViewTokensFilePath'" | ||
Move-Item -Path $generatedAPIViewTokenFile.FullName -Destination $apiViewTokensFilePath -Force > $null | ||
if (Test-Path -Path $generatedAPIViewTokenFile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this file doesn't exist I would assume the parser failed. Wouldn't we have a failing exit code to look at in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No necessarily. In the case where the tag is not found in the readme.md it will not create any APIView token but it will not be a failure.
} | ||
} | ||
|
||
LogGroupStart " Swagger APIView Tokens will be generated for the following configuration files..." | ||
$readmeFile | ForEach-Object { | ||
$swaggerReadMeFiles | ForEach-Object { | ||
LogInfo " - $_" | ||
} | ||
LogGroupEnd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below are we assuming the that default tag name doesn't change between the source and the target? What if they change the tag in the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The APIView is first created from the PR source branch using the default tag. Then a baseline is created on the target branch using the same tag if the tag is present in the PR. If not, no baseline is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the logic to revert to using the default tag if the new tag (source branch) is not found on the target branch
90a93c4
to
e880d77
Compare
Resolve Bug in Create APIView Script