Skip to content

Commit

Permalink
feat: Changes caching over to a passed in var
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvenSpellmaker committed Nov 23, 2020
1 parent f23167f commit 99a5594
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parameters:
customRegistry: ""
run_build: true
enable_cache: false
npm_config_cache: $(Pipeline.Workspace)/.npm
npm_cache_directory: ""

steps:
# Ensure Node.js 12 is active
Expand All @@ -33,18 +33,14 @@ steps:
# NPM modules and Cypress binary should be cached
# otherwise the install will be too slow
# https://docs.microsoft.com/en-us/azure/devops/pipelines/caching/?view=azure-devops
# since the username / user home directory are not available via system variables
# (there is even an open question about it)
# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops
# just use "/home/vsts_azpcontainer/" for now
- task: Cache@2
condition: eq(${{ parameters.enable_cache }}, true)
inputs:
key: 'npm | $(Agent.OS) | ${{ parameters.workingDirectory }}/package-lock.json'
path: $(npm_config_cache)
restoreKeys: |
npm | $(Agent.OS)
npm
path: ${{ parameters.npm_cache_directory }}
cacheHitVar: NPM_CACHE_RESTORED
displayName: Cache NPM packages

Expand Down

0 comments on commit 99a5594

Please sign in to comment.