Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 1559 (Azure#18064)
Browse files Browse the repository at this point in the history
* Handle empty files in Test-SampleMetadata

Relates to Azure/azure-sdk-for-java#20684

* Remove condition from verify-samples

* Use forward slash in path

* Fix directory typo

* Remove invalid 'telemetry' product slug

Relates to Azure#17991

* Disable verify-samples template

Opened Azure#18066 to track re-enabling it.

Co-authored-by: Heath Stewart <heaths@microsoft.com>
  • Loading branch information
azure-sdk and heaths authored Apr 15, 2021
1 parent 6fb418f commit f394ae8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
8 changes: 2 additions & 6 deletions eng/common/pipelines/templates/steps/verify-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ parameters:
- name: ScriptDirectory
type: string
default: eng/common/scripts
- name: Condition
type: boolean
default: succeeded()

steps:
- pwsh: |
# If the last path segment is an absolute path it will be used entirely.
$root = [System.IO.Path]::Combine('$(Build.SourcesDireectory)', 'sdk', '${{ parameters.ServiceDirectory }}')
Get-ChildItem $root -Filter *.md -Recurse | ${{ parameters.ScriptDirectory }}\Test-SampleMetadata.ps1 -AllowParentProducts
$root = [System.IO.Path]::Combine('$(Build.SourcesDirectory)', 'sdk', '${{ parameters.ServiceDirectory }}')
Get-ChildItem $root -Filter *.md -Recurse | ${{ parameters.ScriptDirectory }}/Test-SampleMetadata.ps1 -AllowParentProducts
displayName: Verify sample metadata
workingDirectory: $(Build.SourcesDirectory)
condition: ${{ parameters.Condition }}
4 changes: 3 additions & 1 deletion eng/common/scripts/Test-SampleMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ process {
}

[string[]] $content = $file | Get-Content
if (!$content[0].StartsWith('---')) {
if (!$content -or !$content[0].StartsWith('---')) {
Write-Verbose "Skipping $($file.FullName): does not contain frontmatter"
continue
}

Write-Verbose "Checking $($file.FullName)"

# Reset metadata and create mutable collections.
$products = [System.Collections.Generic.List[string]]::new()

Expand Down
6 changes: 3 additions & 3 deletions eng/pipelines/templates/steps/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ steps:
ServiceName: ${{parameters.ServiceDirectory}}
ForRelease: false

- template: /eng/common/pipelines/templates/steps/verify-samples.yml
parameters:
ServiceDirectory: ${{parameters.ServiceDirectory}}
# - template: /eng/common/pipelines/templates/steps/verify-samples.yml
# parameters:
# ServiceDirectory: ${{parameters.ServiceDirectory}}

# Using --always-succeed so as not to block the build. Once package
# target is based on data available per-package the --always-succeed should
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ languages:
- python
products:
- azure
- azure-core-tracing-opentelemetry
urlFragment: azure-core-tracing-opentelemetry-samples
---

Expand Down

0 comments on commit f394ae8

Please sign in to comment.