11# Note, due to how `Expand-Archive` is leveraged in this script,
22# powershell core is a requirement for successful execution.
3+ [CmdletBinding ()]
34param (
45 $AzCopy ,
56 $DocLocation ,
@@ -199,32 +200,32 @@ function Upload-Blobs
199200 LogDebug " Final Dest $ ( $DocDest ) /$ ( $PkgName ) /$ ( $DocVersion ) "
200201 LogDebug " Release Tag $ ( $ReleaseTag ) "
201202
202- # Use the step to replace default branch link to release tag link
203+ # Use the step to replace default branch link to release tag link
203204 if ($ReleaseTag ) {
204- foreach ($htmlFile in (Get-ChildItem $DocDir - include * .html - r))
205+ foreach ($htmlFile in (Get-ChildItem $DocDir - include * .html - r))
205206 {
206207 $fileContent = Get-Content - Path $htmlFile - Raw
207208 $updatedFileContent = $fileContent -replace $RepoReplaceRegex , " `$ {1}$ReleaseTag "
208209 if ($updatedFileContent -ne $fileContent ) {
209210 Set-Content - Path $htmlFile - Value $updatedFileContent - NoNewLine
210211 }
211212 }
212- }
213+ }
213214 else {
214215 LogWarning " Not able to do the default branch link replacement, since no release tag found for the release. Please manually check."
215- }
216-
216+ }
217+
217218 LogDebug " Uploading $ ( $PkgName ) /$ ( $DocVersion ) to $ ( $DocDest ) ..."
218219 & $ ($AzCopy ) cp " $ ( $DocDir ) /**" " $ ( $DocDest ) /$ ( $PkgName ) /$ ( $DocVersion ) $ ( $SASKey ) " -- recursive= true -- cache- control " max-age=300, must-revalidate"
219-
220+
220221 LogDebug " Handling versioning files under $ ( $DocDest ) /$ ( $PkgName ) /versioning/"
221222 $versionsObj = (Update-Existing - Versions - PkgName $PkgName - PkgVersion $DocVersion - DocDest $DocDest )
222- $latestVersion = $versionsObj.LatestGAPackage
223+ $latestVersion = $versionsObj.LatestGAPackage
223224 if (! $latestVersion ) {
224- $latestVersion = $versionsObj.LatestPreviewPackage
225+ $latestVersion = $versionsObj.LatestPreviewPackage
225226 }
226227 LogDebug " Fetching the latest version $latestVersion "
227-
228+
228229 if ($UploadLatest -and ($latestVersion -eq $DocVersion ))
229230 {
230231 LogDebug " Uploading $ ( $PkgName ) to latest folder in $ ( $DocDest ) ..."
243244 See https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/common_engsys.md#code-structure"
244245}
245246
247+ # If we hit a failure then dump out the azcopy logs to help with debugging
248+ if ($LASTEXITCODE )
249+ {
250+ Write-Host " Copying failed with error code [$LASTEXITCODE ]. Dumping the logs to help diagnose."
251+ Get-ChildItem $env: UserProfile \.azcopy - Filter * .log | ForEach-Object { " LOG: " + $_ ; Get-Content $_ ; }
252+ }
0 commit comments