From 7e48bd2af2d1b0181f9ff3e42a73c6ea8c7b2cc3 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 18 Sep 2020 00:41:13 +0000 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools repository for Tools PR 1019 --- .../templates/steps/publish-blobs.yml | 1 - .../templates/steps/verify-links.yml | 2 +- .../scripts/copy-docs-to-blobstorage.ps1 | 48 +++++++++---------- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/eng/common/pipelines/templates/steps/publish-blobs.yml b/eng/common/pipelines/templates/steps/publish-blobs.yml index 773fb31b274e2..5888edff87d12 100644 --- a/eng/common/pipelines/templates/steps/publish-blobs.yml +++ b/eng/common/pipelines/templates/steps/publish-blobs.yml @@ -25,7 +25,6 @@ steps: -BlobName "${{ parameters.BlobName }}" -PublicArtifactLocation "${{ parameters.ArtifactLocation }}" -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)master" - -WorkingDirectory "$(System.DefaultWorkingDirectory)" pwsh: true workingDirectory: $(Pipeline.Workspace) displayName: Copy Docs to Blob diff --git a/eng/common/pipelines/templates/steps/verify-links.yml b/eng/common/pipelines/templates/steps/verify-links.yml index eaa2dd1426d04..b23a266ccae56 100644 --- a/eng/common/pipelines/templates/steps/verify-links.yml +++ b/eng/common/pipelines/templates/steps/verify-links.yml @@ -4,7 +4,7 @@ parameters: WorkingDirectory: '$(System.DefaultWorkingDirectory)' ScriptDirectory: 'eng/common/scripts' Recursive: $false - CheckLinkGuidance: $false + CheckLinkGuidance: $true Urls: '(Get-ChildItem -Path ./ -Recurse -Include *.md)' BranchReplaceRegex: "^(${env:SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI}.*/(?:blob|tree)/)master(/.*)$" BranchReplacementName: "${env:SYSTEM_PULLREQUEST_SOURCECOMMITID}" diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index b1306692408dd..9b7dea48b1d5d 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -9,8 +9,7 @@ param ( $ExitOnError=1, $UploadLatest=1, $PublicArtifactLocation = "", - $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master", - $WorkingDirectory + $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master" ) . (Join-Path $PSScriptRoot artifact-metadata-parsing.ps1) @@ -258,31 +257,30 @@ if ($Language -eq "javascript") if ($Language -eq "dotnet") { - $PublishedPkgs = Get-ChildItem "$($DocLocation)" | Where-Object -FilterScript {$_.Name.EndsWith(".nupkg") -and -not $_.Name.EndsWith(".symbols.nupkg")} - $PublishedDocs = Get-ChildItem "$($DocLocation)" | Where-Object -FilterScript {$_.Name.EndsWith("docs.zip")} + $PublishedPkgs = Get-ChildItem "$($DocLocation)/packages" | Where-Object -FilterScript {$_.Name.EndsWith(".nupkg") -and -not $_.Name.EndsWith(".symbols.nupkg")} + $PublishedDocs = Get-ChildItem "$($DocLocation)" | Where-Object -FilterScript {$_.Name.StartsWith("Docs.")} - if (($PublishedPkgs.Count -gt 1) -or ($PublishedDoc.Count -gt 1)) - { - Write-Host "$($DocLocation) should contain only one (1) published package and docs" - Write-Host "No of Packages $($PublishedPkgs.Count)" - Write-Host "No of Docs $($PublishedDoc.Count)" - exit 1 - } - - $DocsStagingDir = "$WorkingDirectory/docstaging" - $TempDir = "$WorkingDirectory/temp" - - New-Item -ItemType directory -Path $DocsStagingDir - New-Item -ItemType directory -Path $TempDir - - Expand-Archive -LiteralPath $PublishedDocs[0].FullName -DestinationPath $DocsStagingDir - $pkgProperties = ParseNugetPackage -pkg $PublishedPkgs[0].FullName -workingDirectory $TempDir + foreach ($Item in $PublishedDocs) { + $PkgName = $Item.Name.Remove(0, 5) + $PkgFullName = $PublishedPkgs | Where-Object -FilterScript {$_.Name -match "$($PkgName).\d"} - Write-Host "Start Upload for $($pkgProperties.Tag)" - Write-Host "DocDir $($DocsStagingDir)" - Write-Host "PkgName $($pkgProperties.PackageId)" - Write-Host "DocVersion $($pkgProperties.PackageVersion)" - Upload-Blobs -DocDir "$($DocsStagingDir)" -PkgName $pkgProperties.PackageId -DocVersion $pkgProperties.PackageVersion -ReleaseTag $pkgProperties.Tag + if (($PkgFullName | Measure-Object).count -eq 1) + { + $DocVersion = $PkgFullName[0].BaseName.Remove(0, $PkgName.Length + 1) + + Write-Host "Start Upload for $($PkgName)/$($DocVersion)" + Write-Host "DocDir $($Item)" + Write-Host "PkgName $($PkgName)" + Write-Host "DocVersion $($DocVersion)" + $releaseTag = RetrieveReleaseTag "Nuget" $PublicArtifactLocation + Upload-Blobs -DocDir "$($Item)" -PkgName $PkgName -DocVersion $DocVersion -ReleaseTag $releaseTag + } + else + { + Write-Host "Package with the same name Exists. Upload Skipped" + continue + } + } } if ($Language -eq "python")