Sync eng/common directory with azure-sdk-tools repository (#4937)

This commit is contained in:
Azure SDK Bot 2023-09-11 09:10:01 -07:00 committed by GitHub
parent 329eda3114
commit 9d97c40d3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 15 deletions

View File

@ -1,12 +1,12 @@
<#
.SYNOPSIS
The script is to generate service level readme if it is missing.
The script is to generate service level readme if it is missing.
For exist ones, we do 2 things here:
1. Generate the client but not import to the existing service level readme.
2. Update the metadata of service level readme
.DESCRIPTION
Given a doc repo location, and the credential for fetching the ms.author.
Given a doc repo location, and the credential for fetching the ms.author.
Generate missing service level readme and updating metadata of the existing ones.
.PARAMETER DocRepoLocation
@ -53,9 +53,9 @@ $fullMetadata = Get-CSVMetadata
$monikers = @("latest", "preview")
foreach($moniker in $monikers) {
# The onboarded packages return is key-value pair, which key is the package index, and value is the package info from {metadata}.json
# E.g.
# E.g.
# Key as: @azure/storage-blob
# Value as:
# Value as:
# {
# "Name": "@azure/storage-blob",
# "Version": "12.10.0-beta.1",
@ -73,22 +73,38 @@ foreach($moniker in $monikers) {
$onboardedPackages = &$GetOnboardedDocsMsPackagesForMonikerFn `
-DocRepoLocation $DocRepoLocation -moniker $moniker
$csvMetadata = @()
foreach($metadataEntry in $fullMetadata) {
if ($metadataEntry.Package -and $metadataEntry.Hide -ne 'true') {
$pkgKey = GetPackageKey $metadataEntry
if($onboardedPackages.ContainsKey($pkgKey)) {
if ($onboardedPackages[$pkgKey] -and $onboardedPackages[$pkgKey].DirectoryPath) {
if (!($metadataEntry.PSObject.Members.Name -contains "DirectoryPath")) {
Add-Member -InputObject $metadataEntry `
-MemberType NoteProperty `
-Name DirectoryPath `
-Value $onboardedPackages[$pkgKey].DirectoryPath
}
}
$csvMetadata += $metadataEntry
if (!$onboardedPackages.ContainsKey($pkgKey)) {
continue
}
$package = $onboardedPackages[$pkgKey]
if (!$package) {
$csvMetadata += $metadataEntry
continue
}
# If the metadata JSON entry has a DirectoryPath, but the CSV entry
# does not, add the DirectoryPath to the CSV entry
if (($package.PSObject.Members.Name -contains 'DirectoryPath') `
-and !($metadataEntry.PSObject.Members.Name -contains "DirectoryPath") ) {
Add-Member -InputObject $metadataEntry `
-MemberType NoteProperty `
-Name DirectoryPath `
-Value $package.DirectoryPath
}
$csvMetadata += $metadataEntry
}
}
$packagesForService = @{}
$allPackages = GetPackageLookup $csvMetadata
foreach ($metadataKey in $allPackages.Keys) {

View File

@ -91,6 +91,16 @@ function Test-RequiredDocsJsonMembers($moniker) {
$script:FoundError = $true
}
if ($fileObject.PSObject.Members.Name -contains 'DirectoryPath') {
if ($null -eq $fileObject.DirectoryPath) {
Write-Host "$path has a null DirectoryPath member. If the DirectoryPath is unknown please use the value `"`"."
$script:FoundError = $true
}
} else {
Write-Host "$path is missing its DirectoryPath member. If the DirectoryPath is unknown please use the value `"`"."
$script:FoundError = $true
}
if ($Language -eq "java") {
if ($fileObject.PSObject.Members.Name -contains "Group")
{

View File

@ -401,7 +401,7 @@ function CheckDependencies()
$job | Remove-Job -Force
if (($result -eq $null -and $job.State -ne "Completed") -or ($result | Select -Last 1) -ne 0) {
throw "Docker does not appear to be running. Start/restart docker."
throw "Docker does not appear to be running. Start/restart docker or re-run this script with -SkipPushImages"
}
}