Skip to content

Commit

Permalink
[EngSys] re-enable rush build cache (#30818)
Browse files Browse the repository at this point in the history
Use AzureCLI@2 task to generate a SAS for cache write credential so we
don't need to store secrets anymore.
  • Loading branch information
jeremymeng authored Aug 27, 2024
1 parent d5f6d67 commit 06529fc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions common/config/rush/build-cache.json
Original file line number Diff line number Diff line change
@@ -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
}
}
16 changes: 16 additions & 0 deletions eng/pipelines/templates/steps/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 06529fc

Please sign in to comment.