Skip to content

Commit

Permalink
Remove SAS token from GitHubIO blob storage docs publish (#8288)
Browse files Browse the repository at this point in the history
  • Loading branch information
JimSuplizio authored May 17, 2024
1 parent f57355a commit 838f4ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
18 changes: 10 additions & 8 deletions eng/common/pipelines/templates/steps/publish-blobs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
parameters:
FolderForUpload: ''
BlobSASKey: ''
TargetLanguage: ''
BlobName: ''
ScriptPath: ''
Expand All @@ -17,17 +16,20 @@ steps:
workingDirectory: $(Build.BinariesDirectory)
displayName: Download and Extract azcopy Zip

- task: Powershell@2
- task: AzurePowerShell@5
displayName: 'Copy Docs to Blob Storage'
continueOnError: false
inputs:
filePath: ${{ parameters.ScriptPath }}
arguments: >
azureSubscription: 'Azure SDK Artifacts'
ScriptType: 'FilePath'
ScriptPath: ${{ parameters.ScriptPath }}
ScriptArguments: >
-AzCopy $(Resolve-Path "$(Build.BinariesDirectory)/azcopy/azcopy_windows_amd64_*/azcopy.exe")[0]
-DocLocation "${{ parameters.FolderForUpload }}"
-SASKey "${{ parameters.BlobSASKey }}"
-BlobName "${{ parameters.BlobName }}"
-PublicArtifactLocation "${{ parameters.ArtifactLocation }}"
-RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)$(DefaultBranch)"
azurePowerShellVersion: latestVersion
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Copy Docs to Blob
continueOnError: false
env:
AZCOPY_AUTO_LOGIN_TYPE: 'PSCRED'
11 changes: 5 additions & 6 deletions eng/common/scripts/copy-docs-to-blobstorage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
param (
$AzCopy,
$DocLocation,
$SASKey,
$BlobName,
$ExitOnError=1,
$UploadLatest=1,
Expand Down Expand Up @@ -176,9 +175,9 @@ function Update-Existing-Versions
$sortedVersionObj.LatestGAPackage | Out-File -File "$($DocLocation)/latest-ga" -Force -NoNewLine
$sortedVersionObj.LatestPreviewPackage | Out-File -File "$($DocLocation)/latest-preview" -Force -NoNewLine

& $($AzCopy) cp "$($DocLocation)/versions" "$($DocDest)/$($PkgName)/versioning/versions$($SASKey)" --cache-control "max-age=300, must-revalidate"
& $($AzCopy) cp "$($DocLocation)/latest-preview" "$($DocDest)/$($PkgName)/versioning/latest-preview$($SASKey)" --cache-control "max-age=300, must-revalidate"
& $($AzCopy) cp "$($DocLocation)/latest-ga" "$($DocDest)/$($PkgName)/versioning/latest-ga$($SASKey)" --cache-control "max-age=300, must-revalidate"
& $($AzCopy) cp "$($DocLocation)/versions" "$($DocDest)/$($PkgName)/versioning/versions" --cache-control "max-age=300, must-revalidate"
& $($AzCopy) cp "$($DocLocation)/latest-preview" "$($DocDest)/$($PkgName)/versioning/latest-preview" --cache-control "max-age=300, must-revalidate"
& $($AzCopy) cp "$($DocLocation)/latest-ga" "$($DocDest)/$($PkgName)/versioning/latest-ga" --cache-control "max-age=300, must-revalidate"
return $sortedVersionObj
}

Expand Down Expand Up @@ -216,7 +215,7 @@ function Upload-Blobs
}

LogDebug "Uploading $($PkgName)/$($DocVersion) to $($DocDest)..."
& $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/$($DocVersion)$($SASKey)" --recursive=true --cache-control "max-age=300, must-revalidate"
& $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/$($DocVersion)" --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)
Expand All @@ -229,7 +228,7 @@ function Upload-Blobs
if ($UploadLatest -and ($latestVersion -eq $DocVersion))
{
LogDebug "Uploading $($PkgName) to latest folder in $($DocDest)..."
& $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/latest$($SASKey)" --recursive=true --cache-control "max-age=300, must-revalidate"
& $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/latest" --recursive=true --cache-control "max-age=300, must-revalidate"
}
}

Expand Down

0 comments on commit 838f4ee

Please sign in to comment.