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

Remove SAS token from GitHubIO blob storage docs publish #8288

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
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
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: ''
danieljurek marked this conversation as resolved.
Show resolved Hide resolved
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]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orthogonal but we should probably also remove this azcopy approach given it is already on all the agent machines.

-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
Loading