-
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
Integrate Armstrong Validation into the spec PR check. #28829
base: main
Are you sure you want to change the base?
Conversation
Next Steps to Merge✅ All automated merging requirements have been met! To get your PR merged, see aka.ms/azsdk/specreview/merge. |
Swagger Validation Report
|
Swagger Generation Artifacts
|
PR validation pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment. |
eng/scripts/Armstrong-Validation.ps1
Outdated
function Validate-Terraform-Error($repoPath, $filePath) { | ||
$fileDirectory = (Split-Path -Parent $filePath) | ||
|
||
$outputDirectory = Join-Path -Path $fileDirectory -ChildPath "58d50903-36e9-4f57-a1e5-f246d7ecdec0" |
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.
You should create a unique temp directory using code like this:
$outputDirectory = Join-Path -Path $fileDirectory -ChildPath "58d50903-36e9-4f57-a1e5-f246d7ecdec0" | |
$outputDirectory= [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) | |
try { | |
New-Item -Path $outputDirectory -ItemType Directory |
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.
code updated. Thanks.
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.
Improve code to generate and cleanup temp folder
vmImage: ubuntu-22.04 | ||
|
||
# refer to https://github.com/MicrosoftDocs/pipelines-go/blob/main/azure-pipelines.yml | ||
variables: |
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.
Could the pipeline work without setting these vars? Because these would also need to be different on Windows vs Linux.
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.
updated
333fb0e
to
da9dda0
Compare
eda376f
to
440c631
Compare
$outputDirectory = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) | ||
$result = @() | ||
|
||
try { | ||
if (!(Test-Path -Path $outputDirectory)) { | ||
New-Item -Path $outputDirectory -ItemType Directory *> $null |
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.
$outputDirectory = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) | |
$result = @() | |
try { | |
if (!(Test-Path -Path $outputDirectory)) { | |
New-Item -Path $outputDirectory -ItemType Directory *> $null | |
$outputDirectory = [System.IO.Directory]::CreateTempSubdirectory() | |
$result = @() | |
try { |
.NET 7 added an easier way to do this.
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.
Use simpler API to create temp directory
|
||
# -NoEnumerate to prevent single-element arrays from being collapsed to a single object | ||
# -AsHashtable is closer to raw JSON than PSCustomObject | ||
$suppressions = npx get-suppressions ArmstrongValidation $fileInSpecFolder | ConvertFrom-Json -NoEnumerate -AsHashtable |
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.
@ms-zhenhua: I updated your PR to use the new get-suppressions
shared code added in #28927, #29001, and #29008.
You may also want to add parameter $CheckAllUnder
to your script for easier testing, like this:
Migrate from #28803