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 for PR 5412 #34091

Merged
merged 1 commit into from
Feb 13, 2023
Merged
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
25 changes: 16 additions & 9 deletions eng/common/scripts/copy-docs-to-blobstorage.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Note, due to how `Expand-Archive` is leveraged in this script,
# powershell core is a requirement for successful execution.
[CmdletBinding()]
param (
$AzCopy,
$DocLocation,
Expand Down Expand Up @@ -199,32 +200,32 @@ function Upload-Blobs
LogDebug "Final Dest $($DocDest)/$($PkgName)/$($DocVersion)"
LogDebug "Release Tag $($ReleaseTag)"

# Use the step to replace default branch link to release tag link
# Use the step to replace default branch link to release tag link
if ($ReleaseTag) {
foreach ($htmlFile in (Get-ChildItem $DocDir -include *.html -r))
foreach ($htmlFile in (Get-ChildItem $DocDir -include *.html -r))
{
$fileContent = Get-Content -Path $htmlFile -Raw
$updatedFileContent = $fileContent -replace $RepoReplaceRegex, "`${1}$ReleaseTag"
if ($updatedFileContent -ne $fileContent) {
Set-Content -Path $htmlFile -Value $updatedFileContent -NoNewLine
}
}
}
}
else {
LogWarning "Not able to do the default branch link replacement, since no release tag found for the release. Please manually check."
}
}

LogDebug "Uploading $($PkgName)/$($DocVersion) to $($DocDest)..."
& $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/$($DocVersion)$($SASKey)" --recursive=true --cache-control "max-age=300, must-revalidate"

LogDebug "Handling versioning files under $($DocDest)/$($PkgName)/versioning/"
$versionsObj = (Update-Existing-Versions -PkgName $PkgName -PkgVersion $DocVersion -DocDest $DocDest)
$latestVersion = $versionsObj.LatestGAPackage
$latestVersion = $versionsObj.LatestGAPackage
if (!$latestVersion) {
$latestVersion = $versionsObj.LatestPreviewPackage
$latestVersion = $versionsObj.LatestPreviewPackage
}
LogDebug "Fetching the latest version $latestVersion"

if ($UploadLatest -and ($latestVersion -eq $DocVersion))
{
LogDebug "Uploading $($PkgName) to latest folder in $($DocDest)..."
Expand All @@ -243,3 +244,9 @@ else
See https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/common_engsys.md#code-structure"
}

# If we hit a failure then dump out the azcopy logs to help with debugging
if ($LASTEXITCODE)
{
Write-Host "Copying failed with error code [$LASTEXITCODE]. Dumping the logs to help diagnose."
Get-ChildItem $env:UserProfile\.azcopy -Filter *.log | ForEach-Object { "LOG: " + $_; Get-Content $_; }
}