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

Fix vcpkg caching token #2909

Merged
merged 2 commits into from
Sep 12, 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
2 changes: 1 addition & 1 deletion eng/pipelines/templates/steps/ci.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ steps:
# Validate all the files are saved as ASCII only without a UTF-8 BOM.
- bash: |
# Run grep recursive excluding git folder and known expected files and save a file with results.
grep -I -P -n "[^\x00-\x7F]" -r --exclude-dir ".git" --exclude-dir "vcpkg_installed" --exclude-dir "_deps" --exclude-dir "docs" --exclude-dir "tools" --exclude "*CodeCoverage.cmake*" --exclude "grepResults" . > grepResults
grep -I -P -n "[^\x00-\x7F]" -r --exclude-dir ".git" --exclude-dir "vcpkg_installed" --exclude-dir "_deps" --exclude-dir "docs" --exclude-dir "eng" --exclude-dir "tools" --exclude "*CodeCoverage.cmake*" --exclude "grepResults" . > grepResults

# Display results to console.
cat grepResults
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/steps/vcpkg.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
steps:
- pwsh: |
Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azblob,https://cppvcpkgcache.blob.core.windows.net/public-vcpkg-container,,read"
Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://cppvcpkgcache.blob.core.windows.net/public-vcpkg-asset-container/,,read"
Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://cppvcpkgcache.blob.core.windows.net/public-vcpkg-container,,read"
displayName: Set Vcpkg Variables

- ${{if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
Expand Down
12 changes: 6 additions & 6 deletions eng/scripts/Set-VcpkgWriteModeCache.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
param(
[string] $StorageAccountName = 'cppvcpkgcache'
[string] $StorageAccountName = 'cppvcpkgcache',
[string] $StorageContainerName = 'public-vcpkg-container'
)


."$PSScriptRoot/../common/scripts/Helpers/PSModule-Helpers.ps1"

Write-Host "`$env:PSModulePath = $($env:PSModulePath)"
Expand Down Expand Up @@ -31,14 +31,14 @@ $ctx = New-AzStorageContext `
-UseConnectedAccount

$vcpkgBinarySourceSas = New-AzStorageContainerSASToken `
-Name $StorageAccountName `
-Permission "rwc" `
-Name $StorageContainerName `
-Permission "rwcl" `
-Context $ctx `
-ExpiryTime (Get-Date).AddHours(1)

Write-Host "Ensure redaction of SAS tokens in logs"
Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SAS_TOKEN;issecret=true;]$vcpkgBinarySourceSas"

Write-Host "Setting vcpkg binary cache to read and write"
Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azblob,https://cppvcpkgcache.blob.core.windows.net/public-vcpkg-container,$vcpkgBinarySourceSas,readwrite"
Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://cppvcpkgcache.blob.core.windows.net/public-vcpkg-asset-container/,?$vcpkgBinarySourceSas,readwrite"
Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azblob,https://cppvcpkgcache.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite"
Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://cppvcpkgcache.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite"