Skip to content
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

Sync eng/common directory with azure-sdk-tools repository #38606

Merged
merged 1 commit into from
Sep 11, 2023
Merged
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
42 changes: 29 additions & 13 deletions eng/common/scripts/Service-Level-Readme-Automation.ps1
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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",
Expand All @@ -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
}
}

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) {
Expand Down
10 changes: 10 additions & 0 deletions eng/common/scripts/Verify-RequiredDocsJsonMembers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down