diff --git a/eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml b/eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml index 7ba4d9018..c7ece396e 100644 --- a/eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml +++ b/eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml @@ -1,3 +1,9 @@ + +parameters: + - name: TokenTimeoutInHours + type: number + default: 1 + steps: - pwsh: | Write-Host "Setting vcpkg cache variables for read only access to vcpkg binary and asset caches" @@ -12,6 +18,7 @@ steps: azureSubscription: 'Azure SDK Artifacts' ScriptType: FilePath ScriptPath: eng/common/scripts/Set-VcpkgWriteModeCache.ps1 + ScriptArguments: -TokenTimeoutInHours ${{ parameters.TokenTimeoutInHours }} azurePowerShellVersion: LatestVersion pwsh: true # This step is idempotent and can be run multiple times in cases of diff --git a/eng/common/scripts/Set-VcpkgWriteModeCache.ps1 b/eng/common/scripts/Set-VcpkgWriteModeCache.ps1 index 51bfab05c..37bca9001 100755 --- a/eng/common/scripts/Set-VcpkgWriteModeCache.ps1 +++ b/eng/common/scripts/Set-VcpkgWriteModeCache.ps1 @@ -1,7 +1,8 @@ #!/bin/env pwsh param( [string] $StorageAccountName = 'azuresdkartifacts', - [string] $StorageContainerName = 'public-vcpkg-container' + [string] $StorageContainerName = 'public-vcpkg-container', + [int] $TokenTimeoutInHours = 1 ) $ctx = New-AzStorageContext ` @@ -12,7 +13,7 @@ $vcpkgBinarySourceSas = New-AzStorageContainerSASToken ` -Name $StorageContainerName ` -Permission "rwcl" ` -Context $ctx ` - -ExpiryTime (Get-Date).AddHours(1) + -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"