[EngSys] re-enable rush build cache (#30818)
Use AzureCLI@2 task to generate a SAS for cache write credential so we don't need to store secrets anymore.
This commit is contained in:
Родитель
d5f6d677ec
Коммит
06529fc7d9
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"buildCacheEnabled": false,
|
||||
"buildCacheEnabled": true,
|
||||
// Follow instructions at
|
||||
// https://rushjs.io/pages/maintainer/build_cache/#user-authentication
|
||||
// to authenticate.
|
||||
"cacheProvider": "azure-blob-storage",
|
||||
"azureBlobStorageConfiguration": {
|
||||
"storageAccountName": "azsdkjsrush",
|
||||
"storageContainerName": "rush-build-cache",
|
||||
"storageAccountName": "azuresdkartifacts",
|
||||
"storageContainerName": "azure-sdk-for-js-rush-cache",
|
||||
"isCacheWriteAllowed": false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,12 +48,28 @@ steps:
|
|||
- template: /eng/pipelines/templates/steps/set-artifact-packages.yml
|
||||
parameters:
|
||||
Artifacts: ${{ parameters.Artifacts }}
|
||||
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI')) }}:
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: 'Azure SDK Artifacts'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'inlineScript'
|
||||
inlineScript: |
|
||||
az account show
|
||||
expiry=`date -u -d "45 minutes" '+%Y-%m-%dT%H:%MZ'`
|
||||
sasToken=$(az storage container generate-sas --account-name azuresdkartifacts --name azure-sdk-for-js-rush-cache --permissions dlrw --auth-mode login --as-user --expiry $expiry --https-only -o tsv)
|
||||
echo "##vso[task.setvariable variable=rushBuildCacheCred;issecret=true;]$sasToken"
|
||||
|
||||
# Option "-p max" ensures parallelism is set to the number of cores on all platforms, which improves build times.
|
||||
# The default on Windows is "cores - 1" (microsoft/rushstack#436).
|
||||
- script: |
|
||||
node eng/tools/rush-runner.js build "${{parameters.ServiceDirectory}}" -packages "$(ArtifactPackageNames)" --verbose -p max
|
||||
displayName: "Build libraries"
|
||||
env:
|
||||
${{ if and(eq(variables['System.TeamProject'], 'internal'), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI')) }}:
|
||||
RUSH_BUILD_CACHE_CREDENTIAL: $(rushBuildCacheCred)
|
||||
RUSH_BUILD_CACHE_WRITE_ALLOWED: 1
|
||||
|
||||
- script: |
|
||||
node eng/tools/rush-runner.js build:samples "${{parameters.ServiceDirectory}}" -packages "$(ArtifactPackageNames)" --verbose
|
||||
displayName: "Build samples"
|
||||
|
|
Загрузка…
Ссылка в новой задаче