From 96464cd9339a4d26700cbc6a57b91b4fe87af52b Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Mon, 14 Sep 2020 11:42:44 -0700 Subject: [PATCH] Make use of VerifyPackages to retrieve pkg properties --- .../templates/steps/publish-blobs.yml | 3 +- .../scripts/copy-docs-to-blobstorage.ps1 | 37 ++++++++++--------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/eng/common/pipelines/templates/steps/publish-blobs.yml b/eng/common/pipelines/templates/steps/publish-blobs.yml index 94bddeeeed68a..55bef2f04c642 100644 --- a/eng/common/pipelines/templates/steps/publish-blobs.yml +++ b/eng/common/pipelines/templates/steps/publish-blobs.yml @@ -25,7 +25,8 @@ steps: -BlobName "${{ parameters.BlobName }}" -PublicArtifactLocation "${{ parameters.ArtifactLocation }}" -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)master" - -BinDirectory "$(Build.BinariesDirectory)" + -WorkingDirectory "$(System.DefaultWorkingDirectory)" + -ReleaseSha: "$(Build.SourceVersion)" pwsh: true workingDirectory: $(Pipeline.Workspace) displayName: Copy Docs to Blob diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index debbc010ba5dc..69e9fc28620c3 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -6,11 +6,12 @@ param ( $SASKey, $Language, $BlobName, - $BinDirectory, $ExitOnError=1, $UploadLatest=1, $PublicArtifactLocation = "", - $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master" + $RepoReplaceRegex = "(https://github.com/.*/(?:blob|tree)/)master", + $WorkingDirectory, + $ReleaseSha ) . (Join-Path $PSScriptRoot artifact-metadata-parsing.ps1) @@ -266,22 +267,22 @@ if ($Language -eq "dotnet") Write-Host "$($DocLocation) contains more published artifacts than expected." exit 1 } - $pkgZip = $PublishedPkgs[0] - $docZip = $PublishedDocs[0] - $pkgName = Split-Path -Path $DocLocation -Leaf - $version = $pkgZip.BaseName.Replace("${pkgName}.","") - - New-Item -ItemType directory -Path "$BinDirectory/docstoupload" - Expand-Archive -LiteralPath $docZip.FullName -DestinationPath "$BinDirectory/docstoupload" - - Write-Host "Start Upload for $($PkgName)/$($version)" - Write-Host "DocDir $($BinDirectory)/docstoupload" - Write-Host "PkgName $($pkgName)" - Write-Host "DocVersion $($version)" - New-Item -ItemType directory -Path "$BinDirectory/publicartifactscopy" - Copy-Item -Path "$PublicArtifactLocation/*.nupkg" -Destination "$BinDirectory/publicartifactscopy" -Exclude '*.symbols.nupkg' - $releaseTag = RetrieveReleaseTag "Nuget" "$BinDirectory/publicartifactscopy" - Upload-Blobs -DocDir "$($BinDirectory)/docstoupload" -PkgName $pkgName -DocVersion $version -ReleaseTag $releaseTag + + $DocsStagingDir = "$WorkingDirectory/docstaging" + $TempDir = "$WorkingDirectory/temp" + + New-Item -ItemType directory -Path "$DocsStagingDir" + New-Item -ItemType directory -Path "$TempPackageDir" + + Expand-Archive -LiteralPath $PublishedDocs[0].FullName -DestinationPath "$DocsStagingDir" + $pkgProperties = VerifyPackages -pkgRepository "Nuget" -artifactLocation $DocLocation -workingDirectory "$TempDir" ` + -apiUrl "https://api.github.com/repos/Azure/azure-sdk-for-net" -releasSha $ReleaseSha -continueOnError $True + + Write-Host "Start Upload for $($pkgProperties.Tag)" + Write-Host "DocDir $($DocsStagingDir)" + Write-Host "PkgName $($pkgProperties.PackageId)" + Write-Host "DocVersion $($pkgProperties.PackageVersion)" + Upload-Blobs -DocDir "$($TempPackageDir)" -PkgName $pkgProperties.PackageId -DocVersion $pkgProperties.PackageVersion -ReleaseTag $pkgProperties.Tag } if ($Language -eq "python")