Skip to content

Commit 032ce27

Browse files
Remove SAS token from GitHubIO blob storage docs publish (#35690)
Co-authored-by: James Suplizio <[email protected]>
1 parent f6b4e0c commit 032ce27

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

eng/common/pipelines/templates/steps/publish-blobs.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
parameters:
22
FolderForUpload: ''
3-
BlobSASKey: ''
43
TargetLanguage: ''
54
BlobName: ''
65
ScriptPath: ''
@@ -17,17 +16,20 @@ steps:
1716
workingDirectory: $(Build.BinariesDirectory)
1817
displayName: Download and Extract azcopy Zip
1918

20-
- task: Powershell@2
19+
- task: AzurePowerShell@5
20+
displayName: 'Copy Docs to Blob Storage'
21+
continueOnError: false
2122
inputs:
22-
filePath: ${{ parameters.ScriptPath }}
23-
arguments: >
23+
azureSubscription: 'Azure SDK Artifacts'
24+
ScriptType: 'FilePath'
25+
ScriptPath: ${{ parameters.ScriptPath }}
26+
ScriptArguments: >
2427
-AzCopy $(Resolve-Path "$(Build.BinariesDirectory)/azcopy/azcopy_windows_amd64_*/azcopy.exe")[0]
2528
-DocLocation "${{ parameters.FolderForUpload }}"
26-
-SASKey "${{ parameters.BlobSASKey }}"
2729
-BlobName "${{ parameters.BlobName }}"
2830
-PublicArtifactLocation "${{ parameters.ArtifactLocation }}"
2931
-RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)$(DefaultBranch)"
32+
azurePowerShellVersion: latestVersion
3033
pwsh: true
31-
workingDirectory: $(Pipeline.Workspace)
32-
displayName: Copy Docs to Blob
33-
continueOnError: false
34+
env:
35+
AZCOPY_AUTO_LOGIN_TYPE: 'PSCRED'

eng/common/scripts/copy-docs-to-blobstorage.ps1

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
param (
55
$AzCopy,
66
$DocLocation,
7-
$SASKey,
87
$BlobName,
98
$ExitOnError=1,
109
$UploadLatest=1,
@@ -176,9 +175,9 @@ function Update-Existing-Versions
176175
$sortedVersionObj.LatestGAPackage | Out-File -File "$($DocLocation)/latest-ga" -Force -NoNewLine
177176
$sortedVersionObj.LatestPreviewPackage | Out-File -File "$($DocLocation)/latest-preview" -Force -NoNewLine
178177

179-
& $($AzCopy) cp "$($DocLocation)/versions" "$($DocDest)/$($PkgName)/versioning/versions$($SASKey)" --cache-control "max-age=300, must-revalidate"
180-
& $($AzCopy) cp "$($DocLocation)/latest-preview" "$($DocDest)/$($PkgName)/versioning/latest-preview$($SASKey)" --cache-control "max-age=300, must-revalidate"
181-
& $($AzCopy) cp "$($DocLocation)/latest-ga" "$($DocDest)/$($PkgName)/versioning/latest-ga$($SASKey)" --cache-control "max-age=300, must-revalidate"
178+
& $($AzCopy) cp "$($DocLocation)/versions" "$($DocDest)/$($PkgName)/versioning/versions" --cache-control "max-age=300, must-revalidate"
179+
& $($AzCopy) cp "$($DocLocation)/latest-preview" "$($DocDest)/$($PkgName)/versioning/latest-preview" --cache-control "max-age=300, must-revalidate"
180+
& $($AzCopy) cp "$($DocLocation)/latest-ga" "$($DocDest)/$($PkgName)/versioning/latest-ga" --cache-control "max-age=300, must-revalidate"
182181
return $sortedVersionObj
183182
}
184183

@@ -216,7 +215,7 @@ function Upload-Blobs
216215
}
217216

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

221220
LogDebug "Handling versioning files under $($DocDest)/$($PkgName)/versioning/"
222221
$versionsObj = (Update-Existing-Versions -PkgName $PkgName -PkgVersion $DocVersion -DocDest $DocDest)
@@ -229,7 +228,7 @@ function Upload-Blobs
229228
if ($UploadLatest -and ($latestVersion -eq $DocVersion))
230229
{
231230
LogDebug "Uploading $($PkgName) to latest folder in $($DocDest)..."
232-
& $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/latest$($SASKey)" --recursive=true --cache-control "max-age=300, must-revalidate"
231+
& $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/latest" --recursive=true --cache-control "max-age=300, must-revalidate"
233232
}
234233
}
235234

0 commit comments

Comments
 (0)