Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions eng/common/pipelines/templates/steps/verify-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
parameters:
ScanPath: $(Build.SourcesDirectory)
Copy link
Member

Choose a reason for hiding this comment

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

This looks unrelated.

RepoRoot: $(Build.SourcesDirectory)
SettingsPath: '$(Build.SourcesDirectory)/eng/.docsettings.yml'
DocWardenVersion : '0.7.2'

steps:
- task: PowerShell@2
displayName: "Verify Readmes"
inputs:
filePath: "eng/common/scripts/Verify-Readme.ps1"
arguments: >
-DocWardenVersion ${{ parameters.DocWardenVersion }}
-ScanPath ${{ parameters.ScanPath }}
-RepoRoot ${{ parameters.RepoRoot }}
-SettingsPath ${{ parameters.SettingsPath }}
pwsh: true
21 changes: 21 additions & 0 deletions eng/common/scripts/Invoke-DevOpsAPI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,26 @@ function Add-RetentionLease {
-Headers (Get-DevOpsApiHeaders -Base64EncodedToken $Base64EncodedAuthToken) `
-MaximumRetryCount 3 `
-ContentType "application/json"
}

function Get-PackagesInArtifactFeed {
param (
$Organization="azure-sdk",
$Project="public",
[Parameter(Mandatory = $true)]
$FeedId,
$ApiVersion="6.1-preview.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we use preview version by default?

Copy link
Member Author

Choose a reason for hiding this comment

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

No particular reason. It apears to be the latest release.

$IncludeAllVersions="false",
$Base64EncodedAuthToken
)

$uri = "https://feeds.dev.azure.com/$Organization/$Project/_apis/packaging/Feeds/$FeedId/packages?api-version=$ApiVersion&includeAllVersions=$IncludeAllVersions"
Copy link
Member

Choose a reason for hiding this comment

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

Did you see my other feedback in your .NET PR? If we can avoid it lets not try pulling all the package versions when we can just use the package version min and max to get the package we want.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or could you default to latest one if no feed version passed in?

Copy link
Member Author

Choose a reason for hiding this comment

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

The challenge is to find the latest alpha version in the feed. Since sometime other versions other than alpha is listed as the latest thats why I need to retrieve all the abvailable versions.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can alternatively get all versions for the specific package, but I will have to call the api numerous times.

Copy link
Member

Choose a reason for hiding this comment

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

@chidozieononiwu I'd like to better understand why my suggestion at Azure/azure-sdk-for-net#25503 (comment) doesn't work before we move forward with this new API.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried it and it is very unreliable. I installes some packages and fails to install other which are clearly present in the feed. I can not say why these failures occur.

Copy link
Member

Choose a reason for hiding this comment

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

I just posted some updates to that code in your other PR. Please give that a try.

Also I would like us to avoid taking a dependency on the devops api directly as I'd prefer we use general nuget feed apis so we could move to another nuget feed, l like nuget if we needed to.


$packages = Invoke-RestMethod `
-Method GET `
-Uri $uri `
-Headers (Get-DevOpsApiHeaders -Base64EncodedToken $Base64EncodedAuthToken) `
-MaximumRetryCount 3

return $packages.value
Copy link
Contributor

Choose a reason for hiding this comment

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

I am curious what we returned here. Could you add some comments and example?

Copy link
Member Author

@chidozieononiwu chidozieononiwu Dec 8, 2021

Choose a reason for hiding this comment

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

The api returns an object like @{count, value}

}
16 changes: 12 additions & 4 deletions eng/common/scripts/Verify-Readme.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
# Wrapper Script for Readme Verification
[CmdletBinding()]
param (
[string]$DocWardenVersion = "0.7.1",

[string]$DocWardenVersion = "0.7.2",
Copy link
Member

Choose a reason for hiding this comment

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

I assume we should either just default the version either here or in the yml but not both.

[Parameter(Mandatory = $true)]
[string]$ScanPath,

[string]$RepoRoot,
[Parameter(Mandatory = $true)]
[string]$SettingsPath
)

pip install setuptools wheel --quiet
pip install doc-warden==$DocWardenVersion --quiet
ward scan -d $ScanPath -c $SettingsPath

if (-not [System.String]::IsNullOrWhiteSpace($RepoRoot))
{
ward scan -d $ScanPath -u $RepoRoot -c $SettingsPath
}
else
{
ward scan -d $ScanPath -c $SettingsPath
}