Skip to content

Commit 3ec630f

Browse files
Sync eng/common directory with azure-sdk-tools for PR 12301 (#37890)
* Set up vcpkg cache variables in eng/common * Paths * Remove module code, it's not necessary anymore * Review feedback: Write-Host -> # --------- Co-authored-by: Daniel Jurek <[email protected]>
1 parent f3b08b0 commit 3ec630f

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
steps:
2+
- pwsh: |
3+
Write-Host "Setting vcpkg cache variables for read only access to vcpkg binary and asset caches"
4+
Write-Host '##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azcopy,https://azuresdkartifacts.blob.core.windows.net/public-vcpkg-container,read'
5+
Write-Host '##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://azuresdkartifacts.blob.core.windows.net/public-vcpkg-container,,read'
6+
displayName: Set vcpkg variables
7+
8+
- ${{if eq(variables['System.TeamProject'], 'internal') }}:
9+
- task: AzurePowerShell@5
10+
displayName: Set Vcpkg Write-mode Cache
11+
inputs:
12+
azureSubscription: 'Azure SDK Artifacts'
13+
ScriptType: FilePath
14+
ScriptPath: eng/common/scripts/Set-VcpkgWriteModeCache.ps1
15+
azurePowerShellVersion: LatestVersion
16+
pwsh: true
17+
# This step is idempotent and can be run multiple times in cases of
18+
# failure and partial execution.
19+
retryCountOnTaskFailure: 3
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/env pwsh
2+
param(
3+
[string] $StorageAccountName = 'azuresdkartifacts',
4+
[string] $StorageContainerName = 'public-vcpkg-container'
5+
)
6+
7+
$ctx = New-AzStorageContext `
8+
-StorageAccountName $StorageAccountName `
9+
-UseConnectedAccount
10+
11+
$vcpkgBinarySourceSas = New-AzStorageContainerSASToken `
12+
-Name $StorageContainerName `
13+
-Permission "rwcl" `
14+
-Context $ctx `
15+
-ExpiryTime (Get-Date).AddHours(1)
16+
17+
# Ensure redaction of SAS tokens in logs
18+
Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SAS_TOKEN;issecret=true;]$vcpkgBinarySourceSas"
19+
20+
Write-Host "Setting vcpkg binary cache to read and write"
21+
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"
22+
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"

0 commit comments

Comments
 (0)