Skip to content

Commit

Permalink
Make use of VerifyPackages to retrieve pkg properties
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Sep 16, 2020
1 parent 162d755 commit 96464cd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
3 changes: 2 additions & 1 deletion eng/common/pipelines/templates/steps/publish-blobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 19 additions & 18 deletions eng/common/scripts/copy-docs-to-blobstorage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 96464cd

Please sign in to comment.