Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools repository (#27079)
Browse files Browse the repository at this point in the history
Sync eng/common directory with azure-sdk-tools repository
  • Loading branch information
azure-sdk authored Sep 11, 2023
1 parent a70d1ef commit fd1ff8f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
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

0 comments on commit fd1ff8f

Please sign in to comment.