Enable verify-samples to handle multiple service directories (#3793)
Co-authored-by: James Suplizio <jasupliz@microsoft.com>
This commit is contained in:
parent
9aeefefbbc
commit
fd3b8d2207
@ -1,15 +1,25 @@
|
||||
parameters:
|
||||
- name: ServiceDirectory
|
||||
type: string
|
||||
default: not-specified
|
||||
default: ''
|
||||
- name: ServiceDirectories
|
||||
type: string
|
||||
default: ''
|
||||
- name: ScriptDirectory
|
||||
type: string
|
||||
default: eng/common/scripts
|
||||
|
||||
steps:
|
||||
- pwsh: |
|
||||
# If the last path segment is an absolute path it will be used entirely.
|
||||
$root = [System.IO.Path]::Combine('$(Build.SourcesDirectory)', 'sdk', '${{ parameters.ServiceDirectory }}')
|
||||
Get-ChildItem $root -Filter *.md -Recurse | ${{ parameters.ScriptDirectory }}/Test-SampleMetadata.ps1 -AllowParentProducts
|
||||
# Take whichever parameter has been set. If set, ServiceDirectory will be a single path or
|
||||
# ServiceDirectories will be a comma separated list.
|
||||
$ServiceDirectories = '${{ coalesce(parameters.ServiceDirectory, parameters.ServiceDirectories) }}'
|
||||
$ScanPaths = @()
|
||||
foreach ($ServiceDirectory in $ServiceDirectories.Split(',')) {
|
||||
$ScanPath = [System.IO.Path]::Combine('$(Build.SourcesDirectory)', 'sdk', $ServiceDirectory)
|
||||
Write-Host "Adding $ScanPath to the scanned paths"
|
||||
$ScanPaths += $ScanPath
|
||||
}
|
||||
Get-ChildItem $ScanPaths -Filter *.md -Recurse | ${{ parameters.ScriptDirectory }}/Test-SampleMetadata.ps1 -AllowParentProducts
|
||||
displayName: Verify sample metadata
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user