Skip to content

Commit b812b24

Browse files
authored
Sign the start SAS time. (#48645)
1 parent a763d6d commit b812b24

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

scripts/azure-pipelines/android/azure-pipelines.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ jobs:
7676
scriptType: bash
7777
scriptLocation: 'inlineScript' # Be very very careful that the exit code from the last pwsh is reported correctly
7878
inlineScript: |
79+
start=`date -u -d "-30 minutes" '+%Y-%m-%dT%H:%MZ'`
7980
end=`date -u -d "2 days" '+%Y-%m-%dT%H:%MZ'`
80-
assetSas=`az storage container generate-sas --name cache --account-name vcpkgassetcachewus --as-user --auth-mode login --https-only --permissions rcl --expiry $end -o tsv`
81-
binarySas=`az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --expiry $end -o tsv`
81+
assetSas=`az storage container generate-sas --name cache --account-name vcpkgassetcachewus --as-user --auth-mode login --https-only --permissions rcl --start $start --expiry $end -o tsv`
82+
binarySas=`az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --start $start --expiry $end -o tsv`
8283
echo Minting SAS tokens valid through $end
8384
echo "##vso[task.setvariable variable=BCACHE_SAS_TOKEN;issecret=true]$binarySas"
8485
USER=$(id --user)

scripts/azure-pipelines/linux/azure-pipelines.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ jobs:
7373
scriptType: bash
7474
scriptLocation: 'inlineScript' # Be very very careful that the exit code from the last pwsh is reported correctly
7575
inlineScript: |
76+
start=`date -u -d "-30 minutes" '+%Y-%m-%dT%H:%MZ'`
7677
end=`date -u -d "2 days" '+%Y-%m-%dT%H:%MZ'`
77-
assetSas=`az storage container generate-sas --name cache --account-name vcpkgassetcachewus --as-user --auth-mode login --https-only --permissions rcl --expiry $end -o tsv`
78-
binarySas=`az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --expiry $end -o tsv`
78+
assetSas=`az storage container generate-sas --name cache --account-name vcpkgassetcachewus --as-user --auth-mode login --https-only --permissions rcl --start $start --expiry $end -o tsv`
79+
binarySas=`az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --start $start --expiry $end -o tsv`
7980
echo Minting SAS tokens valid through $end
8081
# Persist the binary SAS as a secret pipeline variable for the owners-db step
8182
echo "##vso[task.setvariable variable=BCACHE_SAS_TOKEN;issecret=true]$binarySas"

scripts/azure-pipelines/osx/azure-pipelines.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ jobs:
4949
scriptLocation: 'inlineScript'
5050
inlineScript: |
5151
$current = Get-Date -AsUtc
52+
$startDate = $current.AddMinutes(-30)
5253
$endDate = $current.AddDays(2)
54+
$start = Get-Date -Date $startDate -UFormat '+%Y-%m-%dT%H:%MZ'
5355
$end = Get-Date -Date $endDate -UFormat '+%Y-%m-%dT%H:%MZ'
54-
$assetSas = az storage container generate-sas --name cache --account-name vcpkgassetcachewus --as-user --auth-mode login --https-only --permissions rcl --expiry $end -o tsv | Out-String
56+
$assetSas = az storage container generate-sas --name cache --account-name vcpkgassetcachewus --as-user --auth-mode login --https-only --permissions rcl --start $start --expiry $end -o tsv | Out-String
5557
$assetSas = $assetSas.Trim()
56-
$binarySas = az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --expiry $end -o tsv | Out-String
58+
$binarySas = az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --start $start --expiry $end -o tsv | Out-String
5759
$binarySas = $binarySas.Trim()
5860
# Persist the binary SAS as a secret pipeline variable for the owners-db step
5961
Write-Host "##vso[task.setvariable variable=BCACHE_SAS_TOKEN;issecret=true]$binarySas"

scripts/azure-pipelines/windows/azure-pipelines.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ jobs:
6666
inlineScript: |
6767
$current = Get-Date -AsUtc
6868
$endDate = $current.AddDays(2)
69+
$startDate = $current.AddMinutes(-30)
6970
$end = Get-Date -Date $endDate -UFormat '+%Y-%m-%dT%H:%MZ'
70-
$assetSas = az storage container generate-sas --name cache --account-name vcpkgassetcachewus --as-user --auth-mode login --https-only --permissions rcl --expiry $end -o tsv | Out-String
71+
$start = Get-Date -Date $startDate -UFormat '+%Y-%m-%dT%H:%MZ'
72+
$assetSas = az storage container generate-sas --name cache --account-name vcpkgassetcachewus --as-user --auth-mode login --https-only --permissions rcl --start $start --expiry $end -o tsv | Out-String
7173
$assetSas = $assetSas.Trim()
72-
$binarySas = az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --expiry $end -o tsv | Out-String
74+
$binarySas = az storage container generate-sas --name cache --account-name vcpkgbinarycachewus --as-user --auth-mode login --https-only --permissions rclw --start $start --expiry $end -o tsv | Out-String
7375
$binarySas = $binarySas.Trim()
7476
# Persist the binary SAS as a secret pipeline variable for the owners-db step
7577
Write-Host "##vso[task.setvariable variable=BCACHE_SAS_TOKEN;issecret=true]$binarySas"

0 commit comments

Comments
 (0)