File: Set-VcpkgWriteModeCache.ps1

package info (click to toggle)
python-azure 20251104%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 770,224 kB
  • sloc: python: 6,357,217; ansic: 804; javascript: 287; makefile: 198; sh: 193; xml: 109
file content (23 lines) | stat: -rwxr-xr-x 1,082 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/env pwsh
param(
  [string] $StorageAccountName = 'azuresdkartifacts',
  [string] $StorageContainerName = 'public-vcpkg-container',
  [int] $TokenTimeoutInHours = 1
)

$ctx = New-AzStorageContext `
  -StorageAccountName $StorageAccountName `
  -UseConnectedAccount

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

# 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-azcopy-sas,https://$StorageAccountName.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite"
Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://$StorageAccountName.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite"